[alsa-devel] Recording devices opened mono still sending stereo causing corrupt audio

Alan Horstmann gineera at aspect135.co.uk
Fri Oct 11 17:45:53 CEST 2013

On Friday 11 October 2013 13:33, Clemens Ladisch wrote:
> Sean M. Pappalardo - D.J. Pegasus wrote:
> > the problem occurs when PA is asked to open just one channel of
> > a sound input device yet the device seems to stream two anyway.
> Many devices do not support mono streams.
> > I'm suspecting there's a miscommunication between PA and ALSA
> The communication between ALSA and PA works just fine; ALSA reports the
> minimum number of channels, and PA saves this value.
> What does not work is the communication between PA and the application;
> PA has no mechanism to report the minimum number of channels.
> Even worse, if some application tries to use a channel count that is too
> low, PA cleverly replaces it with the minimum support channel count:
>   self->numHostChannels = PA_MAX( params->channelCount, StreamDirection_In
> == streamDir ? devInfo->minInputChannels
>           : devInfo->minOutputChannels );
> and then does not bother to tell anybody about this.
> This bug is especially egregious because PA does later check whether the
> number of channels is actually supported by the device; the code above
> ensures that this checks uses the wrong channel number.

Thanks for the comments, Clemens.  Do USB devices typically not support mono, 
or is it various, by specific unit?

I think the intention would be that in these cases Portaudio would do channel 
adaption between the stereo host stream and the mono stream passed to the 
user.  It may well be that the Alsa implementation is not doing that 

However, shouldn't the Alsa default device allow a mono stream to be opened on 
a stereo-only device?  I was hoping some additional test info would narrow 
down the area where the problem lies, before going too deep into the 
Portaudio code!



More information about the Alsa-devel mailing list