In the last couple of weeks, out of curiosity, I’ve bought a Raspberry Pi to play with at home. It’s really very impressive to see what can be done these days with a $35 computer – an “educational” model at that!
Our Pi is currently in place as our digital audio player, courtesy of the Volumio linux “audiophile” distribution, and an EMU 0202 USB audio interface.
Once the Pi was booting Volumio off the SD card, I found two things that needed doing:
- Set up the Pi to pull files off our NAS device. In theory this can be done from the Volumio web interface, but I had to go hacking around editing config files to make this work seamlessly.
- Set up the EMU for optimal digital playback. I take a somewhat different path on this to most “audiophiles”. I’m specifically aiming to implement a software volume control, provided I can run the digital audio chain at 88.2KHz/24bit, or higher. This means CD/MP3 content gets upsampled, while some recordings made natively at 88.2KHz/24bit get to be played that way.
The Volumio forums helped me out with point 1, but I’ve lost a lot of brainpower and free time to getting the EMU to work properly. I could get it to play out at 44.1KHz/24-bit, but any attempt to play native files at higher rates, or to have MPD upsample, resulted in obviously robotic-sounding distorted playback. It turns out the key was simple:
It seems the clock rate on the EMU 0202 and 0404 USB devices is assigned to a fader in ALSA, which in this case I accessed using alsamixer. There were two faders for my 0202: PCM and Clock rate Selector.
The latter has a range of stepped values, equating to the following sample rates:
- 0% 44.1KHz
- 20% 48.0KHz
- 40% 88.2KHz
- 60% 96.0KHz
- 80% 176.4KHz
- 100% 192.0KHz
What I’ve learned then is that to get the setup working, I needed to not only set Volumio (or the underlying MPD player) to resample to the target output rate of 88.2KHz/24-bit but ALSO to set the Clock rate Selector to 40% in alsamixer.
All works happily and I’m loving the more “analogue” sound of the EMU in that mode!
UPDATE, 23RD FEB 2014:
I’ve managed to get MPD to reliably resample to 176400Hz/24-bit (32-bit internal, 24-bit at the card.) by forcing the Pi’s turbo to “always on” and a slight overclock. It’s not *quite* perfect yet, so i might see if I can push it a little harder before documenting our full setup.
Try this kernel patch: http://article.gmane.org/gmane.linux.alsa.devel/125476
It should fix automatic sample rate switch by ALSA E-mu driver
Thanks for the tip! I’ve since moved to a Wolfson Audio card, with excellent results! Will investigate the EMU fix when time allows.
I’m having a headache getting the 0202 to play correct audio on my Pi2. Plays fine for 3~5 seconds and then it stops. When I mess around with different rates it gets robotic or just noise.
Just want it for 44 and 48 Khz rates.
Any ideas maybe ?
I managed to get it working. Man that little DAC has great sound !
Problem was in the ALSA Clock settings.
This page helped me by sending me in the right direction, thnx for that 😀
Hurrah! Mine’s presently doing service capturing audio from a Revox B77 Reel-Reel, either on a Raspberry Pi or on a Netbook. Partly explains why I’ve been so quiet here!
Glad the tips helped someone! :0)
Can yoz explain how yoz managed to get alsa settings properly. Thanks
Sorry it’s taken so long to see this! My install worked correctly except for the sample-rate issue. To correct that, I set MPD to resample everything to a known fixed rate (88.2KHz 24 bit worked reliably for me on the Pi, 176400Hz 24-bit works well on Intel x86 with Core 2 Duo or better) – start something playing in MPD, then go to the command-line to bring up Alsamixer:
#: alsamixer
Then use the interface to select the correct rate. Doing this with MPD playing makes it really obvious when you have it right.
Not tried the kernel patch listed above as I’ve not really had need once I figured out what was going on. If I wanted true bit-perfect playback I’d give it a go, but I’m happy enough with the rig to leave as-is.