Thread: [Alsa-user] playing / recording mono on a stereo-only hardware
Brought to you by:
perex
From: Guennadi L. <g.l...@gm...> - 2010-01-22 15:41:55
|
Hi I'm writing a driver for an embedded system (SuperH, first version of patches posted recently on alsa-devel), and the driver claims support for only 2 channels (channels_min = channels_max = 2). Is there a way to tell alsa-lib to duplicate the mono-channel during playback and to mix recorded channels, if mono recording is requested? Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Clemens L. <cl...@la...> - 2010-01-25 09:10:47
|
Guennadi Liakhovetski wrote: > Is there a way to tell alsa-lib to duplicate the mono-channel during > playback and to mix recorded channels, if mono recording is requested? Yes, with the "plug" plugin. It should be used automatically by the "default" and "plughw" devices. HTH Clemens |
From: Guennadi L. <g.l...@gm...> - 2010-01-25 09:34:43
|
On Mon, 25 Jan 2010, Clemens Ladisch wrote: > Guennadi Liakhovetski wrote: > > Is there a way to tell alsa-lib to duplicate the mono-channel during > > playback and to mix recorded channels, if mono recording is requested? > > Yes, with the "plug" plugin. It should be used automatically by the > "default" and "plughw" devices. Do I need any asoundrc for this or should this also happen without one? This "plug" plugin is built into the libasound? I was advised to use config like pcm.!default { type plug slave { pcm "hw:0,0" channels 2 } route_policy duplicate } but, unfortunately, it didn't help. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Giuliano P. <po...@sh...> - 2010-01-28 22:57:52
|
On Mon, 25 Jan 2010 10:34:41 +0100 (CET) Guennadi Liakhovetski <g.l...@gm...> wrote: > On Mon, 25 Jan 2010, Clemens Ladisch wrote: > > > Guennadi Liakhovetski wrote: > > > Is there a way to tell alsa-lib to duplicate the mono-channel during > > > playback and to mix recorded channels, if mono recording is requested? > > > > Yes, with the "plug" plugin. It should be used automatically by the > > "default" and "plughw" devices. > > Do I need any asoundrc for this or should this also happen without one? > This "plug" plugin is built into the libasound? I was advised to use > config like > > pcm.!default { > type plug > slave { > pcm "hw:0,0" > channels 2 > } > route_policy duplicate > } > > but, unfortunately, it didn't help. Try something simpler: arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav It prints the given parameters and, if the format is not supported by the card, it also prints the choosen settings. In that case audio data is transparently converted to the format you requested. You shouldn't have to specify plughw: because it's the default. -- Giuliano. |
From: Guennadi L. <g.l...@gm...> - 2010-01-29 10:44:45
|
On Thu, 28 Jan 2010, Giuliano Pochini wrote: > On Mon, 25 Jan 2010 10:34:41 +0100 (CET) > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > On Mon, 25 Jan 2010, Clemens Ladisch wrote: > > > > > Guennadi Liakhovetski wrote: > > > > Is there a way to tell alsa-lib to duplicate the mono-channel during > > > > playback and to mix recorded channels, if mono recording is requested? > > > > > > Yes, with the "plug" plugin. It should be used automatically by the > > > "default" and "plughw" devices. > > > > Do I need any asoundrc for this or should this also happen without one? > > This "plug" plugin is built into the libasound? I was advised to use > > config like > > > > pcm.!default { > > type plug > > slave { > > pcm "hw:0,0" > > channels 2 > > } > > route_policy duplicate > > } > > > > but, unfortunately, it didn't help. > > Try something simpler: > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > It prints the given parameters and, if the format is not supported by the > card, it also prints the choosen settings. In that case audio data is > transparently converted to the format you requested. > You shouldn't have to specify plughw: because it's the default. Unfortunately, didn't work: $ arecord -c1 -r44100 -fS16_LE -v -d 8 /tmp/rec.wav Recording WAVE '/tmp/rec.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono arecord: set_params:1053: Unable to install hw params: ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 16 CHANNELS: 1 RATE: 44100 PERIOD_TIME: (46439 46440) PERIOD_SIZE: 2048 PERIOD_BYTES: 4096 PERIODS: 11 BUFFER_TIME: (510839 510840) BUFFER_SIZE: 22528 BUFFER_BYTES: 45056 TICK_TIME: 0 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Giuliano P. <po...@sh...> - 2010-01-30 15:59:48
|
On Fri, 29 Jan 2010 11:44:43 +0100 (CET) Guennadi Liakhovetski <g.l...@gm...> wrote: > > Try something simpler: > > > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > > > It prints the given parameters and, if the format is not supported by the > > card, it also prints the choosen settings. In that case audio data is > > transparently converted to the format you requested. > > You shouldn't have to specify plughw: because it's the default. > > Unfortunately, didn't work: Did you try with "-Dplughw:0" ? -- Giuliano. |
From: Guennadi L. <g.l...@gm...> - 2010-01-30 15:59:44
|
On Sat, 30 Jan 2010, Giuliano Pochini wrote: > On Fri, 29 Jan 2010 11:44:43 +0100 (CET) > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > Try something simpler: > > > > > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > > > > > It prints the given parameters and, if the format is not supported by the > > > card, it also prints the choosen settings. In that case audio data is > > > transparently converted to the format you requested. > > > You shouldn't have to specify plughw: because it's the default. > > > > Unfortunately, didn't work: > > Did you try with "-Dplughw:0" ? Yes, I did, doesn't help. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Giuliano P. <po...@sh...> - 2010-01-30 16:14:44
|
On Sat, 30 Jan 2010 16:59:48 +0100 (CET) Guennadi Liakhovetski <g.l...@gm...> wrote: > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > > > On Fri, 29 Jan 2010 11:44:43 +0100 (CET) > > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > > > Try something simpler: > > > > > > > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > > > > > > > It prints the given parameters and, if the format is not supported by the > > > > card, it also prints the choosen settings. In that case audio data is > > > > transparently converted to the format you requested. > > > > You shouldn't have to specify plughw: because it's the default. > > > > > > Unfortunately, didn't work: > > > > Did you try with "-Dplughw:0" ? > > Yes, I did, doesn't help. Does the driver uses rules to set hw params constraints ? If so, there may be an error there. If -for example- rule_format_given_channels() and rule_channels_given_format() are not perfectly symmetrical then the plughw plugin does not work. -- Giuliano. |
From: Guennadi L. <g.l...@gm...> - 2010-01-30 16:41:33
|
On Sat, 30 Jan 2010, Giuliano Pochini wrote: > On Sat, 30 Jan 2010 16:59:48 +0100 (CET) > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > > > > > On Fri, 29 Jan 2010 11:44:43 +0100 (CET) > > > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > > > > > Try something simpler: > > > > > > > > > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > > > > > > > > > It prints the given parameters and, if the format is not supported by the > > > > > card, it also prints the choosen settings. In that case audio data is > > > > > transparently converted to the format you requested. > > > > > You shouldn't have to specify plughw: because it's the default. > > > > > > > > Unfortunately, didn't work: > > > > > > Did you try with "-Dplughw:0" ? > > > > Yes, I did, doesn't help. > > Does the driver uses rules to set hw params constraints ? If so, there may > be an error there. If -for example- rule_format_given_channels() and > rule_channels_given_format() are not perfectly symmetrical then the plughw > plugin does not work. This is an ASoC driver (sound/soc), here's the code: http://mailman.alsa-project.org/pipermail/alsa-devel/2010-January/024701.html it is also already in the for-2.6.34 branch of this git tree: http://git.kernel.org/?p=linux/kernel/git/broonie/sound-2.6.git;a=summary BTW, I do not find any hits for rule_channels_given_format or rule_format_given_channels - not even on Google, what did you mean? Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Giuliano P. <po...@sh...> - 2010-01-30 21:55:45
|
On Sat, 30 Jan 2010 17:41:30 +0100 (CET) Guennadi Liakhovetski <g.l...@gm...> wrote: > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > > > On Sat, 30 Jan 2010 16:59:48 +0100 (CET) > > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > > > > > > > On Fri, 29 Jan 2010 11:44:43 +0100 (CET) > > > > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > > > > > > > Try something simpler: > > > > > > > > > > > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > > > > > > > > > > > It prints the given parameters and, if the format is not supported by the > > > > > > card, it also prints the choosen settings. In that case audio data is > > > > > > transparently converted to the format you requested. > > > > > > You shouldn't have to specify plughw: because it's the default. > > > > > > > > > > Unfortunately, didn't work: > > > > > > > > Did you try with "-Dplughw:0" ? > > > > > > Yes, I did, doesn't help. > > > > Does the driver uses rules to set hw params constraints ? If so, there may > > be an error there. If -for example- rule_format_given_channels() and > > rule_channels_given_format() are not perfectly symmetrical then the plughw > > plugin does not work. > > This is an ASoC driver (sound/soc), here's the code: > > http://mailman.alsa-project.org/pipermail/alsa-devel/2010-January/024701.html > > it is also already in the for-2.6.34 branch of this git tree: > > http://git.kernel.org/?p=linux/kernel/git/broonie/sound-2.6.git;a=summary > > BTW, I do not find any hits for rule_channels_given_format or > rule_format_given_channels - not even on Google, what did you mean? No, it was just an example in case sample format and number of channels are not independent. The function to add a rule is snd_pcm_hw_rule_add(). I guess your driver do not use that feature. I'm out of ideas on that plughw: issue at the moment. I suggest you to write on the alsa-devel mailing list. -- Giuliano. |
From: Jaroslav K. <pe...@pe...> - 2010-01-30 19:09:03
|
On Sat, 30 Jan 2010, Guennadi Liakhovetski wrote: > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > >> On Sat, 30 Jan 2010 16:59:48 +0100 (CET) >> Guennadi Liakhovetski <g.l...@gm...> wrote: >> >>> On Sat, 30 Jan 2010, Giuliano Pochini wrote: >>> >>>> On Fri, 29 Jan 2010 11:44:43 +0100 (CET) >>>> Guennadi Liakhovetski <g.l...@gm...> wrote: >>>> >>>>>> Try something simpler: >>>>>> >>>>>> arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav >>>>>> >>>>>> It prints the given parameters and, if the format is not supported by the >>>>>> card, it also prints the choosen settings. In that case audio data is >>>>>> transparently converted to the format you requested. >>>>>> You shouldn't have to specify plughw: because it's the default. >>>>> >>>>> Unfortunately, didn't work: >>>> >>>> Did you try with "-Dplughw:0" ? >>> >>> Yes, I did, doesn't help. >> >> Does the driver uses rules to set hw params constraints ? If so, there may >> be an error there. If -for example- rule_format_given_channels() and >> rule_channels_given_format() are not perfectly symmetrical then the plughw >> plugin does not work. > > This is an ASoC driver (sound/soc), here's the code: I don't see any issues here. Post 'aplay -v -Dplughw:0' log. Jaroslav ----- Jaroslav Kysela <pe...@pe...> Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. |
From: Guennadi L. <g.l...@gm...> - 2010-01-30 19:46:14
|
On Sat, 30 Jan 2010, Jaroslav Kysela wrote: > On Sat, 30 Jan 2010, Guennadi Liakhovetski wrote: > > > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > > > > > On Sat, 30 Jan 2010 16:59:48 +0100 (CET) > > > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > > > > On Sat, 30 Jan 2010, Giuliano Pochini wrote: > > > > > > > > > On Fri, 29 Jan 2010 11:44:43 +0100 (CET) > > > > > Guennadi Liakhovetski <g.l...@gm...> wrote: > > > > > > > > > > > > Try something simpler: > > > > > > > > > > > > > > arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav > > > > > > > > > > > > > > It prints the given parameters and, if the format is not supported > > > > > > > by the > > > > > > > card, it also prints the choosen settings. In that case audio data > > > > > > > is > > > > > > > transparently converted to the format you requested. > > > > > > > You shouldn't have to specify plughw: because it's the default. > > > > > > > > > > > > Unfortunately, didn't work: > > > > > > > > > > Did you try with "-Dplughw:0" ? > > > > > > > > Yes, I did, doesn't help. > > > > > > Does the driver uses rules to set hw params constraints ? If so, there > > > may > > > be an error there. If -for example- rule_format_given_channels() and > > > rule_channels_given_format() are not perfectly symmetrical then the plughw > > > plugin does not work. > > > > This is an ASoC driver (sound/soc), here's the code: > > I don't see any issues here. Post 'aplay -v -Dplughw:0' log. I presume, with a mono wav file. Without any .asoundrs or /etc/asound.conf: aplay -v -Dplughw:0 /home/lyakh/c1.wav Playing WAVE '/home/lyakh/c1.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono aplay: set_params:1053: Unable to install hw params: ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 16 CHANNELS: 1 RATE: 8000 PERIOD_TIME: 125000 PERIOD_SIZE: 1000 PERIOD_BYTES: 2000 PERIODS: 4 BUFFER_TIME: 500000 BUFFER_SIZE: 4000 BUFFER_BYTES: 8000 TICK_TIME: 0 It shouldn't matter, but alsa is installed under /usr/local/... and I'm starting all alsa utilities as LD_LIBRARY_PATH=/usr/local/lib/ aplay... and it works with stereo, but not with mono. But just in case that plug-in magic does something funny with the environment, there could be a problem with that... Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Bill U. <un...@ph...> - 2010-01-30 20:20:47
|
> It shouldn't matter, but alsa is installed under /usr/local/... and I'm > starting all alsa utilities as > > LD_LIBRARY_PATH=/usr/local/lib/ aplay... Just put /usr/local/bin into /etc/ld.so.conf and run ldconfig It probably will not solve your problem but make it unneccessary to type LD_LIBRARY_PATH=/usr/local/lib/ every time. > |
From: Guennadi L. <g.l...@gm...> - 2010-01-30 20:24:09
|
On Sat, 30 Jan 2010, Bill Unruh wrote: > > It shouldn't matter, but alsa is installed under /usr/local/... and I'm > > starting all alsa utilities as > > > > LD_LIBRARY_PATH=/usr/local/lib/ aplay... > > Just put > /usr/local/bin > into /etc/ld.so.conf > and run ldconfig > > It probably will not solve your problem but make it unneccessary to type > LD_LIBRARY_PATH=/usr/local/lib/ > every time. You meant /usr/local/lib, but this doesn't work on that distro - something has been optimised away in that busybox. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Jaroslav K. <pe...@pe...> - 2010-01-30 22:02:04
|
On Sat, 30 Jan 2010, Guennadi Liakhovetski wrote: > On Sat, 30 Jan 2010, Jaroslav Kysela wrote: > >> On Sat, 30 Jan 2010, Guennadi Liakhovetski wrote: >> >>> On Sat, 30 Jan 2010, Giuliano Pochini wrote: >>> >>>> On Sat, 30 Jan 2010 16:59:48 +0100 (CET) >>>> Guennadi Liakhovetski <g.l...@gm...> wrote: >>>> >>>>> On Sat, 30 Jan 2010, Giuliano Pochini wrote: >>>>> >>>>>> On Fri, 29 Jan 2010 11:44:43 +0100 (CET) >>>>>> Guennadi Liakhovetski <g.l...@gm...> wrote: >>>>>> >>>>>>>> Try something simpler: >>>>>>>> >>>>>>>> arecord -v -Dplughw:0 -c1 -r44100 -fS16_LE out.wav >>>>>>>> >>>>>>>> It prints the given parameters and, if the format is not supported >>>>>>>> by the >>>>>>>> card, it also prints the choosen settings. In that case audio data >>>>>>>> is >>>>>>>> transparently converted to the format you requested. >>>>>>>> You shouldn't have to specify plughw: because it's the default. >>>>>>> >>>>>>> Unfortunately, didn't work: >>>>>> >>>>>> Did you try with "-Dplughw:0" ? >>>>> >>>>> Yes, I did, doesn't help. >>>> >>>> Does the driver uses rules to set hw params constraints ? If so, there >>>> may >>>> be an error there. If -for example- rule_format_given_channels() and >>>> rule_channels_given_format() are not perfectly symmetrical then the plughw >>>> plugin does not work. >>> >>> This is an ASoC driver (sound/soc), here's the code: >> >> I don't see any issues here. Post 'aplay -v -Dplughw:0' log. > > I presume, with a mono wav file. Without any .asoundrs or > /etc/asound.conf: > > aplay -v -Dplughw:0 /home/lyakh/c1.wav > Playing WAVE '/home/lyakh/c1.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono Could you also try this sequence? # export LIBASOUND_COMPAT=1 # aplay -v -Dplughw:0 /home/lyakh/c1.wav ----- Jaroslav Kysela <pe...@pe...> Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. |
From: Guennadi L. <g.l...@gm...> - 2010-01-30 22:45:51
|
On Sat, 30 Jan 2010, Jaroslav Kysela wrote: > Could you also try this sequence? > > # export LIBASOUND_COMPAT=1 > # aplay -v -Dplughw:0 /home/lyakh/c1.wav Same: -bash-3.00# export LIBASOUND_COMPAT=1 -bash-3.00# aplay -v -Dplughw:0 /home/lyakh/c1.wav Playing WAVE '/home/lyakh/c1.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono aplay: set_params:1053: Unable to install hw params: ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 16 CHANNELS: 1 RATE: 8000 PERIOD_TIME: 125000 PERIOD_SIZE: 1000 PERIOD_BYTES: 2000 PERIODS: 4 BUFFER_TIME: 500000 BUFFER_SIZE: 4000 BUFFER_BYTES: 8000 TICK_TIME: 0 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |
From: Jaroslav K. <pe...@pe...> - 2010-01-31 08:53:00
|
On Sat, 30 Jan 2010, Guennadi Liakhovetski wrote: > On Sat, 30 Jan 2010, Jaroslav Kysela wrote: > >> Could you also try this sequence? >> >> # export LIBASOUND_COMPAT=1 >> # aplay -v -Dplughw:0 /home/lyakh/c1.wav > > Same: Ok. The next try might be to enable the CHOOSE_DEBUG debug output in alsa-lib/src/pcm/pcm_params.c . Please, put this output to http://pastebin.ca . Thanks, Jaroslav ----- Jaroslav Kysela <pe...@pe...> Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc. |
From: Guennadi L. <g.l...@gm...> - 2010-01-31 18:14:04
|
On Sun, 31 Jan 2010, Jaroslav Kysela wrote: > On Sat, 30 Jan 2010, Guennadi Liakhovetski wrote: > > > On Sat, 30 Jan 2010, Jaroslav Kysela wrote: > > > > > Could you also try this sequence? > > > > > > # export LIBASOUND_COMPAT=1 > > > # aplay -v -Dplughw:0 /home/lyakh/c1.wav > > > > Same: > > Ok. The next try might be to enable the CHOOSE_DEBUG debug output in > alsa-lib/src/pcm/pcm_params.c . Please, put this output to http://pastebin.ca > . Not sure why you prefer a pastebin for that < 1K log, instead of just inlining or attaching it, but here goes: http://pastebin.ca/1773284 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ |