From: Ross Bencina <rossb-lists@audiomulch.com>
To: Portaudio Mailing List <portaudio@music.columbia.edu>
Cc: mixxx-devel <mixxx-devel@lists.sourceforge.net>,
alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [alsa-devel] Recording devices opened mono still sending stereo causing corrupt audio
Date: Sat, 12 Oct 2013 12:05:04 +1100 [thread overview]
Message-ID: <5258A040.8050708@audiomulch.com> (raw)
In-Reply-To: <5257F01D.3040908@ladisch.de>
On 11/10/2013 11:33 PM, 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.
Since PortAudio is designed to provide useful features to the client, it
does not make sense to restrict the client from opening a stereo device
as mono.
This is by design.
However obviously there is an implementation issue in PA/ALSA if it does
not respect ALSA's interface requiring support for a minimum number of
channels > 1.
In this case PortAudio should either select the first (left) channel or
downmix to mono before passing to the client. I'd suggest the former.
(or in general min(userRequestedChannelCount,availableChannelCount)
> 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.
The implementation should be dropping the second channel. So it should
be telling the PA buffer processor to do so.
> 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 your input,
Ross.
>
> Regards,
> Clemens
next prev parent reply other threads:[~2013-10-12 1:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 1:40 Recording devices opened mono still sending stereo causing corrupt audio Sean M. Pappalardo - D.J. Pegasus
2013-10-11 12:33 ` Clemens Ladisch
2013-10-11 15:45 ` Alan Horstmann
2013-10-11 17:04 ` Clemens Ladisch
2013-10-12 1:05 ` Ross Bencina [this message]
2013-10-12 1:20 ` [Portaudio] " RJ Ryan
2013-10-11 13:07 ` Alan Horstmann
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=5258A040.8050708@audiomulch.com \
--to=rossb-lists@audiomulch.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=mixxx-devel@lists.sourceforge.net \
--cc=portaudio@music.columbia.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.