AudioFormatReader read as float (-1.0:1.0)



I'm having a bit of trouble casting the to an array of floats instad of an array of ints.

I want to read a single channel from an audio file into an array of floats, with the range -1.0 to 1.0. (I'm avoiding AudioSampleBuffer for a reason), but can't figure out how to do the the cast to float** as it says in the docs...

I can read them as ints fine but can't figure out how to cast to float....

    // Create buffer and read data
    int * samples;
    reader->read(&samples, 1, numOfSamples, 0, false);

Can anyone point me in the right direction please?


Have a look at the AudioDataConverters class, or FloatVectorOperations::convertFixedToFloat. If you grep the codebase you should find places where those things are used.