User Tools

Site Tools


doc:appunti:hardware:raspberrypi_nas_audio

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:hardware:raspberrypi_nas_audio [2021/03/10 16:39] – [Raspberry Pi 4 audio hardware] niccolodoc:appunti:hardware:raspberrypi_nas_audio [2025/10/13 09:16] (current) – [Digital audio through HDMI] niccolo
Line 1: Line 1:
 ====== Raspberry Pi NAS: The audio subsystem ====== ====== Raspberry Pi NAS: The audio subsystem ======
 +
 +This page is about configuring the **audio subsystem** on a Raspberry Pi installed with RaspiOS, to be used as NAS and mediacenter. See the main index at **[[raspberrypi_nas]]**.
  
 I want to use **Kodi** for **HDMI video and audio** playback, but I want also occasionally to play music using **Music Player Daemon**, routing the audio to an external amplifier which has **RCA stereo connectors**. Once the cables are connected, it is also desiderable to play Kodi videos routing video to **HDMI monitor** and routing audio to the **stereo amplifier**. I want to use **Kodi** for **HDMI video and audio** playback, but I want also occasionally to play music using **Music Player Daemon**, routing the audio to an external amplifier which has **RCA stereo connectors**. Once the cables are connected, it is also desiderable to play Kodi videos routing video to **HDMI monitor** and routing audio to the **stereo amplifier**.
Line 15: Line 17:
  
 {{ .:raspberrypi:raspberry-pi-hdmi-video-audio-cable.jpg?180|HDMI video and audio cable}} {{ .:raspberrypi:raspberry-pi-hdmi-video-audio-cable.jpg?180|HDMI video and audio cable}}
-This is the first natuarl choiche, at least when watching videos using Kodi. I use an old **Raspberry Pi 3** as a Kodi media center, connected to an HDMI monitor capable of audio too; the sound quality is acceptable and it is aligned to the medium quality of the speakers inside the monitor. Unfortunately I discovered that the **Raspberry Pi 4** has a **worse audio quality** than the Pi 3: I ear continously **pops, clicks and little gaps in the music**. I tried to swap the power supply and the HDMI cable with better quality ones, but **the problem remains**. It seems that the problem is not hardware related, but it is introduced when I add Pulseaudio in the software stack. If I select direct Raspberry **PI:HDMI** as sound device in Kodi, the audio **playback is OK**.+This is the first natural choiche, at least when watching videos using Kodi. I use an old **Raspberry Pi 3** as a Kodi media center, connected to an HDMI monitor capable of audio too; the sound quality is acceptable and it is aligned to the medium quality of the speakers inside the monitor. Unfortunately I discovered that the **Raspberry Pi 4** has a **worse audio quality** than the Pi 3: I ear continously **pops, clicks and little gaps in the music**. I tried to swap the power supply and the HDMI cable with better quality ones, but **the problem remains**. It seems that the problem is not hardware related, but it is introduced when I add Pulseaudio in the software stack. If I select direct Raspberry **PI:HDMI** as sound device in Kodi, the audio **playback is OK**.
  
 I prefer to avoid the HDMI audio output mainly because the audio of the HDMI monitor is of poor quality, but another problem is that if **the monitor goes into standby** (as Kodi does, when you don't play anything), also **the audio goes standby**. In this condition even the Music Player Damon cannot play to HDMI. I prefer to avoid the HDMI audio output mainly because the audio of the HDMI monitor is of poor quality, but another problem is that if **the monitor goes into standby** (as Kodi does, when you don't play anything), also **the audio goes standby**. In this condition even the Music Player Damon cannot play to HDMI.
Line 30: Line 32:
 ==== Using an externa USB sound card ==== ==== Using an externa USB sound card ====
  
 +{{ .:raspberrypi:raspberry-pi-usb-audio-cable.jpg?180|USB sound card with RCA connectors and cable}}
 For a decent audio quality, I decided that  the only acceptable solution is to relay on an external USB sound card connected to my stereo amplifier. I choosed a model based on the **C-Media Electronics** chip (USB Id **0d8c:0024**), which comes with two standard RCA connectors. The device is compatible with ALSA so the Pulseaudio system can select it per default, setting the following in **/etc/pulse/client.conf**: For a decent audio quality, I decided that  the only acceptable solution is to relay on an external USB sound card connected to my stereo amplifier. I choosed a model based on the **C-Media Electronics** chip (USB Id **0d8c:0024**), which comes with two standard RCA connectors. The device is compatible with ALSA so the Pulseaudio system can select it per default, setting the following in **/etc/pulse/client.conf**:
  
Line 164: Line 167:
   * **[[https://superuser.com/questions/1274901/systemd-forking-vs-simple/|systemd forking vs simple?]]**   * **[[https://superuser.com/questions/1274901/systemd-forking-vs-simple/|systemd forking vs simple?]]**
  
-==== Use PulseAudio with Kodi ====+===== Use PulseAudio with Kodi =====
  
 With the PulseAudio running as a system service, you can start Kodi and go to **Settings** => **System** => **Audio** = **Audio output device** and select **PULSE: Default**. Here you can also switch between HDMI and stereo jack: With the PulseAudio running as a system service, you can start Kodi and go to **Settings** => **System** => **Audio** = **Audio output device** and select **PULSE: Default**. Here you can also switch between HDMI and stereo jack:
Line 191: Line 194:
 The **mpd** user must be addedd to the relevant groups: **audio**, **pulse** and **pulse-access**.  The **mpd** user must be addedd to the relevant groups: **audio**, **pulse** and **pulse-access**. 
  
 +===== Web References =====
 +
 +  * **[[https://kodi.wiki/view/PulseAudio|Kodi with PulseAudio]]**
 +  * **[[https://gist.github.com/bheisig/bf1a13a05cdb6a12ee805b00dc6d90bb|PulseAudio for Kodi, MPD and remote access on a Ubuntu host]]**
  
doc/appunti/hardware/raspberrypi_nas_audio.1615390791.txt.gz · Last modified: by niccolo