-
-
Notifications
You must be signed in to change notification settings - Fork 111
IยฒS DACs
The Raspberry Pi's headphone jack is a simple PWM device, and not designed for high-fidelity audio. This becomes very obvious when you use mt32-pi - distortion in the sound is apparent when quieter sounds are playing.
Luckily, a plethora of inexpensive DAC (digital-to-analog converter) hardware is available for the Raspberry Pi, giving it true hi-fi quality audio output. These often take the form of an easy-to-install "HAT" board that you place onto the Raspberry Pi's GPIO pins. They make use of the Raspberry Pi's IยฒS bus for interfacing.
โ ๏ธ Note: We do not support any kind of USB DAC audio output device, due to the lack of drivers in the Circle baremetal framework that we depend on. Adding USB audio support to Circle would be a huge undertaking, although if that changes in the future and Circle gains USB audio support, we could certainly make use of it.
- mt32-pi defaults to PWM (headphone) output. Edit
mt32-pi.cfg
and changeoutput_device
toi2s
to enable the IยฒS DAC driver. - If your DAC requires software configuration, you may need to edit the
i2c_dac_address
andi2c_dac_init
options to suit your particular DAC. Continue reading for further details.
Currently, we have been targeting DACs based on the Texas Instruments PCM5xxx series of chips due to their popularity, but other DACs could be supported quite easily. The NXP UDA1334 is also reportedly working well.
Some more advanced DACs are configured by software (normally a Linux driver), whereas others need no configuration as they are preconfigured in hardware. This will vary between manufacturers, and so some editing of mt32-pi.cfg
may be required.
โ ๏ธ Note: If a DAC requires software configuration, they will not produce any sound until they have been properly initialized. This initialization is done by sending it a special sequence of commands over the IยฒC (not IยฒS) bus. For the PCM5xxx family, you can seti2c_dac_init = pcm51xx
to enable this.
Feel free to open an issue if you'd like to help us support your DAC, or even just to report success or failure so that we can build a list of supported DACs.
The following models of DAC have been confirmed as working by our testers. Please note the necessary configuration file options.
Manufacturer | Device | DAC chip | Additional config file options | Comments |
---|---|---|---|---|
Arananet | PI-MIDI | UDA1334 | None required | Stereo RCA output. Custom design by @arananet also with GPIO MIDI in. Tested by @dwhinham. |
Blokas | Pisound | PCM5102A | Ensure sample_rate is set to 48000, 96000, or 192000 |
Stereo 6.35mm output, volume knob, and integrated SPI MIDI interface. Tested by @dwhinham and @sigkill. |
chris-jh | mt32-pi-midi-hat | PCM5102A | None required | Stereo 3.5mm output. Custom free/open source design by @chris-jh also with GPIO MIDI in. Tested by @gmcn42. |
Generic | GY-PCM5102 | PCM5102A | None required | Stereo 3.5mm output. Found very cheaply on AliExpress and other sites. Tested by @dwhinham. |
Generic | Pi-Fi DAC+ v2.0 | PCM5122 |
i2c_dac_init = pcm51xx , i2c_dac_address = 4d
|
Stereo RCA and 3.5mm output. Tested by @rc55. |
gmcn42 | clumsyMIDI | PCM5102A | None required | Stereo 3.5mm output. Custom free/open source design by @gmcn42 also with GPIO MIDI in and out/thru. Tested by @gmcn42. |
HiFiBerry | DAC+ ADC | PCM5122 |
i2c_dac_init = pcm51xx , i2c_dac_address = 4d
|
Stereo RCA output. Tested by @kgorphanides. |
innomaker | HiFi DAC HAT | PCM5122 |
i2c_dac_init = pcm51xx , i2c_dac_address = 4d , sample_rate=44100
|
Stereo RCA and 3.5mm output. Not compatible with hd44780_4bit displays. Tested by @calvinmorrow and @alexras. |
IQaudIO | Pi-DAC Pro | PCM5242 |
i2c_dac_init = pcm51xx , i2c_dac_address = 4c
|
Stereo RCA and 3.5mm output. Tested by @dwhinham. |
The i2c_dac_address
configuration file option determines what address on the IยฒC bus that mt32-pi will send initialization commands to, if i2c_dac_init
is not set to none
.
If your DAC does not appear in the compatibility table above, you can help by carrying out the following:
- Connect the DAC to your Raspberry Pi.
- Insert an SD card containing the latest version of Raspberry Pi OS (aka. Raspbian) and boot the Pi.
- Run the command
sudo raspi-config
. - Select "Interfacing Options", followed by "IยฒC" and "Yes" to enable the IยฒC kernel modules.
- Exit
raspi-config
, and run the commandsudo apt-get install i2c-tools
to install some IยฒC utilities. - Run the command
i2cdetect -y 1
. The output should be like the following:0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
- In this example, the address is 4d. Make a note of this and set
i2c_dac_address
inmt32-pi.cfg
. - If your DAC now works, edit this page and add it to the table! Otherwise, open an issue, and we can try to work out how to support it.
ยฉ Dale Whinham 2020-2022. Released under the GNU General Public License v3.0.