Is it possible to crop auido file?

Now i can record .wav file ,  and next step i want to crop some part of it . I try to find some class that would help but i still haven't found what i'm looking for .


some guide pls :D

Load file into buffer. Crop buffer. Write buffer to new file, or replace existing one....

aha but i dont know which operator that use for crop a buffer ...


sorry for my noob , but im so new with audio programming ...

There is no 'crop' operator. Just resize the buffer. 

i always load file like this ... and i dont know anything about how to use buffer ...

AudioFormatReader* reader = formatmager.createReaderFor (file);

readersource = new AudioFormatReaderSource (reader, true);

transportsource.setSource (readersource);

can u guide me more ? :D

This is not something I've done before but it seems to me that you should load the sound file into an AudioBufferSample. Once it's in the buffer you can manipulate it as you like. Then when it's done, you can write the buffer to disk. Others on the list might be able to suggest other ways to do it. Anyhow, it's all in the docs. You'll just have to do some digging :)





oh , i can do it now ! 

here is my code :D

                int size=320000;

                AudioSampleBuffer* buffer=new AudioSampleBuffer(1,size);


                reader->read(buffer, 0, 51200,0 ,false, false);

                ScopedPointer<WavAudioFormat> wavFormat =  new WavAudioFormat();

                File bufferfile = File("/Users/BukerBear/Documents/yourfile.wav");


                FileOutputStream* filestream = bufferfile.createOutputStream();

                AudioFormatWriter* writer =  wavFormat->createWriterFor(filestream , 44100, 1, 16,StringPairArray(), 0);

               if( writer->writeFromAudioSampleBuffer(*buffer, 35600, 51200))


                   delete writer;



ps .i decided to use juce for my university project ... Thank you Rory, you've helped me a lot!

Good luck with your project :)