Skip to content

[Bug]: WAV header parse gives up after 1 KB, silently disabling playback #358

Closed

Description

@thcp

What happens

The chunked audio engine -- the default playback path -- reads its own WAV headers rather than using the browser decoder. It fetches the first kilobyte of each stem:

const res = await fetch(url, { headers: { Range: "bytes=0-1023" } });

and walks the RIFF chunks looking for data. If data has not appeared within those 1024 bytes, _parseWavHeader returns null, the stem has no header, and ready resolves false:

for (const stem of stemMap.values()) {
  if (stem.header) _duration = Math.max(_duration, stem.header.duration);
}
if (!_duration) return false;

Which lands in wireUpAudio:

console.warn("[player] audio engine had no usable stems; playback disabled");

The result: no waveforms (nothing to scale the lanes to), transport stuck at 0:00 / 0:00 even though the analysis header shows the real duration, and the play button does nothing.

Which files break it

Running the real parser against layouts other WAV writers produce, with the same 1 KB window the engine uses:

Layout Parsed
Plain 44-byte header (what our pipeline writes today) 10.0 s
WAVE_FORMAT_EXTENSIBLE (fmt 40, tag 0xFFFE) 10.0 s
Small LIST/INFO metadata (ffmpeg default) 10.0 s
JUNK padding, 512 bytes 10.0 s
JUNK padding, 4096 bytes null, playback disabled
LIST/INFO with 2 KB of tags null, playback disabled

So it works for what we write today and fails for anything that puts more than a kilobyte in front of the audio. torchaudio.save dispatches to whichever backend is installed (ffmpeg libraries, soundfile, sox), and those do not all write the same header, so this can differ between two machines running the same StemDeck build -- which is how it would present as a hardware or driver problem.

Expected

Find the data chunk wherever it is: read further when the first request does not reach it, or fall back to the streaming path instead of leaving the track unplayable.

Failing closed on an unusual header is the wrong default when a working alternative playback path already exists.

Possibly the cause of #343

Reported there as broken waveforms and dead playback on one Linux machine but not another, with the UI otherwise rendering perfectly. The signature matches: analysis duration present, transport 0:00 / 0:00, empty lanes. Not confirmed against the reporter's own files yet.

Activity

  1. added
    bugSomething isn't working
    on Aug 12, 2026
  2. added a commit that references this issue on Aug 12, 2026
    8d670e3
  3. self-assigned this
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions