MPD et DAC en USB sur un Raspberry Pi
Rédigé par Nicolas Sulek
Aucun commentaire
Classé dans : Logiciel
Le DAC sera vu comme une carte son supplémentaire pour le Raspberry.
Configuration de apt
Afin d'éviter d'installer des paquets inutiles, et surtout d'éviter l'installation de pulseaudio, il faut éditer le fichier /etc/apt.conf et rajouter :
APT::Install-Recommends "0"; APT::Install-Suggests "0";
Installation des paquets
Les paquets nécessaires sont :
- alsa-utils qui permettra d'identifier le DAC
- mpd le serveur mpd
- mpc le client local mpd permettant de piloter le serveur
apt-get install alsa-utils mpd mpc
Identifcation du DAC
Le DAC étant connecté en USB, on ne peut se fier à l'adressage de type hw0,0, vu qu'il peut être modifié au moment de l'allumage du DAC.On va plutôt utiliser l'identifiant renvoyé par aplay -L :
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
dmix:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample mixing device
dmix:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample snooping device
hw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Hardware device with all software conversions
default:CARD=DAC
USB Audio DAC, USB Audio
Default Audio Device
sysdefault:CARD=DAC
USB Audio DAC, USB Audio
Default Audio Device
front:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
Front speakers
surround21:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
Direct sample mixing device
dsnoop:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
Direct sample snooping device
hw:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
Direct hardware device without any conversions
plughw:CARD=DAC,DEV=0
USB Audio DAC, USB Audio
Hardware device with all software conversions
L'identifiant ALSA à utiliser est hw:CARD=DAC,DEV=0
Configuration de mpd
Toute la configuration de mpd se déroule dans /etc/mpd.conf.La configuration de base est relativement correcte, il n'y a que quelques lignes à modifier :
user "mpd"
group "audio"
bind_to_address "any"
audio_output {
type "alsa"
name "USB-Audio - USB Audio DAC"
device "hw:CARD=DAC,DEV=0"
auto_channels "no"
auto_format "no"
auto_resample "no"
mixer_type "none"
}
mixer_type "disabled"
replaygain "album"
La section audio_ouput contient notre identifiant précédent dans device.
Petite explication sur les options d'audio_ouput :
- auto_channels : conversion logicielle des canaux par ALSA
- auto_format : conversion logicielle du format de l’échantillonnage par ALSA
- auto_resample : conversion logicielle de l’échantillonnage par ALSA
- mixer_type : type de mixeur ALSA
replaygain permet d'utiliser les informations ReplayGain contenues dans les tags du fichiers mp3, flac, ogg, ... afin d'adapter le volume.
La dernière option à modifier est music_directory indiquant le répertoire contenant notre musique.
Dernières modifications
Dans les logs, il peut y avoir d'innombrables messages de type :
[42641.766854] delay: estimated 0, actual 133Pour pallier ce problème, il faut créer le fichier /etc/modprobe.d/alsa.conf et indiquer :
options snd-usb-audio nrpacks=1Le deuxième problème qu'il peut y avoir est la désactivation de la carte son interne du Raspberry PI.
Pour la réactiver, il faut charger son module au démarrage. Dans /etc/modules, rajouter :
snd-bcm2835