Controlling an AK4490 DAC with an Arduino

These days I’m co-developing an AK4490 based DAC. The aim is to end up with a no-compromise dual mono design, one that would perform at the very least on par with my Buffalo III.

Of course, to do that one has to run the 4490s in software mode.

As a matter of fact, it is generally preferred to run a 4490 in software versus hardware mode, for several reasons.

To begin with, in software mode the 4490 supports DSD decoding. It goes as far as to support a “Volume Bypass” feature which bypasses most of the processing done on the DSD signal (a.k.a. “the ΔΣ modulator”), resulting in more pure sound. But of course we do lose the ability to do volume control in software.

Software mode also allows us to try out all of the supported SQ features, like the different “Sound Setting” modes.

At last but not least, we get digital hardware volume control.

This is the prototype that we designed, getting I2S input from an Amanero and being controlled by my custom STM32 controller (more on that in the near future).

I searched the Net for any ready-made code that would control the 4490, but I couldn’t find anything worthwhile, so I began virtually from scratch.

So, my Arduino code (a.k.a. “aKduino”) enables:

  • Controlling an AK4490 through the I2C bus.
  • Automatic switching between PCM and DSD. It does rely on getting a “DSD type signal” from our USB-to-I2S interface of choice. The 4490 by itself is not capable of determining whether its input is PCM or DSD.
  • Setting the volume (in 9 steps.. just to confirm that volume control does indeed work).
  • Selecting “Volume Bypass” for direct DSD processing.
  • Selecting the internal DSD filter’s cutoff frequency (50KHz or 150KHz).
  • Selecting one of the 4 available PCM filters.
  • Enabling or disabling the Super Slow filter.
  • Selecting one of the 3 available “Sound Quality” settings.
  • Displaying all of the registers’ settings (for troubleshooting purposes).

Software Requirements:

  • Nothing (for now)

Basic Hardware Requirements:

  • Any Arduino (*)

(*) I should note here that the AK4490’s datasheet states that all of its I/O pins are expecting 3.3V logic levels but there has been a large number of reported cases of 5V Arduinos working without problems. I’m too much of a coward to try that myself so I used level converters for my initial testing and eventually a custom STM32 board that uses 3.3V logic but you may want to try your luck with 5V logic levels. Just don’t blame me if your 4490 gets damaged in the process.

Currently the code is at v1.35: aKduino Code (1925 downloads)

Here is the revision history:

v1.35 20/12/2016:

  • Code cleanup for first public release.

v1.33 19/12/2016:

  • Added full control of sound parameters through serial port.

v1.27 18/12/2016:

  • First functional version.
  • Automatic switching between PCM and DSD by monitoring DSDPIN.

Pipo X7: An ultra low cost Windows PC as a music transport

A few days ago I received the Pipo X7 that I had pre-ordered back in January.

It took so long to source & ship because it is immensely popular – after all, for less than 100€ I got:
– An Intel Baytrail Quad Core CPU @ 2.16GHz
– 2GB of low power DDR3 RAM
– A 32GB SSD drive (Samsung MBG4GC)
– An HDMI out
– WiFi b/g/n, 10/100Mbps Ethernet & Bluetooth connectivity
– 4 x USB 2.0 ports

All of that inside a slick aluminum box, not much larger than a CD, powered by a silent 12V/2.4A power supply.

IMG_9228

But the best part is that it runs a fully activated copy of Windows 8.1 (32bit)!

Yes, Microsoft is essentially giving away Windows 8.1 for use in small devices (like set-top boxes, such as this one) with only one catch for the OEM: He is not allowed to set Google Search as the default search engine. However, this does not mean that you can not set Google as your preferred search engine if you wish (instead of the dreadful Bing).

Now, I must admit that this was largely an impulse buy for me, since I already have a full size HTPC and a Squeezebox Touch as an audio transport, but I just couldn’t resist the temptation. So, since I had it, I decided to run a series of audio-oriented tests on it.

My player of choice is Foobar, feeding a Buffalo III DAC through an Amanero Combo384. The files were stored on a file server on my LAN and the Pipo was connected to the LAN via 100Mbps Ethernet.

The first test included outputting DSD to the Amanero. All the necessary Foobar components were loaded, including of course the Super Audio CD Decoder and the necessary configuration was performed:

Pipo-X7-DSD-out-1
Note: There are several steps involved in getting Foobar to output DSD. It is not the purpose of this post to fully outline them. A Google search would turn up a number of guides / how-tos.

First up was a “plain” DSD64 file. The Pipo had no problem playing it back, with less than 1GB of RAM use and about ~13% CPU utilization:

Pipo-X7-DSD-out-3

Let’s make it more interesting. DSD128:

Pipo-X7-DSD-out-4

Still no problem. As a matter of fact, CPU load has actually decreased! That is probably because the DSD64 file was from a SACD ISO, so some CPU time was used in handling the big file.

Moving on to a worst case scenario: A DXD file:

Pipo-X7-DXD-out

Still, no sweat, with the CPU barely sweating at 16% load. RAM has not climbed above 800MBs.

Since the machine appeared to have some decent horsepower, I thought I would try the well-known SoX Resampler DSP for Foobar. I set it up as best I could, since I don’t really have much experience with the actual DSP:

Pipo-X7-SoX-config

I chose to go the “x4” upsampling way, with the “Best” quality setting. This meant that a 44.1KHz file would be upsampled to 176.4KHz and a 96KHz file would be upsampled to 384KHz, hitting the limits of the Amanero interface. A 192KHz file would not be supported, since that would mean that it would have to be upsampled to 768KHz. The idea was to do a benchmark, so I just played two versions of the same files, one at 44.1K and one at 96K. This was the result:

Pipo-X7-SoX-44.1K-x4

Pipo-X7-SoX-96K-x4

So, still no serious sweat, with the CPU averaging 29% load, with one of its cores (presumably the one doing the actual upsampling) getting about 50% usage.

At that point, I called it a day.

In conclusion, it seems that the Pipo X7 is perfectly capable of supporting audio playback, even with upsampling enabled. As a matter of fact, I might keep it as a music transport.