I'm writing to you in despair, it's been 5 days I've tried a lot of
things, none is working.
My soundcard cannot handle recording on just one channel (it's a USB
card). I'm running ubuntu Hardy 8.04 with kernel 2.6.24.rt .
The problem is that the program I'm running is written to be use with
mono audio stream, and I don't want to enter the code too far. I have
access to the part of code that implement alsa functions.
I was thinking that I can convert the stereo stream into mono stream
by using the .asoundrc file and by declaring plug or plughw, but I
can't get it to work, I have various error like :
ALSA lib pcm.c:6569:(snd_pcm_slave_conf) Invalid slave definition
arecord: main:546: audio open error: Invalid argument
Here is the .asoundrc :
Can anyone explain me how to write a proper plu or plughw that will
do the trick?
Thanks so much in advance!
From: James Shatto <S<hadow_7@ea...> - 2008-08-28 19:48:36
On Thu, 28 Aug 2008 17:03:44 +0200
brunal <brunal2496@...> wrote:
> I have to precise that I'm using a M-Audio fatst track pro sound
> card, which works fine if I only record stereo files.
Is there some reason the application doesn't do mono? Almost all I've seen allow you to record only one track. Even on my MCP61, or my Mobile Pre. Which are stereo devices. You could look at audacity to see how it does it. Although it might be difficult to find being a multiplatform application. Ardour lets you do it, but it's using jack.
At a minimum you should be able to split the track out after the fact.
$ sox -c 2 stereo.wav -c 1 mono.wav avg -l
Maybe not useful for you if you need to do realtime continous recording. Or something like voice recognition. But arecord allows mono recording from a stereo device. Perhaps look at it's source for an example. My Korg MR-1000 is a stereo device that only records in stereo. But it's a stereo field recorder, that afaik doesn't run linux.
> Is there some reason the application doesn't do mono? Almost all
> I've seen allow you to record only one track. Even on my MCP61, or
> my Mobile Pre. Which are stereo devices. You could look at
> audacity to see how it does it.
Yes you're right, audacity can record only one channel with the alsa
The things is that when I call
(err = snd_pcm_hw_params_set_channels(handle, hwparams, 1))
, the answer is err= 0, meaning it cannot set channels number to 1.
And if I let it set channels number to 2, my application complains.
> At a minimum you should be able to split the track out after the fact.
> $ sox -c 2 stereo.wav -c 1 mono.wav avg -l
No, as you say it's not usefull because I'm doing voice recognition
in real time...
> Maybe not useful for you if you need to do realtime continous
> recording. Or something like voice recognition. But arecord
> allows mono recording from a stereo device.
Here is what I get when running arecord to record a mono file :
bruno@...:~$ arecord -D default -r 48000 -c 1 -f S16_LE truc.wav
Recording WAVE 'truc.wav' : Signed 16 bit Little Endian, Rate 48000
arecord: set_params:906: Channels count non available
So nobody can give me an answer about how to do it with a .asoundrc
Or is there something that I can do in the implementation of the alsa