Skip to content

invalid channel map when using pulseaudio #1

@michals

Description

@michals

When using multichannel samples and pulseaudio playback
the default channel map is invalid (at least for surround40).
Tested on sox 14.4.2 on latest fedora and latest ubuntu LTS on 3 different PC and 3 different audiocards.

Steps to reproduce:

  1. Generate 4 channel sample: 4channles.wav
# time [s]: |0----------2-----------4---------6------------>
# channel1: |front-left
# channel2: |           front-right
# channel3: |                       rear-left
# channel4: |                                 rear-right

sox /usr/share/sounds/alsa/Front_Left.wav  1.wav pad 0
sox /usr/share/sounds/alsa/Front_Right.wav 2.wav pad 2
sox /usr/share/sounds/alsa/Rear_Left.wav   3.wav pad 4
sox /usr/share/sounds/alsa/Rear_Right.wav  4.wav pad 6
sox 1.wav 2.wav 3.wav 4.wav 4channels.wav --combine merge
  1. make sure you have pulseaudio installed and running
  2. ensure sample is played correctly via alsa: aplay --verbose 4channles.wav
  3. ensure sample is played correctly via pulseaudio player: paplay --verbose 4channles.wav

Now, let's play via sox/play:

  1. AUDIODRIVER=pulseaudio AUDIODEV=default play -V 4channels.wav

Note, that channel mapping is invalid.
In fact it is:

AUDIODRIVER=pulseaudio AUDIODEV=default play -V mono.wav remix 1 0 0 0 0 0     # front-right
AUDIODRIVER=pulseaudio AUDIODEV=default play -V mono.wav remix 0 1 0 0 0 0     # back-right
AUDIODRIVER=pulseaudio AUDIODEV=default play -V mono.wav remix 0 0 1 0 0 0     # front-center (both front)
AUDIODRIVER=pulseaudio AUDIODEV=default play -V mono.wav remix 0 0 0 1 0 0     # front-left
AUDIODRIVER=pulseaudio AUDIODEV=default play -V mono.wav remix 0 0 0 0 1 0     # back-left
AUDIODRIVER=pulseaudio AUDIODEV=default play -V mono.wav remix 0 0 0 0 0 1     # back-center (both back)

In order to fix that, one needs to send 6 channel with specific routing:
AUDIODRIVER=pulseaudio AUDIODEV=default play -V 4channels.wav remix 1 3 0 2 4 0

When using pulse indirectly via alsa API all is just file:
AUDIODRIVER=alsa AUDIODEV=pulse play -V 4channels.wav

Expected behavior:

AUDIODRIVER=pulseaudio AUDIODEV=default play -V 4channels.wav
should be equivalent to:
AUDIODRIVER=alsa AUDIODEV=pulse play -V 4channels.wav

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions