When decoding the audio data of an mp3 file I fetched, rendering it with my OfflineContext
, and exporting it back to a .wav file, the sound is in slo-mo with a different pitch. Is it because the sample rates of my mp3 file and OfflineContext
are different? If it is, how can I export the mp3 file in a different sample rate while not changing the pitch?
Edit:
I run decodeAudioData
with the OfflineAudioContext
that I use for the rendering: offlineContext.decodeAudioData(this.arrayBuffer)
. The sample rate of offlineContext
is 48000, while the sample rate of my audioContext
(used for normal playback, which works well) is 41000.
While creating the WAV file, the same sample rate than the offline context should be set in the WAV file header. For example, a WAV file with a sample rate of 44100 in the header that contains data chunks with a sample rate of 48000 will cause the playback to be in "slow motion" in iTunes.