I’ve been trying to put together a multichannel audio file recorder, primarily for recording 3rd and 5th order ambisonics in 16 and 36 channel formats. The WAV writer doesn’t support those channel counts and CAF is not implemented. Google are supporting ambix/caf for their spatial audio platforms - would be great to be able to work with these files in JUCE!
Looks like the WAV-writer used to work for up to 32 channels before the recent changes. (Higher channel counts like 36 still produce the output file but the highest channels seem to be silent. That could however be due to my test code.)
@Xenakios What exactly doesn’t work anymore with the wav-writer? I’ve just tried the following code which opens a 7.1 surround file and exports it again. Seems to work fine for me:
int main (int argc, char* argv[])
{
AudioFormatManager fm;
fm.registerBasicFormats();
File surround71 ("Surround7.1.wav");
ScopedPointer<AudioFormatReader> reader (fm.createReaderFor (surround71.createInputStream()));
if (reader != nullptr)
{
File testWav ("test.wav");
if (testWav.existsAsFile())
testWav.deleteFile();
jassert (! testWav.existsAsFile());
ScopedPointer<AudioFormatWriter> writer (fm.findFormatForFileExtension ("wav")->createWriterFor (testWav.createOutputStream(),
reader->sampleRate,
reader->getChannelLayout(),
reader->bitsPerSample,
{}, 0));
if (writer != nullptr)
writer->writeFromAudioReader (*reader, 0, reader->lengthInSamples);
}
return 0;
}
@fabian as far as I know it should be possible to record 16 or 32, 36 channels etc. to wav. i.e. not one of the “wave format extensible” surroundsound formats. reaper certainly can
Agreed, you should be able to create a file of any arbitrary number of channels.
Rail
It (createWriterFor) doesn’t seem to work with any number of channels given via AudioChannelSet::discreteChannels(int). If I use the old signature which takes the number of channels as an integer, it works only up to 8 channels now. (Used to work for at least 32 channels with older Juce.) My use case doesn’t care about specific surround layouts, I just want to write a file with an arbitrary channel count. (Although a bit of a fringe use case, I may have to deal with files up to thousands of channels…
)
I’m looking at exporting a wav file for “standard” 7.1 and NOT 7.1 SDDS.
It look likes like the WavAudioFormat does not support the AudioChannelSet::create7point1. Looking at WavAudioFormat::isChannelLayoutSupported it range checks the channel types to be between AudioChannelSet::left and AudioChannelSet::topRearRight. The 7.1 channel set contains leftSurroundRear and rightSurroundRear which are out of that range.
Is there a fundamental issue with "fmt " extension that prevents using those channel ranges?
Is there a trick to write a properly formatted 7.1 wav file with the extended format?
Should the WavAudioFormat be extended to support 7.1 and other formats?
