alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Srinivasan S <srinivasan.s@tataelxsi.co.in>
To: "clemens@ladisch.de" <clemens@ladisch.de>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-audio-dev@lists.linuxaudio.org"
	<linux-audio-dev@lists.linuxaudio.org>
Subject: Fw: Fw: Using loopback card to Connect GSM two way call	to the real sound card UDA1345TS
Date: Mon, 30 Mar 2015 11:40:31 +0000	[thread overview]
Message-ID: <1427715629620.42885@tataelxsi.co.in> (raw)
In-Reply-To: <1427510661706.37789@tataelxsi.co.in>

[-- 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 --]



  reply	other threads:[~2015-03-30 11:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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               ` Srinivasan S [this message]
2015-04-01  8:38                 ` Fw: " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427715629620.42885@tataelxsi.co.in \
    --to=srinivasan.s@tataelxsi.co.in \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=linux-audio-dev@lists.linuxaudio.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).