[Portaudio] Choose channels

Ross Bencina rossb-lists at audiomulch.com
Thu Apr 19 23:20:26 EDT 2012

HI Matthieu,

On 20/04/2012 3:18 AM, Matthieu Lechowski wrote:
> Hello,
> I'm a new user of PortAudio.
> I chose PortAudio for its ability (as far I know) to manage multiple
> devices and channels.
> Indeed I have to setup a 4+1 audio system (4 monitors + 1 subwoofer)
> with a Motu 828 mk3 Firewire (or other soundcard, if you can advise me).
> I can use either 1 .wav mono by channel (so 5 .wav mono), or a 4
> channels wav + 1 mono wav, or 2 stereo + 1 mono, directly a 5 channels
> .wav, whatever, it's really free.
> I looked at this very helpful thread :
> http://music.columbia.edu/pipermail/portaudio/2012-February/013369.html
> (and followed the link http://pastebin.com/fePTpUi5)
> and doing the same thing, I am now able to read a .wav mono, using MME.
> Here are my questions :
> - with MME, channelMask seems to be ignored.

In that example, there is an asio-specific channel mask being used. You 
really shouldn't pass an asio-specific structure when opening an MME stream.

> I wanted to test to send my
> mono in one of the 8 output channels of the MOTU (ex:
> myStreamInfo.channelMask = PAWIN_SPEAKER_FRONT_RIGHT;), but it is sent
> in all channels.

I think it depends on your drivers and how you windows surround sound 
settings are set as to whether that will work with MME.

The best thing would be to open a multichannel stream and send silence 
to the channels you're not using (ie write zeros to those buffers).

> - with MME, stereo files fail : my sound is full of cracking noise, and
> the speed is divided by 2. I set channelCount to 2 (if I set to 1, no
> cracking noise, but the speed is divided by 2, which I understand). So I
> didn't even try wave files with more than 2 channels...

If the speed is divided by 2 it sounds like you're sending both left and 
right channel samples from your file out to one channel of the audio 
output. You need to select on the the left or right channel from your 
file (skip alternate samples).

> - with ASIO (I successfully compiled with ASIO support), I have no sound
> (I see I have signal on the frontboard of the motu, I have lights in the
> "Main" column). I am not aware about ASIO, should I have to do some
> routing or something like that ?

If the signal is visible on your motu maybe it's coming out a different 
channel than you expect, or you need to turn the master volume up on the 
motu. Check the manual :)

> - which host API would fit better to my needs (ASIO, MME, WASAPI, DS,
> WDM) ? Knowing that I can tell the MOTU (in the MOTU Audio Console) to
> group all the 8 output channels as one device, or divide them in 4 pairs.

I don't have the big picture of what your use-case is. But if it were 
me, and MOTU was the only target device, I'd use ASIO.

Further, I'd probably start by not using the channel mask at all and 
sending silence to the unused channels.

> Could you help me a little, please ?
> Tell me if I do not gave you enough information.

Does that help?


> Thank you,
> Matthieu
> _______________________________________________
> Portaudio mailing list
> Portaudio at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/portaudio

More information about the Portaudio mailing list