-
Notifications
You must be signed in to change notification settings - Fork 613
Audio Backends
Ash edited this page Mar 22, 2019
·
24 revisions
librespot supports various audio backends. Multiple backends can be enabled at compile time by enabling the corresponding cargo feature. By default, only Rodio is enabled.
A specific backend can selected at runtime using the --backend
switch.
cargo build --release --features portaudio-backend
target/release/librespot [...] --backend portaudio
The following backends are currently available:
- Rodio (Default)
- ALSA
- PortAudio
- PulseAudio
- JACK
- Pipe
Most backends don't require specific setup. Some however do.
The right device needs to be passed to librespot
via the --device
flag. The alsa
terminology of hw:X,Y
is used, where X
is the card number, and Y
is the device number. This can be determined by:
~/librespot$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3234 Analog [ALC3234 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
# To determine the right mixer name for your card, try
~/librespot$ amixer --device "hw:0" --card "0" # Results truncated here
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 87
Mono: Playback 64 [74%] [-17.25dB] [on]
Simple mixer control 'Headphone',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'PCM',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 2 [1%] [-50.60dB]
Front Right: Playback 2 [1%] [-50.60dB]
Thus, in this example the settings would be:
./target/release/librespot [] --backend alsa \
--device="hw:0,0" \
--mixer="alsa" --mixer-card="hw:0" --mixer-name="Master" \
NOTE: librespot
you might want to turn on --linear-volume
when utilising a hardware mixer.