问题
I am trying to change the rate of a sound file played through AVAudioPlayer. It works, but there are significant artifacts, especially when I slow down the rate. I'm happy that the rate change maintains the same pitch but it seems to have trouble, especially with sustained notes.
It seemed like the rate change was working pretty well until I tried it with higher quality sounds that had been equalized, compressed, and mastered. I'm concerned that the AVAudioPlayer rate change can't deal with the higher quality.
I'm using .wav files with a sample rate of 48kHz and 16 bits per sample.
I've also looked into ZTX Time Stretching and Pitch Shifting, formerly known as Dirac LE, but haven't been able to acquire a license for the software yet. However, I did try loading the files into iPhone apps that use the ZTX technology and it had similar issues.
Any help or suggestions would be appreciated!
回答1:
There are fewer data points per cycle at higher frequencies getting close to two per cycle at 20 khz. Slowing down the audio with the same pitch involves adding more data points and that can't be completely accurate because that information was not present in the original.
Further the process of changing the speed without altering the pitch is a complex operation. The more the sound is slowed the more artifacts that will be introduced. Note: You still have not stated what kind of slowing ration you are going for, 90%, 50%, 10%?
If the amount of slowing is extreme use a higher sampling frequency.
来源:https://stackoverflow.com/questions/31128172/avaudioplayer-rate-change-introduces-artifacts-distortion