Lowering MP3 Pitch with ActionScript 3
I found this example of raising the 开发者_如何转开发pitch of an MP3 using ActionScript 3. How would I go about lowering the pitch instead of raising it?
You write the same samples more than once to the output buffer.
function downOctave(bytes:ByteArray):ByteArray
{
var returnBytes:ByteArray = new ByteArray();
bytes.position = 0;
while(bytes.bytesAvailable > 0)
{
returnBytes.writeFloat(bytes.readFloat());
returnBytes.writeFloat(bytes.readFloat());
bytes.position -= 8;
returnBytes.writeFloat(bytes.readFloat());
returnBytes.writeFloat(bytes.readFloat());
}
return returnBytes;
}
This pitch-shifting is very simple and fast and suitable for real-time use in flash, but it does change the speed at which the sound is being played. For pitch-shifting that does not change duration you need to use fourier transfom based approach. Like this guy did here.
精彩评论