Skip to content

aplay does not use WAV/FLAC channel layout metadata, potentially causing incorrect multichannel playback unless --chmap is manually specified #325

@JonnyGators

Description

@JonnyGators

Summary

When playing multichannel WAV or FLAC files, aplay ignores the
channel-layout metadata embedded in the file (WAV channel mask or FLAC
channel assignment). As a result, aplay always uses ALSA’s fallback
channel order (FL,FR,LFE,FC,RL,RR) unless the user manually specifies
--chmap.

This leads to incorrect channel routing (e.g., center/LFE swapped) even
when the file contains correct metadata describing the intended layout.

This appears to be a missing feature in aplay rather than an ALSA kernel
or alsa-lib issue, since ALSA’s design expects applications to interpret
metadata and call the chmap API accordingly.

Expected Behavior

When playing a WAV or FLAC file that contains channel-layout metadata:

  • aplay should read the channel mask / channel assignment
  • aplay should translate that metadata into an ALSA channel map
  • aplay should call snd_pcm_set_chmap() automatically
  • playback should follow the file’s intended channel order without
    requiring the user to manually specify --chmap

Actual Behavior

  • aplay ignores WAV channel masks
  • aplay ignores FLAC channel layouts
  • aplay does not call snd_pcm_set_chmap()
  • aplay uses ALSA’s fallback order (FL,FR,LFE,FC,RL,RR)
  • multichannel playback is incorrect unless the user manually provides
    --chmap=FL,FR,FC,LFE,RL,RR (or another appropriate map)

Why This Matters

Most modern multichannel formats (WAV, FLAC, Blu-ray PCM, Dolby, DTS,
ffmpeg, etc.) use the standard 5.1 order:

FL, FR, FC, LFE, RL, RR

Since aplay does not use metadata, it produces incorrect output on any
system where the ALSA fallback order differs from the file’s intended
order.

This behavior is surprising to users and inconsistent with ALSA’s own
expectation that applications should interpret metadata and set the
channel map explicitly.

Reproduction

  1. Use any 5.1 WAV or FLAC file with correct channel metadata.
  2. Play with:
    aplay -D hw: file.wav
  3. Observe incorrect channel routing (e.g., center and LFE swapped).
  4. Play again with:
    aplay -D hw: --chmap=FL,FR,FC,LFE,RL,RR file.wav
  5. Playback is now correct.

Request

Please consider adding metadata parsing to aplay so that it:

  • reads WAV channel masks
  • reads FLAC channel layouts
  • automatically sets the correct ALSA channel map

This would align aplay with ALSA’s documented expectation that
applications handle metadata and would greatly improve multichannel
playback correctness and usability.

Thank you for your time and consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions