Re: Mono capture conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> -----Original Message-----
> From: Paixao Julien [mailto:J.Paixao@xxxxxxxxxxx]
> Sent: Wednesday, March 25, 2015 5:15 PM
> To: alsa-user@xxxxxxxxxxxxxxxxxxxxx
> Subject:  Mono capture conversion
> 
> Hi,
> 
> I have an embedded device running linux 3.10.16 with alsa-lib 1.0.24.1.
> Regarding the audio part, I have:
> - Mono audio input : single microphone
> - Mono audio output : single speaker
> - Audio codec mc13783
> - I2S link between the audio codec and the CPU.
> 
> My system does not define any specific .asoundrc file, only the
> /etc/asound.state file is specific, this file adjust the mixer elements of the
> mc13783 audio codec.
> 
> When I record the audio input using arecord -c 2 option, everything is fine.
> I get a file with the right and left channels and only the right channel contains
> data.
> Indeed it's a mono audio input and the audio codec only transfer audio data
> on the I2S right slot.
> 
> When I record the audio input using arecord -c 1 option, the behavior is not
> the one I would like to have ;) I get a file with only one channel which is fine
> but the amplitude is divided by two.
> 
> Using the -v option I could figure out that in the second case the following
> transformation happens:
> #  Transformation table:
> #   0 <- 0*0.5 + 1*0.5
> 
> This explains why the amplitude is divided by two.
> 
> Would you know a way to avoid this conversion? I would like to have no
> conversion so 0 <- 0.
> 

The wanted behavior is in fact to have 0 <- 1 in the case the -c 1 option is used when recording or playback.

To achieve the wanted behavior, I overwrote the default device where I have added explicitly a transformation table of the plug plugin:
ttable {
0.1= 16
}

I had to put 16 instead of 1 because my alsa-lib is built in fixed point.

Is it the cleanest way to get the wanted behavior?

What is annoying is that now even when I use the -c 2 option, the conversion also happens while it's in fact not needed.
I know a way to avoid that is to create two different devices and use the correct one regarding the number of channels used for recording or playback.
But this is also quite annoying , I would like that the selection is automated in some way, any ideas?

Best regards,
Paixao Julien

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user




[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux