Wav file manipulation


#1

Hi,

I’m looking for a bit of help with wav file manipulation. I think what I need is a reccomendation as to which classes and methods JUCE has that can help me out.

what I want to do is open a wav file (say a drum loop) segment it into the given drum hits write the segmented drums back to individual files and also pass the audio data into another object which will possibly perform some kind of analysis. lets assume that I have the sample numbers of where I wish to segment the loop

I can open the file fine and create an inputstream from it. its easy to play the file by passing an audioStream to the audio device (as shown in the juce demo)

it also seems that I can open the file and read bytes directly from it using the inputstream.
EDIT: - I think what I actually want to do is read the samples from the file as an array of ints (ints are 16bit I think)
however the WAV file has headers which I do not know the size of. I think I basically want to be able to access the audio stream but read the data up to a point (calculated from my sample number) and at this point save it as another file and pass this data to my analysis object.

I have read the documentation and will continue to but any pointers as to where I should be looking are much appreciated…


#2

See:

WavFileFormat::createReaderFor
WavFileFormat::createWriterFor


#3

that looks like what I need… thanks Jules

oh btw its WavAudioFormat but I got found it once I new what kind of thing I was looking for