All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found] <1425878251963.1340@tataelxsi.co.in>
@ 2015-03-09  5:18 ` Srinivasan S
  2015-03-09  8:09   ` Clemens Ladisch
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-03-09  5:18 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, Peter Ujfalusi, alsa-devel, linux-audio-dev

[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]



Dear All,

Could you please provide any inputs w.r.t the loopback card using snd-aloop & alsaloop, how this loopback card can be used to connect the GSM two way call simultanoeusly to the UDA1345TS codec on MCASP0 of the am335x (UDA1345TS ie., real sound card)

The codec has two output channels VOUTL, VOUTR & two input channels VINL , VINR

As I am pretty new to linux audio particularly ALSA Framework as I was involved only in intial codec bringup using aplay & arecord utilities , as I was having some trouble getting a grasp on it all, (as I want this to be darecord one in ALSA only without entering into gstreamer or ffmpeg, could you please confirm on the same that whether can it be done in ALSA only)


If this probably isn't the place to ask this question, but I am not sure where is.  Feel free to point me somewhere else if there is a better place :)


So it seems what is happening is basically when i up the channels from VINL to VOUTL, & VINR to VOUTR ie., I am able capture from VINR & play back using VOUTR & similarly I am able to capture from VINR & route to VOUTR using the below asound.conf & the attached application

With this am able to achieve only one way call at a time by running only one application at a time ie., alsa_loopback_min_mono_VINL.c or alsa_loopback_min_mono_VINR.c

Could you please kindly let me know how two way call can be established simultaneously finally with only one application , as I tried merging both apps ie., (alsa_loopback_min_mono_VINL & alsa_loopback_min_mono_VINR) at that moment am getting device resource busy,
when I tried to open snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0) in the application alsa_loopback_min_mono.c




Kindly do the needful as early as possible,


Awaiting for your replies,


Many Many Thanks a lot for your replies & would appreciate the same w.r.t my earlier two queries




[-- Attachment #2: alsa_loopback_min_mono.txt --]
[-- Type: text/plain, Size: 4017 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (/*int argc, char *argv[]*/) {
	int err;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size;

	snd_pcm_t *playback_handle_right;
	snd_pcm_t *capture_handle_right;
	
	snd_pcm_t *playback_handle_left;
	snd_pcm_t *capture_handle_left;


#if 0	
	char* device = "default";
	if (argc > 1) device = argv[1];
#endif
	char* crdevice = "VINR";

	char* prdevice = "VOUTR";

	char* cldevice = "VINL";

	char* pldevice = "VOUTL";


	unsigned int rate = 48000;
	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;

///// RIGHT CHANNEL 
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	

////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}



	while(1) {
///// RIGHT CHANNEL 
		if ((err = snd_pcm_readi (capture_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}
////LEFT CHANNEL
		if ((err = snd_pcm_readi (capture_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "read from audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "write to audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}

	}
 
	fprintf (stderr, "close handles\n");
	snd_pcm_close (playback_handle_right);
	snd_pcm_close (capture_handle_right);

	snd_pcm_close (playback_handle_left);
	snd_pcm_close (capture_handle_left);

	return 0;
} 

[-- Attachment #3: alsa_loopback_min_mono_VINL.txt --]
[-- Type: text/plain, Size: 4055 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (/*int argc, char *argv[]*/) {
	int err;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size;

//	snd_pcm_t *playback_handle_right;
//	snd_pcm_t *capture_handle_right;
	
	snd_pcm_t *playback_handle_left;
	snd_pcm_t *capture_handle_left;


#if 0	
	char* device = "default";
	if (argc > 1) device = argv[1];
#endif
//	char* crdevice = "VINR";

//	char* prdevice = "VOUTR";

	char* cldevice = "VINL";

	char* pldevice = "VOUTL";


	unsigned int rate = 48000;
	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
//	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;
#if 0
///// RIGHT CHANNEL 
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	
#endif
////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", cldevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}



	while(1) {
#if 0
///// RIGHT CHANNEL 
		if ((err = snd_pcm_readi (capture_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}
#endif
////LEFT CHANNEL
		if ((err = snd_pcm_readi (capture_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "read from audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "write to audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}

	}
 
	fprintf (stderr, "close handles\n");
//	snd_pcm_close (playback_handle_right);
//	snd_pcm_close (capture_handle_right);

	snd_pcm_close (playback_handle_left);
	snd_pcm_close (capture_handle_left);

	return 0;
} 

[-- Attachment #4: alsa_loopback_min_mono_VINR.txt --]
[-- Type: text/plain, Size: 3907 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (/*int argc, char *argv[]*/) {
	int err;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size;

	snd_pcm_t *playback_handle_right;
	snd_pcm_t *capture_handle_right;
	
	char* crdevice = "VINR";

	char* prdevice = "VOUTR";

//	char* cldevice = "VINL";

//	char* pldevice = "VOUTL";


	unsigned int rate = 48000;
	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
//	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;

///// RIGHT CHANNEL 
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	
#if 0
////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}

#endif

	while(1) {
///// RIGHT CHANNEL 
		if ((err = snd_pcm_readi (capture_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}
#if 0
////LEFT CHANNEL
		if ((err = snd_pcm_readi (capture_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "read from audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "write to audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}
#endif
	}
 
	fprintf (stderr, "close handles\n");
	snd_pcm_close (playback_handle_right);
	snd_pcm_close (capture_handle_right);

//	snd_pcm_close (playback_handle_left);
//	snd_pcm_close (capture_handle_left);

	return 0;
} 

[-- Attachment #5: asound.conf.txt --]
[-- Type: text/plain, Size: 1281 bytes --]

# default Arago configuration
pcm.card0 {
  type hw
  card 0
}

ctl.card0 {
  type hw
  card 0
}

pcm.VOUTR {
  slave.pcm card0
  slave.channels 2
#  type plug
  type route
  ttable {
    # Copy both input channels to output channel 0 (Left).
    0.0 1
    1.1 1
    # Send nothing to output channel 1 (Right).
    0.1 0
    1.1 0
  }
}

ctl.VOUTR {
  type hw
  card 0
}


pcm.VOUTL {
  slave.pcm card0
  slave.channels 2
#  type plug
  type route
  ttable {
    # Send nothing to output channel 0 (Left).
    0.1 1
    0.1 1
    # Copy both input channels to output channel 1 (Right).
    0.0 0
    1.1 0
  }
}

ctl.VOUTL {
  type hw
  card 0
}



### Dsnoop splited channels
pcm.VINL {
     type dsnoop
     ipc_key 32
     slave {
         pcm "card0"
         channels 2
     }
     bindings.0  0
}

pcm.VINR {
     type dsnoop
     ipc_key 32
     slave {
         pcm "card0"
         channels 2
     }
     bindings.0  1
}


### PLUGS ##

### used with darkice

### device = plug:plug_onboard_left

#pcm.plug_VINR{

#       type route

#        slave.pcm "VINR"

#        slave.channels 1

#        ttable.0.0 1

#}

#pcm.plug_VINL{

#        type route

#        slave.pcm "VINL"

#        slave.channels 1

#        ttable.0.0 1

#}

pcm.!default VOUTR
pcm.!default VOUTL

[-- Attachment #6: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-03-09  5:18 ` Using loopback card to Connect GSM two way call to the real sound card UDA1345TS Srinivasan S
@ 2015-03-09  8:09   ` Clemens Ladisch
       [not found]     ` <1425922601141.50130@tataelxsi.co.in>
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-03-09  8:09 UTC (permalink / raw)
  To: Srinivasan S; +Cc: alsa-devel, linux-audio-dev

Srinivasan S wrote:
> Could you please provide any inputs w.r.t the loopback card using
> snd-aloop & alsaloop, how this loopback card can be used to connect
> the GSM two way call simultanoeusly to the UDA1345TS codec on MCASP0
> of the am335x (UDA1345TS ie., real sound card)

snd-aloop creates a virtual sound card; it is not used with a real sound
card.

> The codec has two output channels VOUTL, VOUTR & two input channels VINL , VINR
>
> With this am able to achieve only one way call at a time by running
> only one application at a time

To allow a capture device to be shared, you need to use dsnoop.  Your
asound.conf already does this.

To allow a playback device to be shared, you need to use dshare or dmix.
(dshare allows to use _different_ channels; dmix allows mixing multiple
sources into the same channels.)  Your asound.conf does not do this; it
uses "hw" instead.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [LAD] Fw: [alsa-devel] Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]         ` <1425964490006.15084-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
@ 2015-03-10 10:50           ` Clemens Ladisch
  2015-03-28  2:43             ` Fw: " Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-03-10 10:50 UTC (permalink / raw)
  To: Srinivasan S
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-audio-dev-cunTk1MwBs/CEJeg2xFRV2D2FQJk+8+b

Srinivasan S wrote:
> $ aplay -f dat -D VOUTL new.wav
> Playing WAVE 'new.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
> aplay: set_params:1087: Channels count non available

You are trying to play a two-channel file on a single-channel device.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-03-10 10:50           ` [LAD] Fw: [alsa-devel] " Clemens Ladisch
@ 2015-03-28  2:43             ` Srinivasan S
  2015-03-30 11:40               ` Fw: " Srinivasan S
       [not found]               ` <1427510661706.37789-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Srinivasan S @ 2015-03-28  2:43 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

[-- Attachment #1: Type: text/plain, Size: 2349 bytes --]

Dear Clemens,


Thanks a lot for your inputs w.r.t the below issue, Now I tried playing 48Khz mono that works fine, 

Could you please clarify the following points 

1) CPU consumption is 18%, with above asound.conf & the app alsa_loopback_min_mono.c for establishing my GSM two way call (ie., VINR to VOUTR & VINL to VOUTL) , this is very huge & I want to reduce this CPU consumption drastically, Is there any other ways in alsa where I can do this two way GSM call (ie., VINR to VOUTR & VINL to VOUTL) without using alsa_loopback_min_mono.c application

Could you please let me know if there is anything that can be done in using alsa plugins in order to reduce CPU consumption???


2) And am hearing echo, when I do GSM calls when using the above attachd asound.conf & the app alsa_loopback_min_mono.c, could you please help me out is there any options to do echo cancellation in alsa??


3)Am trying to completely understand the above attched asound.conf, but am not still very clear w.r.t the understanding of bindings in alsa plugins as am confused, Could you please clarify the doubt that 

i) Does the below lines correspond to VINL to VOUTL or VINL to VOUTR??

    bindings {
        0 1
    }


ii) & similarly does the below lines correspond VINL to VOUTL??

    bindings {
        0 0
    }

iii) similarly does the correspond VINL to VOUTL??


    bindings.0  0

iv) similarly does the correspond VINL to VOUTR or VINR to VOUTR??

    bindings.0  1



Kindly do the needful as early as possible, as only this is pending from my side w.r.t AUDIO in my project
 
Once again really appreciate & Thanks a lot for your prompt responses


Many Many Thanks in advance again,


________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Tuesday, March 10, 2015 4:20 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: Fw: [alsa-devel] Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> $ aplay -f dat -D VOUTL new.wav
> Playing WAVE 'new.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
> aplay: set_params:1087: Channels count non available

You are trying to play a two-channel file on a single-channel device.


Regards,
Clemens

[-- Attachment #2: asound.conf --]
[-- Type: application/octet-stream, Size: 743 bytes --]

pcm.card0 {
    type hw
      card 0
    
}

ctl.card0 {
    type hw
      card 0
      
}

pcm.VOUTL {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
          channels 2
      }
    bindings {
        0 1
    }
}

pcm.VOUTR {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
	  channels 2
      }
    bindings {
        0 0
    }
}


pcm.VINL {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  0
}

pcm.VINR {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  1
}




pcm.!default VOUTR
pcm.!default VOUTL

[-- Attachment #3: alsa_loopback_min_mono.txt --]
[-- Type: text/plain, Size: 4017 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (/*int argc, char *argv[]*/) {
	int err;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size;

	snd_pcm_t *playback_handle_right;
	snd_pcm_t *capture_handle_right;
	
	snd_pcm_t *playback_handle_left;
	snd_pcm_t *capture_handle_left;


#if 0	
	char* device = "default";
	if (argc > 1) device = argv[1];
#endif
	char* crdevice = "VINR";

	char* prdevice = "VOUTR";

	char* cldevice = "VINL";

	char* pldevice = "VOUTL";


	unsigned int rate = 48000;
	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;

///// RIGHT CHANNEL 
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	

////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}



	while(1) {
///// RIGHT CHANNEL 
		if ((err = snd_pcm_readi (capture_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}
////LEFT CHANNEL
		if ((err = snd_pcm_readi (capture_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "read from audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "write to audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}

	}
 
	fprintf (stderr, "close handles\n");
	snd_pcm_close (playback_handle_right);
	snd_pcm_close (capture_handle_right);

	snd_pcm_close (playback_handle_left);
	snd_pcm_close (capture_handle_left);

	return 0;
} 

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Fw: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-03-28  2:43             ` Fw: " Srinivasan S
@ 2015-03-30 11:40               ` Srinivasan S
  2015-04-01  8:38                 ` Srinivasan S
       [not found]               ` <1427510661706.37789-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
  1 sibling, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-03-30 11:40 UTC (permalink / raw)
  To: clemens; +Cc: alsa-devel, linux-audio-dev

[-- Attachment #1: Type: text/plain, Size: 2813 bytes --]


Dear Clemens

Could you please provide any inputs w.r.t the below queries


Kindly do the needful as early as possible

Many Thanks in Advance,


________________________________________
From: Srinivasan S
Sent: Saturday, March 28, 2015 8:13 AM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: Fw: [alsa-devel] Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Dear Clemens,


Thanks a lot for your inputs w.r.t the below issue, Now I tried playing 48Khz mono that works fine,

Could you please clarify the following points

1) CPU consumption is 18%, with above asound.conf & the app alsa_loopback_min_mono.c for establishing my GSM two way call (ie., VINR to VOUTR & VINL to VOUTL) , this is very huge & I want to reduce this CPU consumption drastically, Is there any other ways in alsa where I can do this two way GSM call (ie., VINR to VOUTR & VINL to VOUTL) without using alsa_loopback_min_mono.c application

Could you please let me know if there is anything that can be done in using alsa plugins in order to reduce CPU consumption???


2) And am hearing echo, when I do GSM calls when using the above attachd asound.conf & the app alsa_loopback_min_mono.c, could you please help me out is there any options to do echo cancellation in alsa??


3)Am trying to completely understand the above attched asound.conf, but am not still very clear w.r.t the understanding of bindings in alsa plugins as am confused, Could you please clarify the doubt that

i) Does the below lines correspond to VINL to VOUTL or VINL to VOUTR??

    bindings {
        0 1
    }


ii) & similarly does the below lines correspond VINL to VOUTL??

    bindings {
        0 0
    }

iii) similarly does the correspond VINL to VOUTL??


    bindings.0  0

iv) similarly does the correspond VINL to VOUTR or VINR to VOUTR??

    bindings.0  1



Kindly do the needful as early as possible, as only this is pending from my side w.r.t AUDIO in my project

Once again really appreciate & Thanks a lot for your prompt responses


Many Many Thanks in advance again,


________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Tuesday, March 10, 2015 4:20 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: Fw: [alsa-devel] Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> $ aplay -f dat -D VOUTL new.wav
> Playing WAVE 'new.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
> aplay: set_params:1087: Channels count non available

You are trying to play a two-channel file on a single-channel device.


Regards,
Clemens

[-- Attachment #2: asound.conf --]
[-- Type: application/octet-stream, Size: 743 bytes --]

pcm.card0 {
    type hw
      card 0
    
}

ctl.card0 {
    type hw
      card 0
      
}

pcm.VOUTL {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
          channels 2
      }
    bindings {
        0 1
    }
}

pcm.VOUTR {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
	  channels 2
      }
    bindings {
        0 0
    }
}


pcm.VINL {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  0
}

pcm.VINR {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  1
}




pcm.!default VOUTR
pcm.!default VOUTL

[-- Attachment #3: alsa_loopback_min_mono.txt --]
[-- Type: text/plain, Size: 4017 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (/*int argc, char *argv[]*/) {
	int err;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size;

	snd_pcm_t *playback_handle_right;
	snd_pcm_t *capture_handle_right;
	
	snd_pcm_t *playback_handle_left;
	snd_pcm_t *capture_handle_left;


#if 0	
	char* device = "default";
	if (argc > 1) device = argv[1];
#endif
	char* crdevice = "VINR";

	char* prdevice = "VOUTR";

	char* cldevice = "VINL";

	char* pldevice = "VOUTL";


	unsigned int rate = 48000;
	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;

///// RIGHT CHANNEL 
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	

////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}



	while(1) {
///// RIGHT CHANNEL 
		if ((err = snd_pcm_readi (capture_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}
////LEFT CHANNEL
		if ((err = snd_pcm_readi (capture_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "read from audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "write to audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}

	}
 
	fprintf (stderr, "close handles\n");
	snd_pcm_close (playback_handle_right);
	snd_pcm_close (capture_handle_right);

	snd_pcm_close (playback_handle_left);
	snd_pcm_close (capture_handle_left);

	return 0;
} 

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Fw: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-03-30 11:40               ` Fw: " Srinivasan S
@ 2015-04-01  8:38                 ` Srinivasan S
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivasan S @ 2015-04-01  8:38 UTC (permalink / raw)
  To: clemens; +Cc: alsa-devel, linux-audio-dev

[-- Attachment #1: Type: text/plain, Size: 3270 bytes --]


Could you please provide any inputs w.r.t the below queries


Am awaiting for your suggestions from past 2 to 3 days

Thanks,
Srinivasan S
________________________________________
From: Srinivasan S
Sent: Monday, March 30, 2015 5:10 PM
To: clemens@ladisch.de
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Fw: Fw: [alsa-devel] Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Dear Clemens

Could you please provide any inputs w.r.t the below queries


Kindly do the needful as early as possible

Many Thanks in Advance,


________________________________________
From: Srinivasan S
Sent: Saturday, March 28, 2015 8:13 AM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: Fw: [alsa-devel] Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Dear Clemens,


Thanks a lot for your inputs w.r.t the below issue, Now I tried playing 48Khz mono that works fine,

Could you please clarify the following points

1) CPU consumption is 18%, with above asound.conf & the app alsa_loopback_min_mono.c for establishing my GSM two way call (ie., VINR to VOUTR & VINL to VOUTL) , this is very huge & I want to reduce this CPU consumption drastically, Is there any other ways in alsa where I can do this two way GSM call (ie., VINR to VOUTR & VINL to VOUTL) without using alsa_loopback_min_mono.c application

Could you please let me know if there is anything that can be done in using alsa plugins in order to reduce CPU consumption???


2) And am hearing echo, when I do GSM calls when using the above attachd asound.conf & the app alsa_loopback_min_mono.c, could you please help me out is there any options to do echo cancellation in alsa??


3)Am trying to completely understand the above attched asound.conf, but am not still very clear w.r.t the understanding of bindings in alsa plugins as am confused, Could you please clarify the doubt that

i) Does the below lines correspond to VINL to VOUTL or VINL to VOUTR??

    bindings {
        0 1
    }


ii) & similarly does the below lines correspond VINL to VOUTL??

    bindings {
        0 0
    }

iii) similarly does the correspond VINL to VOUTL??


    bindings.0  0

iv) similarly does the correspond VINL to VOUTR or VINR to VOUTR??

    bindings.0  1



Kindly do the needful as early as possible, as only this is pending from my side w.r.t AUDIO in my project

Once again really appreciate & Thanks a lot for your prompt responses


Many Many Thanks in advance again,


________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Tuesday, March 10, 2015 4:20 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: Fw: [alsa-devel] Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> $ aplay -f dat -D VOUTL new.wav
> Playing WAVE 'new.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
> aplay: set_params:1087: Channels count non available

You are trying to play a two-channel file on a single-channel device.


Regards,
Clemens

[-- Attachment #2: asound.conf --]
[-- Type: application/octet-stream, Size: 743 bytes --]

pcm.card0 {
    type hw
      card 0
    
}

ctl.card0 {
    type hw
      card 0
      
}

pcm.VOUTL {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
          channels 2
      }
    bindings {
        0 1
    }
}

pcm.VOUTR {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
	  channels 2
      }
    bindings {
        0 0
    }
}


pcm.VINL {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  0
}

pcm.VINR {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  1
}




pcm.!default VOUTR
pcm.!default VOUTL

[-- Attachment #3: alsa_loopback_min_mono.txt --]
[-- Type: text/plain, Size: 4017 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (/*int argc, char *argv[]*/) {
	int err;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size;

	snd_pcm_t *playback_handle_right;
	snd_pcm_t *capture_handle_right;
	
	snd_pcm_t *playback_handle_left;
	snd_pcm_t *capture_handle_left;


#if 0	
	char* device = "default";
	if (argc > 1) device = argv[1];
#endif
	char* crdevice = "VINR";

	char* prdevice = "VOUTR";

	char* cldevice = "VINL";

	char* pldevice = "VOUTL";


	unsigned int rate = 48000;
	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;

///// RIGHT CHANNEL 
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	

////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, 500000)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}



	while(1) {
///// RIGHT CHANNEL 
		if ((err = snd_pcm_readi (capture_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right)) != buf_frames_right) {
		fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err)); exit (1);
		}
////LEFT CHANNEL
		if ((err = snd_pcm_readi (capture_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "read from audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}	

		if ((err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left)) != buf_frames_left) {
		fprintf (stderr, "write to audio interface left failed (%s)\n", snd_strerror (err)); exit (1);
		}

	}
 
	fprintf (stderr, "close handles\n");
	snd_pcm_close (playback_handle_right);
	snd_pcm_close (capture_handle_right);

	snd_pcm_close (playback_handle_left);
	snd_pcm_close (capture_handle_left);

	return 0;
} 

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [LAD] [alsa-devel] Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]               ` <1427510661706.37789-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
@ 2015-04-02  9:43                 ` Clemens Ladisch
  2015-04-02 10:36                   ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-04-02  9:43 UTC (permalink / raw)
  To: Srinivasan S
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-audio-dev-cunTk1MwBs/CEJeg2xFRV2D2FQJk+8+b

Srinivasan S wrote:
> CPU consumption is 18%, with above asound.conf & the app
> alsa_loopback_min_mono.c for establishing my GSM two way call (ie.,
> VINR to VOUTR & VINL to VOUTL) , this is very huge & I want to reduce
> this CPU consumption drastically, Is there any other ways in alsa where
> I can do this two way GSM call (ie., VINR to VOUTR & VINL to VOUTL)
> without using alsa_loopback_min_mono.c application

dmix needs more CPU than dshare because it needs to mix multiple streams
together; if possible, use dshare instead of dmix.

dshare needs more CPU than direct access to the device because the data
needs to be copied and reformatted.  dshare is needed only when the
application(s) cannot handle the format of the actual device; if
possible, change your application to handle the two-channel devices.

> And am hearing echo, when I do GSM calls when using the above attachd
> asound.conf & the app alsa_loopback_min_mono.c, could you please help
> me out is there any options to do echo cancellation in alsa?

ALSA has not built-in echo cancellation.  You have to implement this
yourself, or use some third-party library.

If dmix/dshare alone eats 18 % CPU, it is unlikely that this is feasible
without hardware support.

> Am trying to completely understand the above attched asound.conf, but
> am not still very clear w.r.t the understanding of bindings

"bindings.x y" or "bindings { x y }" maps channel x of this device to
channel y of the slave device.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-02  9:43                 ` [LAD] [alsa-devel] " Clemens Ladisch
@ 2015-04-02 10:36                   ` Srinivasan S
  2015-04-02 15:08                     ` Clemens Ladisch
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-04-02 10:36 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Thanks a lot for your Prompt responses Clemens

Extremely sorry for my poor understanding,

Could you please clarify the following

1. As per your suggestions below, I didn't understand what is 'two channel devices' does this means do we need to have to real hardware sound card's (ie., two different audio codecs)??? whereas as of now am using only one audio codec( ie., UDA1345TS), if not could you please help me out how to use two channel devices using alsa api's in application or any references for the same???

2. Regarding bindings as you explained"bindings.x y" or "bindings { x y }" maps channel x of this device to
channel y of the slave device.

I didn't understand channel x of this device means is it the real sound card??? which is the current device ie., channel x of this device means???

I didn't understand channel y of the slave device means??..  ie., which is slave device here????

Kindly do the needful as early as possible

Awaiting for your replies

Many Thanks in advance
________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Thursday, April 2, 2015 3:13 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> CPU consumption is 18%, with above asound.conf & the app
> alsa_loopback_min_mono.c for establishing my GSM two way call (ie.,
> VINR to VOUTR & VINL to VOUTL) , this is very huge & I want to reduce
> this CPU consumption drastically, Is there any other ways in alsa where
> I can do this two way GSM call (ie., VINR to VOUTR & VINL to VOUTL)
> without using alsa_loopback_min_mono.c application

dmix needs more CPU than dshare because it needs to mix multiple streams
together; if possible, use dshare instead of dmix.

dshare needs more CPU than direct access to the device because the data
needs to be copied and reformatted.  dshare is needed only when the
application(s) cannot handle the format of the actual device; if
possible, change your application to handle the two-channel devices.

> And am hearing echo, when I do GSM calls when using the above attachd
> asound.conf & the app alsa_loopback_min_mono.c, could you please help
> me out is there any options to do echo cancellation in alsa?

ALSA has not built-in echo cancellation.  You have to implement this
yourself, or use some third-party library.

If dmix/dshare alone eats 18 % CPU, it is unlikely that this is feasible
without hardware support.

> Am trying to completely understand the above attched asound.conf, but
> am not still very clear w.r.t the understanding of bindings

"bindings.x y" or "bindings { x y }" maps channel x of this device to
channel y of the slave device.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-02 10:36                   ` Srinivasan S
@ 2015-04-02 15:08                     ` Clemens Ladisch
  2015-04-22  6:11                       ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-04-02 15:08 UTC (permalink / raw)
  To: Srinivasan S; +Cc: alsa-devel, linux-audio-dev

Srinivasan S wrote:
> I didn't understand what is 'two channel devices' does

The two channels are "left" and "right".

> Regarding bindings as you explained"bindings.x y" or "bindings { x y }" maps channel x of this device to
> channel y of the slave device.
>
> I didn't understand channel x of this device means is it the real sound card??? which is the current device ie., channel x of this device means???
>
> I didn't understand channel y of the slave device means??..  ie., which is slave device here????

"This device" is the virtual device that is defined.
The slave device is the device whose name is specified with "slave.pcm".


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-02 15:08                     ` Clemens Ladisch
@ 2015-04-22  6:11                       ` Srinivasan S
  2015-04-24  6:26                         ` Srinivasan S
                                           ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Srinivasan S @ 2015-04-22  6:11 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Dear Clemens,

Thanks a lot for your information, It is really understandable for a newbie like me

As you suggested, could you please provide me some sample application links without using dshare plugin , ie., using the two channels ie., left & right directly

So that I can reduce the CPU consumption drastically

Thanks  a lot for your prompt support w.r.t this thread once again

Kindly do the needful as early as possible

Many Thanks in advance again




________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Thursday, April 2, 2015 8:38 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> I didn't understand what is 'two channel devices' does

The two channels are "left" and "right".

> Regarding bindings as you explained"bindings.x y" or "bindings { x y }" maps channel x of this device to
> channel y of the slave device.
>
> I didn't understand channel x of this device means is it the real sound card??? which is the current device ie., channel x of this device means???
>
> I didn't understand channel y of the slave device means??..  ie., which is slave device here????

"This device" is the virtual device that is defined.
The slave device is the device whose name is specified with "slave.pcm".


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-22  6:11                       ` Srinivasan S
@ 2015-04-24  6:26                         ` Srinivasan S
  2015-04-24  6:26                         ` Srinivasan S
       [not found]                         ` <1429683117651.11394-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
  2 siblings, 0 replies; 23+ messages in thread
From: Srinivasan S @ 2015-04-24  6:26 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Dear Clemens,

Could you please provide any inputs or suggestions w.r.t the below query

Kindly do the needful as early as possible,

Many Thanks in advance,

________________________________________
From: Srinivasan S
Sent: Wednesday, April 22, 2015 11:41 AM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Dear Clemens,

Thanks a lot for your information, It is really understandable for a newbie like me

As you suggested, could you please provide me some sample application links without using dshare plugin , ie., using the two channels ie., left & right directly

So that I can reduce the CPU consumption drastically

Thanks  a lot for your prompt support w.r.t this thread once again

Kindly do the needful as early as possible

Many Thanks in advance again




________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Thursday, April 2, 2015 8:38 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> I didn't understand what is 'two channel devices' does

The two channels are "left" and "right".

> Regarding bindings as you explained"bindings.x y" or "bindings { x y }" maps channel x of this device to
> channel y of the slave device.
>
> I didn't understand channel x of this device means is it the real sound card??? which is the current device ie., channel x of this device means???
>
> I didn't understand channel y of the slave device means??..  ie., which is slave device here????

"This device" is the virtual device that is defined.
The slave device is the device whose name is specified with "slave.pcm".


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-22  6:11                       ` Srinivasan S
  2015-04-24  6:26                         ` Srinivasan S
@ 2015-04-24  6:26                         ` Srinivasan S
       [not found]                         ` <1429683117651.11394-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
  2 siblings, 0 replies; 23+ messages in thread
From: Srinivasan S @ 2015-04-24  6:26 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev


Dear Clemens,

Could you please provide any inputs or suggestions w.r.t the below query

Kindly do the needful as early as possible,

Many Thanks in advance,
________________________________________
From: alsa-devel-bounces@alsa-project.org <alsa-devel-bounces@alsa-project.org> on behalf of Srinivasan S <srinivasan.s@tataelxsi.co.in>
Sent: Wednesday, April 22, 2015 11:41 AM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way        call    to the real sound card UDA1345TS

Dear Clemens,

Thanks a lot for your information, It is really understandable for a newbie like me

As you suggested, could you please provide me some sample application links without using dshare plugin , ie., using the two channels ie., left & right directly

So that I can reduce the CPU consumption drastically

Thanks  a lot for your prompt support w.r.t this thread once again

Kindly do the needful as early as possible

Many Thanks in advance again




________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Thursday, April 2, 2015 8:38 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> I didn't understand what is 'two channel devices' does

The two channels are "left" and "right".

> Regarding bindings as you explained"bindings.x y" or "bindings { x y }" maps channel x of this device to
> channel y of the slave device.
>
> I didn't understand channel x of this device means is it the real sound card??? which is the current device ie., channel x of this device means???
>
> I didn't understand channel y of the slave device means??..  ie., which is slave device here????

"This device" is the virtual device that is defined.
The slave device is the device whose name is specified with "slave.pcm".


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [LAD] [alsa-devel] Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]                         ` <1429683117651.11394-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
@ 2015-04-24  8:06                           ` Clemens Ladisch
  2015-04-24 12:05                             ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-04-24  8:06 UTC (permalink / raw)
  To: Srinivasan S
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-audio-dev-cunTk1MwBs/CEJeg2xFRV2D2FQJk+8+b

Srinivasan S wrote:
> could you please provide me some sample application links without
> using dshare plugin , ie., using the two channels ie., left & right
> directly

I am not aware of any (sample) program that does something like this
(except maybe Jack, but floating-point samples would not be appropriate
for your application).

You have to implement this yourself.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-24  8:06                           ` [LAD] [alsa-devel] " Clemens Ladisch
@ 2015-04-24 12:05                             ` Srinivasan S
       [not found]                               ` <1429877130444.23317-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-04-24 12:05 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev


Thanks  a lot for your quick responses Clemens,

Sorry for my poor understanding 

As am newbie to alsa, due to time constraints am unable to spend time in writing my own application

As per your suggestion, did you mean that , If I use Jack plugin , does it resolve this problem (ie., does the CPU consumption reduce drastically instead of dshare)


Kindly do the needful

Once again Thanks a lot for your suggestions Clemens w.r.t this Thread

Thanks in advance,
Srinivasan S

________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Friday, April 24, 2015 1:36 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> could you please provide me some sample application links without
> using dshare plugin , ie., using the two channels ie., left & right
> directly

I am not aware of any (sample) program that does something like this
(except maybe Jack, but floating-point samples would not be appropriate
for your application).

You have to implement this yourself.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [LAD] [alsa-devel] Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]                               ` <1429877130444.23317-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
@ 2015-04-24 12:45                                 ` Clemens Ladisch
  2015-05-29 11:20                                   ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-04-24 12:45 UTC (permalink / raw)
  To: Srinivasan S
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-audio-dev-cunTk1MwBs/CEJeg2xFRV2D2FQJk+8+b

Srinivasan S wrote:
> did you mean that , If I use Jack plugin , does it resolve this
> problem (ie., does the CPU consumption reduce drastically instead of
> dshare)

It is unlikely that running your two programs on top of Jack will use
less CPU than with dshare.  However, I don't know the details of your
architecture, so the only way to find out would be for you to try it.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-04-24 12:45                                 ` [LAD] [alsa-devel] " Clemens Ladisch
@ 2015-05-29 11:20                                   ` Srinivasan S
  2015-06-01  6:01                                     ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-05-29 11:20 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Dear Clemens,

As you suggested am using jack plugin, but am facing the below error

etc/asound.conf

pcm.!default {
    type plug
    slave { pcm "jack" }
}

pcm.jack {
    type jack
    playback_ports {
        0 alsa_pcm:playback_1
        1 alsa_pcm:playback_2
    }
    capture_ports {
        0 alsa_pcm:capture_1
        1 alsa_pcm:capture_2
    }
}

ctl.mixer0 {
    type hw
    card 0
}

root@am335x-evm:/# aplay -D pcm.jack TangoForTajMusic11.wav
ALSA lib 
/home/jenkins/amsdk-nightly-build/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1.0.27.2/src/pcm/pcm.c:2239:(snd_pcm_open_noupdate) 
Unknown PCM pcm.jack
aplay: main:722: audio open error: No such file or directory
root@am335x-evm:/#


Pls find the details of the architecture as below:

what ever the GSM analog audio out data is pumped as VINR to stereo codec & the output of the stereo codec ie., VOUTR is pumped to the Speaker of the custom board

what ever the GSM analog audio out data is pumped as VINR to stereo codec & the output of the stereo codec ie., VOUTR is pumped to the Speaker of the custom board
GSM MIC-> VINR -> stereo codec->VOUTR -> board speaker

what ever the board MIC data is pumped as VINL to stereo codec & the output of the stereo codec ie., VOUTL is pumped as analog input to the GSM Speaker
Board Mic -> VINL-> stereo codec -> VOUTL ->GSM speaker

Pls let me know if any other details is required from my side

Kindly do the needful as early as possible
Awaiting for your suggestions

________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Friday, April 24, 2015 6:15 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> did you mean that , If I use Jack plugin , does it resolve this
> problem (ie., does the CPU consumption reduce drastically instead of
> dshare)

It is unlikely that running your two programs on top of Jack will use
less CPU than with dshare.  However, I don't know the details of your
architecture, so the only way to find out would be for you to try it.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-05-29 11:20                                   ` Srinivasan S
@ 2015-06-01  6:01                                     ` Srinivasan S
       [not found]                                       ` <HKXPR04MB277B58064C140058C37487EC3B60-T1ls2vrYf5VLAZUorM51PQfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-06-01  6:01 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

[-- Attachment #1: Type: text/plain, Size: 3927 bytes --]

Dear Clemens

Could you please help me in converting the above asound.conf to jack plugin by providing some tips 

1. Pls find the details of the architecture as below:

what ever the GSM analog audio out data is pumped as VINR to stereo codec & the output of the stereo codec ie., VOUTR is pumped to the Speaker of the custom board

what ever the GSM analog audio out data is pumped as VINR to stereo codec & the output of the stereo codec ie., VOUTR is pumped to the Speaker of the custom board
GSM MIC-> VINR -> stereo codec->VOUTR -> board speaker

what ever the board MIC data is pumped as VINL to stereo codec & the output of the stereo codec ie., VOUTL is pumped as analog input to the GSM Speaker
Board Mic -> VINL-> stereo codec -> VOUTL ->GSM speaker

2. Could you please let me know, I have downloaded jack-1.9.10.tar.bz2, how this needs to be installed in my rootfs

Pls let me know if any other details is required from my side

Thanks,
Srinivasan S
________________________________________
From: alsa-devel-bounces@alsa-project.org <alsa-devel-bounces@alsa-project.org> on behalf of Srinivasan S <srinivasan.s@tataelxsi.co.in>
Sent: Friday, May 29, 2015 4:50 PM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way        call    to the real sound card UDA1345TS

Dear Clemens,

As you suggested am using jack plugin, but am facing the below error

etc/asound.conf

pcm.!default {
    type plug
    slave { pcm "jack" }
}

pcm.jack {
    type jack
    playback_ports {
        0 alsa_pcm:playback_1
        1 alsa_pcm:playback_2
    }
    capture_ports {
        0 alsa_pcm:capture_1
        1 alsa_pcm:capture_2
    }
}

ctl.mixer0 {
    type hw
    card 0
}

root@am335x-evm:/# aplay -D pcm.jack TangoForTajMusic11.wav
ALSA lib
/home/jenkins/amsdk-nightly-build/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1.0.27.2/src/pcm/pcm.c:2239:(snd_pcm_open_noupdate)
Unknown PCM pcm.jack
aplay: main:722: audio open error: No such file or directory
root@am335x-evm:/#


Pls find the details of the architecture as below:

what ever the GSM analog audio out data is pumped as VINR to stereo codec & the output of the stereo codec ie., VOUTR is pumped to the Speaker of the custom board

what ever the GSM analog audio out data is pumped as VINR to stereo codec & the output of the stereo codec ie., VOUTR is pumped to the Speaker of the custom board
GSM MIC-> VINR -> stereo codec->VOUTR -> board speaker

what ever the board MIC data is pumped as VINL to stereo codec & the output of the stereo codec ie., VOUTL is pumped as analog input to the GSM Speaker
Board Mic -> VINL-> stereo codec -> VOUTL ->GSM speaker

Pls let me know if any other details is required from my side

Kindly do the needful as early as possible
Awaiting for your suggestions

________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Friday, April 24, 2015 6:15 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> did you mean that , If I use Jack plugin , does it resolve this
> problem (ie., does the CPU consumption reduce drastically instead of
> dshare)

It is unlikely that running your two programs on top of Jack will use
less CPU than with dshare.  However, I don't know the details of your
architecture, so the only way to find out would be for you to try it.


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[-- Attachment #2: asound.conf --]
[-- Type: application/octet-stream, Size: 743 bytes --]

pcm.card0 {
    type hw
      card 0
    
}

ctl.card0 {
    type hw
      card 0
      
}

pcm.VOUTL {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
          channels 2
      }
    bindings {
        0 1
    }
}

pcm.VOUTR {
    type dshare
      ipc_key 6678293
      ipc_key_add_uid yes
      slave {
          pcm "hw:0"
	  channels 2
      }
    bindings {
        0 0
    }
}


pcm.VINL {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  0
}

pcm.VINR {
    type dsnoop
      ipc_key 32
      slave {
          pcm "card0"
            channels 2
      }
    bindings.0  1
}




pcm.!default VOUTR
pcm.!default VOUTL

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [LAD] [alsa-devel] Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]                                       ` <HKXPR04MB277B58064C140058C37487EC3B60-T1ls2vrYf5VLAZUorM51PQfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
@ 2015-06-01 14:39                                         ` Clemens Ladisch
  2015-06-03  6:05                                           ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-06-01 14:39 UTC (permalink / raw)
  To: Srinivasan S
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-audio-dev-cunTk1MwBs/CEJeg2xFRV2D2FQJk+8+b

Srinivasan S wrote:
> 2. Could you please let me know, I have downloaded jack-1.9.10.tar.bz2, how this needs to be installed in my rootfs

IIRC Jack uses some non-standard build system.  Try asking on the Jack
mailing list how to cross-compile it.

Please note that the ALSA Jack plugin is part of the alsa-plugins
package.

And as I already mentioned, it is unlikely that Jack will use less CPU
than dshare.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-06-01 14:39                                         ` [LAD] [alsa-devel] " Clemens Ladisch
@ 2015-06-03  6:05                                           ` Srinivasan S
       [not found]                                             ` <SIXPR04MB2530654AB664B2CE19B4665C3A80@SIXPR04MB253.apcprd04.prod.outlook.com>
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-06-03  6:05 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Dear Clemens

As I didn't find Jack mailing lists by googling, could you please 
loop Jack mailing lists to this mail chain

Kindly do the needful as early as possible
Many Thanks in advance
________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Monday, June 1, 2015 8:09 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> 2. Could you please let me know, I have downloaded jack-1.9.10.tar.bz2, how this needs to be installed in my rootfs

IIRC Jack uses some non-standard build system.  Try asking on the Jack
mailing list how to cross-compile it.

Please note that the ALSA Jack plugin is part of the alsa-plugins
package.

And as I already mentioned, it is unlikely that Jack will use less CPU
than dshare.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]                                             ` <SIXPR04MB2530654AB664B2CE19B4665C3A80@SIXPR04MB253.apcprd04.prod.outlook.com>
@ 2015-07-01  7:34                                               ` Srinivasan S
       [not found]                                                 ` <SIXPR04MB2531DB716093D09C156BEA0C3A80-gTWnircbfuxAKSrPHYfF6gfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-07-01  7:34 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

[-- Attachment #1: Type: text/plain, Size: 4961 bytes --]

Dear Clemens,

Many Thanks a lot for all your support w.r.t this thread so far

Am facing overrun & underrun issues, when I run the the above GSM application with the attached asound.conf

I have some understanding by googling & found why this overrun & underrun issues occurs ie., unable to transfer audio frames from hardware buffers to application buffers(for capture) & the viceversa(for playback), 

As I googled, I didn't get detailed information with bits & pieces here & there, could you please help me out in resolving this overrun & underrun issue ie., how to set this buffer size or only buffer_size is causing this issue or any other parameters like period_size, period_time values should also be considered inorder to fix this overrun & underrun issue

Now I have randomly set the buffer size ie., 4097 for 8Khz sampling rate

But I have no idea logically how this buffer size 4097 is working for 8Khz & when I copied the same buffer size to 48Khz, the audio gets cut & again overrun & underrun issue is seen

Could you please help me out how to fix this overrun & underrun issue logically, rather than I have that an understanding of programming some random values like 4097

Is it possible to fix this issue in asound.conf itself, rather than using multithreading in GSM application

So that fixing these types of issues henceforth will be faster & addressed logically & will be helpful for others as well


Kindly do the needful as early as possible

Many Thanks in advance once again



________________________________________
From: Srinivasan S
Sent: Wednesday, July 1, 2015 12:54 PM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way        call    to the real sound card UDA1345TS

Dear Clemens,

Many Thanks a lot for all your support w.r.t this thread so far

Am facing overrun & underrun issues on TI AM335x, when I run the the above GSM application with the attached asound.conf

I have some understanding by googling & found why this overrun & underrun issues occurs ie., unable to transfer audio frames from hardware buffers to application buffers(for capture) & the viceversa(for playback),

As I googled, I didn't get detailed information with bits & pieces here & there, could you please help me out in resolving this overrun & underrun issue ie., how to set this buffer size or only buffer_size is causing this issue or any other parameters like period_size, period_time values should also be considered inorder to fix this overrun & underrun issue

Now I have randomly set the buffer size ie., 4097 for 8Khz sampling rate

But I have no idea logically how this buffer size 4097 is working for 8Khz & when I copied the same buffer size to 48Khz, the audio gets cut & again overrun & underrun issue is seen

Could you please help me out how to fix this overrun & underrun issue logically, rather than I have that an understanding of programming some random values like 4097

Is it possible to fix this issue in asound.conf itself, rather than using multithreading in GSM application

So that fixing these types of issues henceforth will be faster & addressed logically & will be helpful for others as well


Kindly do the needful as early as possible

Many Thanks in advance once again




________________________________________
From: alsa-devel-bounces@alsa-project.org <alsa-devel-bounces@alsa-project.org> on behalf of Srinivasan S <srinivasan.s@tataelxsi.co.in>
Sent: Wednesday, June 3, 2015 11:35 AM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way        call    to the real sound card UDA1345TS

Dear Clemens

As I didn't find Jack mailing lists by googling, could you please
loop Jack mailing lists to this mail chain

Kindly do the needful as early as possible
Many Thanks in advance
________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Monday, June 1, 2015 8:09 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> 2. Could you please let me know, I have downloaded jack-1.9.10.tar.bz2, how this needs to be installed in my rootfs

IIRC Jack uses some non-standard build system.  Try asking on the Jack
mailing list how to cross-compile it.

Please note that the ALSA Jack plugin is part of the alsa-plugins
package.

And as I already mentioned, it is unlikely that Jack will use less CPU
than dshare.


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[-- Attachment #2: gsm_application.txt.txt --]
[-- Type: text/plain, Size: 9657 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define BUF_BYTES 128
 
int main (int argc, char *argv[]) {
	int err, rc ;
	unsigned char buf_right[BUF_BYTES];
	unsigned char buf_left[BUF_BYTES];
	 //char *buf;
	int size; 
	snd_pcm_t *playback_handle_right;
	snd_pcm_t *capture_handle_right;
	
	snd_pcm_t *playback_handle_left;
	snd_pcm_t *capture_handle_left;


#if 0	
	char* device = "default";
	if (argc > 1) device = argv[1];
#endif
	char* crdevice ;
        char* prdevice ;
        char* cldevice ;
        char* pldevice ;


	unsigned int rate ;
        unsigned int latancy;

	unsigned int nchannels = 1;
	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
	unsigned int buf_frames_right = BUF_BYTES / nchannels / 2;
	unsigned int buf_frames_left = BUF_BYTES / nchannels / 2;

        if(argc != 3 )
        {
            printf("\nUsage is : application  sampling_rate latancy \n\n\t Ex: ./gsm_application_target 8000 \n\n\t Supported sampling rates are: \n\t 1) 8000 \n\t 2) 16000 \n\t 3) 32000 \n\t 4) 44100 \n\t 5) 48000 \n\n NOTE: Any number other than given sampling rate takes default as 48000\n\n");
            exit(1);
        }

        rate = (int)atoi(argv[1]);
        latancy = (int)atoi(argv[2]);


        if(rate == 8000)
        {
           crdevice = "VINR8";
           prdevice = "VOUTL8";
           cldevice = "VINL8";
           pldevice = "VOUTR8";

           
        }else if(rate == 16000)
        {
            crdevice = "VINR16";
            prdevice = "VOUTR16";
            cldevice = "VINL16";
            pldevice = "VOUTL16";

        }else if(rate == 32000)
        {
            crdevice = "VINR32";
            prdevice = "VOUTR32";
            cldevice = "VINL32";
            pldevice = "VOUTL32";

        }else if(rate == 44100)
        {
            crdevice = "VINR44";
            prdevice = "VOUTR44";
            cldevice = "VINL44";
            pldevice = "VOUTL44";

        }else
        {
            crdevice = "VINR48";
            prdevice = "VOUTL48";
            cldevice = "VINL48";
            pldevice = "VOUTR48";
            rate = 48000;
        }



///// RIGHT CHANNEL 
newStart:
	if ((err = snd_pcm_open (&playback_handle_right, prdevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback right audio device %s (%s)\n", prdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback right audio device  successfully %s \n", prdevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, latancy)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback right open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_right, crdevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture right audio device %s (%s)\n", crdevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture right audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_right, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, latancy)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture right open error: %s\n", snd_strerror(err)); exit(1);
	}	

////LEFT CHANNEL
	if ((err = snd_pcm_open (&playback_handle_left, pldevice, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
	fprintf (stderr, "cannot open playback left audio device %s (%s)\n", pldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Playback left audio device successfully %s \n", pldevice);
	}
	
	if ((err = snd_pcm_set_params(playback_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, latancy)) < 0) { /* 0.5sec */
	fprintf(stderr, "Playback left open error: %s\n", snd_strerror(err)); exit(1);
	}

	if ((err = snd_pcm_open (&capture_handle_left, cldevice, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
	fprintf (stderr, "cannot open capture left audio device %s (%s)\n", cldevice, snd_strerror (err)); exit (1);
	}
	else
	{
	  printf("Opened Capture left audio device successfully %s \n", crdevice);
	}

	if ((err = snd_pcm_set_params(capture_handle_left, format, SND_PCM_ACCESS_RW_INTERLEAVED, nchannels, rate, 1, latancy)) < 0) { /* 0.5sec */
	fprintf(stderr, "capture left open error: %s\n", snd_strerror(err)); exit(1);
	}



	while(1) {
///// RIGHT CHANNEL 
                /***** Read the Frames from the Capture Device ******/
                snd_pcm_prepare(capture_handle_right);
                err = snd_pcm_readi(capture_handle_right, buf_right, buf_frames_right);
                if(err < 0)
                {
                    printf("capture right func: overrun!");
                    rc = snd_pcm_prepare(capture_handle_right);
                    if(rc < 0)
                    {
                       printf("Fail to recover from problem, Need to reopen the device\n");
                    }
                }
                if(err < 0)
                {
                    fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err));
                    rc = snd_pcm_recover(capture_handle_right,err,0);
                    if(rc < 0)
                    {
                       printf("Fail to recover from problem, Need to reopen the device\n");
                       goto reStart;
                    }
                }else if(err != (int)buf_frames_right)
                {
                    fprintf(stderr, "short read, read %d frames\n", err);
                }
             
                snd_pcm_prepare(playback_handle_right);
               /****  Write the capture frame to playback ******/
                err = snd_pcm_writei (playback_handle_right, buf_right, buf_frames_right);
                if(err == -EPIPE)
                {
                  printf("Playback right func: overrun!");
                  rc = snd_pcm_prepare(playback_handle_right);
                  if(rc < 0)
                  {
                      printf("Fail to recover from problem, Need to reopen the device\n");
                  }
                }
                if(err < 0)
                {
                    fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err));
                    rc = snd_pcm_recover(playback_handle_right, err, 0);
                    if(rc < 0)
                    {
                        printf("Fail to recover from problem, Need to reopen the device\n");
                        goto reStart;
                    }
                }else if(err != (int)buf_frames_right)
                {
                    fprintf(stderr, "short write, write %d frames\n", err);
                }


////LEFT CHANNEL
                 snd_pcm_prepare(capture_handle_left);

	        /***** Read the Frames from the Capture Device ******/
                err = snd_pcm_readi(capture_handle_left, buf_left, buf_frames_left);
                if(err == -EPIPE)
                {
                    printf("capture right func: overrun!");
                    rc = snd_pcm_prepare(capture_handle_left);
                    if(rc < 0)
                    {
                       printf("Fail to recover from problem, Need to reopen the device\n");
                    }
                }
                if(err < 0)
                {
                    fprintf (stderr, "read from audio interface right failed (%s)\n", snd_strerror (err));
                    rc = snd_pcm_recover(capture_handle_left,err,0);
                    if(rc < 0)
                    {
                       printf("Fail to recover from problem, Need to reopen the device\n");
                       goto reStart;
                    }
                }else if(err != (int)buf_frames_left)
                {
                    fprintf(stderr, "short read, read %d frames\n", err);
                }
	        
   
                 snd_pcm_prepare(playback_handle_left);

		   /****  Write the capture frame to playback ******/
                 err = snd_pcm_writei (playback_handle_left, buf_left, buf_frames_left);
                 if(err == -EPIPE)
                 {
                  printf("Playback right func: overrun!");
                  rc = snd_pcm_prepare(playback_handle_left);
                  if(rc < 0)
                  {
                      printf("Fail to recover from problem, Need to reopen the device\n");
                      goto reStart;
                  }
                }
                if(err < 0)
                {
                    fprintf (stderr, "write to audio interface right failed (%s)\n", snd_strerror (err));
                    rc = snd_pcm_recover(playback_handle_left, err, 0);
                    if(rc < 0)
                    {
                        printf("Fail to recover from problem, Need to reopen the device\n");
                        goto reStart;
                    }
                }else if(err != (int)buf_frames_left)
                {
                    fprintf(stderr, "short write, write %d frames\n", err);
                }


	}
 
reStart:	fprintf (stderr, "close handles\n");
	        snd_pcm_close (playback_handle_right);
	        snd_pcm_close (capture_handle_right);

	        snd_pcm_close (playback_handle_left);
	        snd_pcm_close (capture_handle_left);
                sleep(2);              
                goto newStart;
                
	        return 0;
} 

[-- Attachment #3: asound.conf --]
[-- Type: application/octet-stream, Size: 6397 bytes --]

#This configuration for 3.14 kernel
pcm.card0 {
  type hw
  card 0
}

ctl.card0 {
  type hw
  card 0
}


###Dshare 

pcm.VOUTL8 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
		        rate 8000
                buffer_size 4097
                period_size 1000
                period_time 125000

        }
        bindings {
                0 0
        }
}

pcm.VOUTR8 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
		        rate 8000
		        buffer_size 4097
                period_size 1000
         	    period_time 125000
		
        }
        bindings {
                0 1
        }
}
### Dsnoop splited channels
pcm.VINL8 {
        type dsnoop
        ipc_key 32
        slave {

	            pcm "hw:0,0"
	            rate 8000
                buffer_size 4097    
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  0
}

pcm.VINR8 {
     type dsnoop
     ipc_key 32
     slave {
	            pcm "hw:0,0"
	            rate 8000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  1
}



###Dshare 16k 

pcm.VOUTL16 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 16000
                buffer_size 4097
                period_size 1000
                period_time 125000

        }
        bindings {
                0 0
        }
}

pcm.VOUTR16 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 16000
                buffer_size 4097
                period_size 1000
                period_time 125000


        }
        bindings {
                0 1
        }
}
### Dsnoop splited channels
pcm.VINL16 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 16000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  0
}

pcm.VINR16 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 16000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  1
}


###Dshare 32k

pcm.VOUTL32 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 32000
                buffer_size 4097
                period_size 1000
                period_time 125000

        }
        bindings {
                0 0
        }
}

pcm.VOUTR32 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 32000
                buffer_size 4097
                period_size 1000
                period_time 125000


        }
        bindings {
                0 1
        }
}
### Dsnoop splited channels
pcm.VINL32 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 32000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  0
}

pcm.VINR32 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 32000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  1
}


###Dshare 44k

pcm.VOUTL44 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 44100
                buffer_size 4097
                period_size 1000
                period_time 125000

        }
        bindings {
                0 0
        }
}

pcm.VOUTR44 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 44100
                buffer_size 4097
                period_size 1000
                period_time 125000


        }
        bindings {
                0 1
        }
}
### Dsnoop splited channels
pcm.VINL44 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 44100
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  0
}

pcm.VINR44 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 44100
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  1
}

###Dshare 48k
pcm.VOUTL48 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 48000
                buffer_size 4097
                period_size 1000
                period_time 125000

        }
        bindings {
                0 0
        }
}

pcm.VOUTR48 {
        type dshare
        ipc_key 6678293
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
                rate 48000
                buffer_size 4097
                period_size 1000
                period_time 125000


        }
        bindings {
                0 1
        }
}

### Dsnoop splited channels
pcm.VINL48 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 48000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  0
}

pcm.VINR48 {
     type dsnoop
     ipc_key 32
     slave {

                pcm "hw:0,0"
                rate 48000
                buffer_size 4097
                period_size 1000
                period_time 125000

         channels 2
     }
     bindings.0  1
}



pcm.!default VOUTR8
pcm.!default VOUTL8
pcm.!default VOUTR16
pcm.!default VOUTL16
pcm.!default VOUTR32
pcm.!default VOUTL32
pcm.!default VOUTR44
pcm.!default VOUTL44
pcm.!default VOUTR48
pcm.!default VOUTL48



[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [LAD] [alsa-devel] Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
       [not found]                                                 ` <SIXPR04MB2531DB716093D09C156BEA0C3A80-gTWnircbfuxAKSrPHYfF6gfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
@ 2015-07-01 14:11                                                   ` Clemens Ladisch
  2015-07-08 15:25                                                     ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Clemens Ladisch @ 2015-07-01 14:11 UTC (permalink / raw)
  To: Srinivasan S
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-audio-dev-cunTk1MwBs/CEJeg2xFRV2D2FQJk+8+b

Srinivasan S wrote:
> Am facing overrun & underrun issues, when I run the the above GSM application with the attached asound.conf

The sound card and the GSM streams are not synchronized.
You need to compensate for the drift between the clocks, typically by resampling.
(Jack's alsa_in/alsa_out would automatically do this.)


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-07-01 14:11                                                   ` [LAD] [alsa-devel] " Clemens Ladisch
@ 2015-07-08 15:25                                                     ` Srinivasan S
  2015-07-09  5:25                                                       ` Srinivasan S
  0 siblings, 1 reply; 23+ messages in thread
From: Srinivasan S @ 2015-07-08 15:25 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Dear Clemens,

Thanks a lot for your support Clemens

As you suggested, When I try to use alsa jack plugin, am facing the below error

root@lifeline:/# vi etc/asound.conf
pcm.rawjack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}
capture_ports {
0 system:capture_1
1 system:capture_2
}
}

pcm.jack {
type plug
slave { pcm "rawjack" }
hint {
description "JACK Audio Connection Kit"
}
}

pcm.!default {
type plug
slave { pcm "rawjack" }
}

root@lifeline:/opt/tunstall/audio# aplay -D pcm.jack TangoForTajMusic11.wav
ALSA lib /home/jenkins/amsdk-nightly-build/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1.0.27.2/src/dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_jack.so
aplay: main:722: audio open error: No such device or address
root@lifeline:/opt/tunstall/audio#


I feel order to resolve this error, 

1. I feel that there is no libasound_module_pcm_jack.so,  I have downloaded the alsa-plugins-1.0.29 could you please help me out how this can be cross compiled for my TI AM335x platform

2. Could you please let me know to cross compile &  install the package libasound2-dev 

Could you please help me out in resolving this issue

Kindly do the needful as early as possible

Many Thanks a lot for your support once again w.r.t this thread so far

________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Wednesday, July 1, 2015 7:41 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> Am facing overrun & underrun issues, when I run the the above GSM application with the attached asound.conf

The sound card and the GSM streams are not synchronized.
You need to compensate for the drift between the clocks, typically by resampling.
(Jack's alsa_in/alsa_out would automatically do this.)


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Fw: Using loopback card to Connect GSM two way call to the real sound card UDA1345TS
  2015-07-08 15:25                                                     ` Srinivasan S
@ 2015-07-09  5:25                                                       ` Srinivasan S
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivasan S @ 2015-07-09  5:25 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel, linux-audio-dev

Dear Clemens

Could you please kindly help me out to cross_compile this alsa_plugins, so that I can resolve the below error & & get jack plugins working as you suggested earlier

Many Thanks in advance
Srinivasan S
________________________________________
From: Srinivasan S
Sent: Wednesday, July 8, 2015 8:55 PM
To: Clemens Ladisch
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Dear Clemens,

Thanks a lot for your support Clemens

As you suggested, When I try to use alsa jack plugin, am facing the below error

root@lifeline:/# vi etc/asound.conf
pcm.rawjack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}
capture_ports {
0 system:capture_1
1 system:capture_2
}
}

pcm.jack {
type plug
slave { pcm "rawjack" }
hint {
description "JACK Audio Connection Kit"
}
}

pcm.!default {
type plug
slave { pcm "rawjack" }
}

root@lifeline:/opt/tunstall/audio# aplay -D pcm.jack TangoForTajMusic11.wav
ALSA lib /home/jenkins/amsdk-nightly-build/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1.0.27.2/src/dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_jack.so
aplay: main:722: audio open error: No such device or address
root@lifeline:/opt/tunstall/audio#


I feel order to resolve this error,

1. I feel that there is no libasound_module_pcm_jack.so,  I have downloaded the alsa-plugins-1.0.29 could you please help me out how this can be cross compiled for my TI AM335x platform

2. Could you please let me know to cross compile &  install the package libasound2-dev

Could you please help me out in resolving this issue

Kindly do the needful as early as possible

Many Thanks a lot for your support once again w.r.t this thread so far

________________________________________
From: Clemens Ladisch <clemens@ladisch.de>
Sent: Wednesday, July 1, 2015 7:41 PM
To: Srinivasan S
Cc: alsa-devel@alsa-project.org; linux-audio-dev@lists.linuxaudio.org
Subject: Re: [alsa-devel] Fw: Using loopback card to Connect GSM two way call   to the real sound card UDA1345TS

Srinivasan S wrote:
> Am facing overrun & underrun issues, when I run the the above GSM application with the attached asound.conf

The sound card and the GSM streams are not synchronized.
You need to compensate for the drift between the clocks, typically by resampling.
(Jack's alsa_in/alsa_out would automatically do this.)


Regards,
Clemens

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-07-09  5:25 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1425878251963.1340@tataelxsi.co.in>
2015-03-09  5:18 ` Using loopback card to Connect GSM two way call to the real sound card UDA1345TS Srinivasan S
2015-03-09  8:09   ` Clemens Ladisch
     [not found]     ` <1425922601141.50130@tataelxsi.co.in>
     [not found]       ` <1425964490006.15084@tataelxsi.co.in>
     [not found]         ` <1425964490006.15084-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
2015-03-10 10:50           ` [LAD] Fw: [alsa-devel] " Clemens Ladisch
2015-03-28  2:43             ` Fw: " Srinivasan S
2015-03-30 11:40               ` Fw: " Srinivasan S
2015-04-01  8:38                 ` Srinivasan S
     [not found]               ` <1427510661706.37789-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
2015-04-02  9:43                 ` [LAD] [alsa-devel] " Clemens Ladisch
2015-04-02 10:36                   ` Srinivasan S
2015-04-02 15:08                     ` Clemens Ladisch
2015-04-22  6:11                       ` Srinivasan S
2015-04-24  6:26                         ` Srinivasan S
2015-04-24  6:26                         ` Srinivasan S
     [not found]                         ` <1429683117651.11394-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
2015-04-24  8:06                           ` [LAD] [alsa-devel] " Clemens Ladisch
2015-04-24 12:05                             ` Srinivasan S
     [not found]                               ` <1429877130444.23317-Ig93jE4/MIihbFNETrL9Qw@public.gmane.org>
2015-04-24 12:45                                 ` [LAD] [alsa-devel] " Clemens Ladisch
2015-05-29 11:20                                   ` Srinivasan S
2015-06-01  6:01                                     ` Srinivasan S
     [not found]                                       ` <HKXPR04MB277B58064C140058C37487EC3B60-T1ls2vrYf5VLAZUorM51PQfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2015-06-01 14:39                                         ` [LAD] [alsa-devel] " Clemens Ladisch
2015-06-03  6:05                                           ` Srinivasan S
     [not found]                                             ` <SIXPR04MB2530654AB664B2CE19B4665C3A80@SIXPR04MB253.apcprd04.prod.outlook.com>
2015-07-01  7:34                                               ` Srinivasan S
     [not found]                                                 ` <SIXPR04MB2531DB716093D09C156BEA0C3A80-gTWnircbfuxAKSrPHYfF6gfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2015-07-01 14:11                                                   ` [LAD] [alsa-devel] " Clemens Ladisch
2015-07-08 15:25                                                     ` Srinivasan S
2015-07-09  5:25                                                       ` Srinivasan S

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.