http://yarin.blog.51cto.com/1130898/640398
First download SoundTouch open Source Library, you can go to the official website to find, http://www.surina.net/soundtouch/.
Here are a few of the main adjustments we want to make to modify the audio file:
- msoundtouch.setsamplerate (samplerate); //Set the sampling frequency of the sound
- Msoundtouch.setchannels (Channels); //Set the sound channel
- M_soundtouch.settempochange (Tempodelta); //This is the legendary change of speed does not change the tone
- M_soundtouch.setpitchsemitones (Pitchdelta); //Set pitch of sound
- Msoundtouch.setratechange (Ratedelta); //Set the rate of sound
- //Quick is a bool variable, use_quickseek specific what to use I am not very clear for the time being.
- Msoundtouch.setsetting (Setting_use_quickseek, quick);
- //Noantialias is a bool variable, use_aa_filter specific what to use I'm not quite sure yet.
- Msoundtouch.setsetting (Setting_use_aa_filter,!) ( Noantialias));
The last two issues to note:
Has started my compilation, the sound is very strange also has the noise very big, still spent a lot of time to find the reason, but all did not have the result, suddenly remembered that we said, it also supports 32-bit floating point and 16-bit fixed point, by default, 32-bit floating point, I will change it to 16-bit fixed point number, haha Change the way you find the Float_samples macro in the STTypes.h file, comment it out, and open the Integer_samples macro, as follows:
- #if! (Integer_samples | | Float_samples)
- // Choose either 32bit floating point or 16bit integer sampletype
- /// by choosing one of the following defines, unless this selection
- //has already been do in some other file.
- ////
- //Notes:
- //-in Windows environment, choose the sample format with the
- /// following defines.
- //-in GNU environment, the floating point samples is used by
- /// default, but integer samples can is chosen by giving the
- //Following switch to the Configure script:
- /// ./configure--enable-integer-samples
- /// However, if you still prefer to select the sample format here
- // also in GNU environment, then #undef the Integer_sample
- ///Float_sample defines first as in comments above.
- #define Integer_samples 1//< 16bit INTEGER SAMPLES
- //#define Float_samples 1//< 32bit FLOAT SAMPLES
- #endif
Another problem is that the test on the simulator is completely correct, this time put on the real machine equipment, direct error, quit the program, another time spent me a lot of problems, and finally found that in the real machine needs to change the channel to Mono, as below, in their own settings when used:
- Msoundtouch.setchannels (2); //1 is mono
It's done, of course. If you want to continue to understand the SoundTouch library, then here (http://blog.csdn.net/leilu2008/article/details/6540575) a series of reference materials.