WavAudioFormat with more than 2 channels?


#1

It seems if I try to use WavAudioFormat::createWriterFor() that I am limited to a maximum of two channels.

https://docs.juce.com/master/classWavAudioFormat.html#details tells us…

the number of channels - this must be either 1 or 2, and the choice will depend on the results of canDoMono() and canDoStereo()

Question: Is there some other pre-built JUCE class that writes multi-channel audio data to a single file? Or must I create a custom binary file writer to hold such data?


#2

The documentation you reading must have some error. The WavAudioFormat supports more channels. (But annoyingly, I think there is still some limit like maximum of 32 channels in the JUCE code.)


#3

Good to know. You just saved me some unnecessary labor. Much appreciated!


#4

If you proceed to the next variant of WavAudioFormat::createWriterFor(), it accepts any arbitrary AudioChannelSet
AudioChannelSet::discreteChannels (num) is used to create an untyped multichannel set


#5

@daniel : Aha! That’s exactly the sort of thing I was hoping to find. Thank you!