Snap icon indicating copy to clipboard operation
Snap copied to clipboard

`AudioContext.decodeAudioData()` function always resamples every audio file to 96000 sample rate

Open ego-lay-atman-bay opened this issue 5 months ago • 3 comments

While working on my audio processing library, I discovered that every sound I imported (and created in snap) has the same constant sample rate, 96000, even though the sample rate was explicitly something else.

After doing some digging, I found that the AudioContext.decodeAudioData() function now converts all audio files to have a 96000 sample rate, resulting in weird inconsistencies.

Just to be clear, this is not necessarily an issue with snap, it's an issue with browsers changing how audio data is handled.

I don't currently know how to get the audio samples and the correct sample rate, but I feel like it might be good to ditch the AudioContext class, since it messes with audio data.

ego-lay-atman-bay avatar Sep 17 '24 21:09 ego-lay-atman-bay