Skip to content

Prefer native WAV decoding before SDL_sound#2066

Open
Tutez64 wants to merge 1 commit into
openfl:developfrom
Tutez64:bugfix/wav-decode-before-sdlsound
Open

Prefer native WAV decoding before SDL_sound#2066
Tutez64 wants to merge 1 commit into
openfl:developfrom
Tutez64:bugfix/wav-decode-before-sdlsound

Conversation

@Tutez64
Copy link
Copy Markdown

@Tutez64 Tutez64 commented May 18, 2026

Summary

Prefer Lime's native WAV decoder before SDL_sound when eagerly loading audio buffers from files or bytes.

Rationale

Some PCM WAV sound effects decoded through SDL_sound first can produce audible startup artifacts when loaded via AudioBuffer.fromBytes(). The same assets decode and play correctly when Lime's native WAV::Decode() path is used first.

For plain PCM WAV files, the native decoder is the more direct path: it reads the RIFF/WAVE chunks and copies the sample data without routing through SDL_sound conversion. SDL_sound remains available as a fallback for formats or WAV variants that the native decoder does not support.

Repro

LimeWavSdlSoundArtifactRepro.zip

Try Lime's native WAV decoder before SDL_sound for eager audio buffer loading. This avoids SDL_sound introducing artifacts for some PCM WAV files loaded from bytes, while keeping SDL_sound as a fallback for formats or WAV variants not handled by the native decoder.
@dimensionscape
Copy link
Copy Markdown
Member

Would prefer to find out what is causing the audio noise rather than papering over the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants