Why Web Audio Decodes a WAV at the Context’s Sample Rate
Decode the same WAV in two offline contexts to compare sample rate, frame count and duration.


A WAV file says 44.1 kHz, yet the browser returns an AudioBuffer at 48 kHz. The context controls the rate of the decoded buffer. Keep the file metadata separate from the samples you will actually edit.
Decode one WAV twice
Use an exact one-second 44.1 kHz PCM WAV with 44,100 source sample frames. Create two OfflineAudioContexts at 44,100 and 48,000 Hz. Pass a fresh slice(0) copy of the file’s ArrayBuffer to each decodeAudioData call, since the input buffer is detached. You do not need to start offline rendering.
Record sampleRate, length and duration. Expect approximately 44,100 frames in the first result and 48,000 in the second, both near one second. Read the original WAV header separately when checking the file’s delivery specification.
Convert an edit point through time
Frame 22,050 in the source is about half a second in. In a 48 kHz buffer, that lands near frame 24,000. Copying the old frame index would move the edit earlier. Convert through seconds, apply a consistent rounding rule and check the result in the target player.
Use the game sound effects generator to prepare a representative effect and run the same comparison. Record both the file header and the decoded buffer fields when reporting any discrepancy.
Recommended tools

AI Game SFX Generator: A Practical Guide for Indie Game Developers
Learn how an AI game SFX generator helps indie developers create fast, usable sound effects for UI, coins, weapons, magic, horror, retro games, and rapid prototypes.

AI SFX Generator vs Sound Library: Which Is Better for Game Audio?
Compare AI SFX generators and traditional sound libraries for indie game audio. Learn when to generate custom effects, when to use libraries, and how to combine both workflows.

Best Sound Effects to Create First for an Indie Game Prototype
A practical checklist of the most important game sound effects indie developers should create first, including UI clicks, pickups, hits, rewards, errors, transitions, and completion cues.
Ready to try "Why Web Audio Decodes a WAV at the Context’s Sample Rate"?
Use our online tools to apply this tutorial to your indie game project right away.
