OVERVIEW | SOFTWARE | COMPONENTS | FAQ | BLOGS | Shopping Cart |
Blog Post |
2018-12-05 Raspberry Pi Audio Issues The Raspberry Pi is a great little computer but in order to keep cost down the audio system got short-shrift. If you've tried to use the Raspberry Pi as a media player you've probably noticed poor sound quality produced by the analog output jack. There are a lot of technical articles on the internet that delve into why the Raspberry Pi's audio section is so poor. I am not technical enough to understand all of the why's and wherefore's but I can say that if you want better audio there are several ways to achieve it. But only one best way in my opinion. If your audio requirements are low, you might be perfectly happy to use the built-in 1/8" audio jack. Nothing more need be done. If your audio requirements are high then additional hardware is required. In developing The Comvette Project, I have tried several different approaches to achieve better audio. My first approach: I purchased a sound card that attached to the Raspberry Pi's GPIO bulkhead connector. At first things seemed to be much improved. But I soon discovered that unlike the sound card hardware used in a typical desktop computer, the sound card only supported on a single client at a time. That meant that if an application was playing music, all other applications running on the Raspberry Pi were effectively locked out and could not produce sound until the music player application stopped. Clearly a multi-tasking OS like Raspbian is likely to be running several applications that may need to produce sound simultaneously. So, the sound card was retired to my parts drawer. My second approach: I purchased two USB dongle style sound cards to see if I could at least support two applications producing audio simultaneously. This worked fairly well but it required that you configure the two sound producing applications to use a specific USB sound card dongle. If a third application needed to produce audio it was locked out. This was too inflexible. It could not handle the dynamic nature of applications on a PC coming and going. Sound card resources had to be pre-allocated. So, the USB sound card dongles were also retired to my parts drawer. My latest (and hopefully final) approach: I purchased an HDMI Audio Extractor. This device is inserted between the Raspberry Pi's HDMI port and the touch-screen. It also has a USB plug which is used to provide 5-volt power to the extractor. Two small changes/additions to the Raspberry Pi configuration file (/boot/config.txt) is all that is required to make the Raspberry Pi route its audio output to the HDMI port where the audio extractor can process it. The changes are shown below: # When using an HDMI audio extractor with the 5" touchscreen, you # have to tell raspbian to switch the HDMI port to HDMI mode (w/sound) # rather than DVI mode (no sound). # hdmi_drive=1 (DVI mode (no sound)) # hdmi_drive=2 (HDMI mode (sound will be sent if supported and enabled)) # hdmi_drive=2 # When using an HDMI audio extractor with the 5" touchscreen, you # have to tell raspbian to allow the sending of audio to the HDMI # port even when this is not reported as supported by the display. # hdmi_force_edid_audio=1 (allow audio). # hdmi_force_edid_audio=1 This turned out to be the best solution for The Comvette Project. Multiple applications can produce sound simultaneously, the sound quality is great because the Raspberry Pi simply passes the digital audio data on to the audio extractor which has a much better audio renderer. |