Patch: multi-channel audio files and floating-pt audio I/O

Hello all,

Here’s a patch to the audio file I/O classes to add support for:

  1. Many (> 2) channel audio files


  1. audio I/O to/from floating-point sample buffers.

There are typedefs in juce_AudioFormatReader.h for the following,

// These are taken from CSL - STP changes
typedef float sample; ///< short-hand for the base sample type (could be changed to double)
typedef sample* SampleBuffer; ///< 1-channel buffer data type – vector of (sample)
typedef SampleBuffer* SampleBufferArray; ///< Multi-channel buffer data type – vector of (sample *)

The new I/O calls in the audio format read/write objects look like,

bool readSamples (SampleBufferArray destSamples,
int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples);


bool write (SampleBufferArray data, int numSamples);

I include support for AIFF and WAV files as well as the CD and QT read/write objects.

I’ve tested it a bit in a few apps (like a sampler that reads 10-channel drum samples).

The files are at, (just the diffs)

and (the changed audio io files)

The diffs are relative to a month-old SVN check-out of JUCE.

Comments are invited… :wink:

Stephen Pope

I just up-loaded new versions of these files to after locating a squashing a minor bug.


Hi all,

I updated the files with the diffs relative to the 1.50 release.