DeLub
Active Member
I wrote this 'guide' in the hopes it will be useful for anyone.
Introduction
I would like to connect my dac and amp to my iPad to be able to listen to Apple Music on my HD600. However, I want to eq the sound and this is not possible on iOS. That's where the pi comes in: I want to put it in between my dac and the iPad, take the sound from the iPad, eq it, and output it to my dac. This is possible on a Raspberry Pi 4, as it support OTG mode for the usb power input port.
Required hardware
Obviously you need to have a Raspberry Pi 4 (it might also work on a Pi Zero). Earlier Pis don't support OTG, so won't work.
I also bought this thingie:
This allows to plug in the Pi's power source and a data cable that will be connected to the iPad on one side, and a single cable with data and power combined to the Pi. This way the Pi stays powered on when no sound source is connected and doesn't draw any power from the iPad when it is connected. (You can buy one here or on other Pi shops.)
Finally, you need a bunch of cables .
Setup the Pi
In the rest of this description I'm using DietPi as Linux distribution, but it should work quite similar on other distributions.
So, first install DietPi as per the instructions on their site. Make sure audio is enabled in the configuration program that is automatically run the first time you boot into DietPi.
Make the Pi function as an USB audio gadget
After reboot the Pi functions as an USB audio gadget that accepts audio with a sample rate of 48kHz (change
Setup equalisation
I'll use ffmpeg for equalisation. Install ffmpeg, and create
This creates a service that is automatically started after booting the Pi. I've put in the equalisation values for the HD600 by Oratory1990, but you should in your filters of course.
Start with
Going further: dynamic sample rate switching
Ideally, you want the Pi to support multiple sample rates and dynamic switching. The current kernel modules don't support that however. Luckily P.Hofman forked the Linux source and applied a couple of patches to support dynamic sample rate switching. This does, however, require the compilation of the kernel.
I've got the kernel to compile, however it's not working stable currently. I'll update the extra steps necessary to support dynamic sample rate switching, when I've got it figured out
References
I've pulled this together based on several sources (which I did not all write down), but mainly from:
Introduction
I would like to connect my dac and amp to my iPad to be able to listen to Apple Music on my HD600. However, I want to eq the sound and this is not possible on iOS. That's where the pi comes in: I want to put it in between my dac and the iPad, take the sound from the iPad, eq it, and output it to my dac. This is possible on a Raspberry Pi 4, as it support OTG mode for the usb power input port.
Required hardware
Obviously you need to have a Raspberry Pi 4 (it might also work on a Pi Zero). Earlier Pis don't support OTG, so won't work.
I also bought this thingie:
This allows to plug in the Pi's power source and a data cable that will be connected to the iPad on one side, and a single cable with data and power combined to the Pi. This way the Pi stays powered on when no sound source is connected and doesn't draw any power from the iPad when it is connected. (You can buy one here or on other Pi shops.)
Finally, you need a bunch of cables .
Setup the Pi
In the rest of this description I'm using DietPi as Linux distribution, but it should work quite similar on other distributions.
So, first install DietPi as per the instructions on their site. Make sure audio is enabled in the configuration program that is automatically run the first time you boot into DietPi.
Make the Pi function as an USB audio gadget
- Add the line
dtoverlay=dwc2
to/boot/config.txt
. - Add two lines to
/etc/modules
:
Code:dwc2 g_audio
- Create file
/etc/modprobe.d/usb_g_audio.conf
:
Code:#load the USB audio gadget module with the following options options g_audio c_srate=48000 c_ssize=4
- Reboot.
After reboot the Pi functions as an USB audio gadget that accepts audio with a sample rate of 48kHz (change
c_srate
if you would like another sample rate), and a sample size of 32 bits (c_ssize=4
means 4 bytes, equals 32 bits). For this, a new alsa device has been created. In my case it's hw:0
(and hw:1
is my dac), but you can find out by running arecord -l
(and aplay -l
to find your dac).Setup equalisation
I'll use ffmpeg for equalisation. Install ffmpeg, and create
/etc/systemd/system/ffmpeg.service
:
Code:
[Unit]
Description=Equalizer
Requires=sound.target
[Service]
Type=simple
ExecStart=/usr/bin/ffmpeg -loglevel panic -nostats -nostdin -f alsa -acodec pcm_s32le -i hw:0,0 -af "volume=volume=-5.8dB,bass=f=25:t=q:w=0.71:g=6.0,equalizer=f=150:t=q:w=0.5:g=-2.9,equalizer=f=1330:t=q:w=1.4:g=-2.0,equalizer=f=3150:t=q:w=2.2:g=-3.1,equalizer=f=3500:t=q:w=4.0:g=-1.0,equalizer=f=5000:t=q:w=6.0:g=-1.2,equalizer=f=5850:t=q:w=4.5:g=-2.2,equalizer=f=5600:t=q:w=0.71:g=2.0,equalizer=f=7710:t=q:w=5.0:g=-2.5,treble=f=13000:t=q:w=0.71:g=-3.0" -f alsa -acodec pcm_s32le hw:1,0
Restart=always
[Install]
WantedBy=multi-user.target
This creates a service that is automatically started after booting the Pi. I've put in the equalisation values for the HD600 by Oratory1990, but you should in your filters of course.
Start with
systemctl start ffmpeg
. To have this service start at reboot, type systemctl enable ffmpeg
.Going further: dynamic sample rate switching
Ideally, you want the Pi to support multiple sample rates and dynamic switching. The current kernel modules don't support that however. Luckily P.Hofman forked the Linux source and applied a couple of patches to support dynamic sample rate switching. This does, however, require the compilation of the kernel.
I've got the kernel to compile, however it's not working stable currently. I'll update the extra steps necessary to support dynamic sample rate switching, when I've got it figured out
References
I've pulled this together based on several sources (which I did not all write down), but mainly from: