Category Archives: audio software

No, your VST plugin will not run on a cheap DSP.

Rant incoming.

Back in my uni days, I was a professor’s assistant teaching practical courses. A student came by to ask for a second power supply (each desk had one). Instead of giving him one which would be the easy thing, I asked why he needed it.

“I need split rail supplies” he answered.

Round 2. Why do you need split power rails?

“I need to supply an opamp”

(Yes, I know you can do that just fine with single supply. But I don’t think we’re there yet.)

Round 3… Why do you need an opamp?

“I want to light up an LED.”


Obviously, he walked away with the transistor he needed rather than the supply he asked for. Probably not happy with that annoying professor’s assistant and his pesky questioning. That was a lesson for him and for me: don’t expect gratitude even when you try to help people.

Fast-forward 20 years. Hello, grey hairs. Goodbye, slim waist.

What is better for [insert algorithm], a PC or a DSP?

The term DSP gets thrown around very easily because the world has gone digital and everything needs processing. We live in such a gluttony of resources that I’m sitting here with an 8-core i7 machine running 3.6 GHz just so that I can stare at a cursor blinking 0.5 Hz and enter some text. How this is legal still baffles me. And somehow we have even convinced ourselves this is normal. In fact, we have come to expect it and this is why people who work on embedded systems (like me) are running into problems we never expected – unreasonably unreasonable requirements.

“So, why use a puny SigmaDSP, Blackfin, Sharc, Cortex M4/FPU, XMOS, TMS320, etc etc when you have a great PC standing on your desk?”

PCembedded DSP
Raw clock cyclesseveral GHz1 – 500 MHz
Cores1-321-2 with dedicated peripherals
for specialized functions
Memorycheap and plentyexpensive and limited
Programmingalmost too easy

Design abstracting tools such as
Pure data, MATLAB (R)(TM)(WTF),
python widely available
at least knowledge of algorithmic
optimization required

for optimal results knowledge
of software layers, C coding

for bleeding edge intimate
knowledge of target processor
and machine assembly coding.
Timing accuracy and latencynot much below 5 ms, results
vary with hardware and OS load
guaranteed sample accurate, <1 ms,
down to a few ns on specialized
Code density (aka MIPS per MHz)mostly NOPsmedium on a framework / HAL
high when bare metal C
insane when assembly optimized
Code power (aka MIPS per mW)~1 GFlops for 100 W =
10 MFLops/W
450 MFlops/W (ADSP-SC589
excluding HW accelerators)
1893 DMIPS/W (STM32F446)

Code cost (aka MIPS per $)~ 1 GFlops for $1000 =
900 MFlops / $36 = 25 MFlops/$
(ADSP-SC589excluding HW accelerators)
225 DMIPS / $6 = 37.5 DMIPS/$

The table above should yield a bit of insight. Even though I’ve pulled some of these numbers out of thin air, at least it indicates to roughly order of magnitude. It appears that when you need an algorithm application optimized for cost, power and efficiency (aka a product), you are going to need a embedded system of some sort. If you want to quickly develop a proof of concept and you have a PC standing around (who doesn’t?) then that is the obvious way to go.

Now comes the inevitable. Fancy schmancy algorithm XYZ is quickly developed on a PC and demonstrated successfully to customers, product managers and perhaps worst of all, investors. And the story is sold on the byline ‘“we just need a swift porting onto a DSP to go-to-market” and that is when the consultant’s phone rings.

“Can you just quickly throw this 16,000 tap FIR running at 192 kHz on a $5 DSP? Can you have it done in two weeks? That’s what we promised our investors.

If I haven’t hung up on you at this point, I will try to understand what you want before trying to figure out how to give you what you are asking for. Because after resolving the physical impossibilities and getting you to make up your mind whether to go over budget, spec, time planning or all of the above you still will end up with a very sub-optimal solution.

Embedded DSP designs are fundamentally different from PC algorithms.

That means, there is no porting an sich but rather a redesign. Your proof of concept is just that, and as smoothly as it runs on a quad i9-9900K, it needs 2GB of memory and 80% CPU, latency is anywhere from 200-800 ms and why on God’s green earth do you need 16,000 FIR taps at 192k to make a shelving filter at 85 Hz? The answer is without fault the same every time:

“We are doing something unique that we can’t disclose, so it has to be this way.”

OK, good luck building it yourself.

However if you want, I can give you the transistor and I will explain why that is by far a superior solution for your LED.

Here’s the takeaway: there is nothing wrong with running DSP on a PC. The thing is there anyway, easy to configure, no programming required so the creative souls can run free, sip their lattes and point-and-click something together. But when the end target is an embedded product at a certain [power, price, performance latency, project time line] constellation, you need to involve an embedded expert from the start. A non-optimized “secret sauce” algorithm, running on hardware tweaked out to the point of counting assembly instructions just to make it work, is at best sub-optimal and an affront to the hard-working DSP designer, at worst a nightmare from hell for the developers, project managers, customers, investors and in the end, the promising company. But hey- you get to keep your unique idea… all to yourself.

Arduino software control for WM8804/WM8805

WM8804 application board (eBay) modified to output CLKOUT pin (yellow-black wire)

Recently I needed a special type of I2S signal, namely a 4 signal set of DATA, BCLK, FCLK and also an MCLK of 49.152 MHz.

Many modern DACs, DSPs and digital power amplifiers need this high clock frequency. And of course you would want this signal to be synchronous to the Frame Clock such that the converter has a fixed number of MCLK per FCLK cycles so as to minimize jitter.

Many S/PDIF receivers implement a fixed clocking in hardware mode which limits your options and flexibility, so it is worth exploring software control. It is really not so hard. Continue reading

AKM AK4393

The following measurements were taken with an M-audio Delta 1010 sound card, using channels 7 and 8. These cards have an AKM AK4393 D/A converter. The M-audio has an otherwise fault-free design and is a great converter for the price.

Input was S/PDIF, output balanced -4 dBV.

I’m dropping the raw measurements here with little comments as long as the results are in line with what you’d expect from a device like this, since I’m mostly interested in the IMD measurements, after the last postContinue reading

The Case for Digital Volume Control

Many audio systems are at least partly analogue, i.e. there are analogue sources and there is an analogue pre- or power amplifier. However, it is becoming more and more often the case that there are no analogue sources at all, or that due to the presence of a DSP in the system, all analogue inputs are converted to digital.

In the case where your audio system is primarily digital, many people still swear by analogue volume control. And I don’t really get it – I have never understood the reasons quoted for doing so, and the added complexity (not to mention more components in the signal path!) is just cumbersome. Even colleagues whom I regard to be absolute geniuses and designed some of the world’s best D/A converter chips could not convince me why this would be a good solution.

So, I’m going to put a stake in the ground here and open the floor to what I expect will be a massive flame war. Bring it on… Continue reading

The Ultranalyzer

As you may have noticed, there’s not much audio content here yet. That’s because I’m currently not only bubbling with ideas, but also working without good tools. So before we design anything, we need to have the right tools in order.

Priority one was a useful desk scope / multimeter: check.
Priority two is a spectrum / audio analyzer.

Now I actually do own one, I never threw away my trusty Spectral Dynamics SD375 . But as with my big Tektronix o’scope, it’s a bit of a boat anchor to keep around the house. So rest assured both of these are safely in storage, and I’m busy training my son to appreciate them so he can inherit and care for them one day hopefully far from today.

I’ve been scouting for an Audio Precision on eBay a bit, but without much success. I’m not ready to shell out thousands of bucks for something that is extremely cool, but still flawed. You see, the one thing an AP has going for it is credibility. You show any old weird curve and as long as it has the AP logo on the right hand top corner, you’re golden. And let’s not forget the bragging rights. “Yeah sure, I’ve got an AP at home” – gets all the girls!

But foregoing that, it has to be admitted that especially the system one machines are showing their age. The user interface runs under DOS or windows 98. Wow. forget attaching an internet enabled network cable to those beasts.
AP themselves do not recommend buying one. Of course if I was selling system twos, I’d also recommend against buying a machine I’m no longer selling. But they do have a point: there is some custom hardware in there and when that breaks, you’re done for. No support, no parts.

Reflecting on all of that for a bit, I pondered what the alternative could be. A good sound card with a PC sounds like the logical choice. A quick inventory actually turned up some quite decent parts:


  • M-audio Delta 1010. One of my favourite sound cards. I can safely say that now that I have gathered at least enough of them for my own use. I scoured them in parts, buying the cards and the break-out boxes separately, and built internal power supplies in each of them. SNR is around 110 dB which is very good but of course not stellar. However for distortion it’s more than enough, and if it is about finding noise floors all I have to add is a low noise preamp. The Delta range is excellently supported under both windows and linux, and built for heavy duty use (some clearly showing signs of it).  At least a 15 year production run with minimal changes shows that this was a very good basic design. There are some potential tweaks that I’m sure will show up here one day, but as a rule of thumb you cannot go wrong with this card and for the (used) price, it’s simply a winner.
  • VIA EVCM-F mini-ITX motherboard with a 1 GHz CPU and a VT8235M chipset. It seems they were made for POS (point-of-sale aka cash registers) and I do agree about the POS part. I bought this off eBay hundreds of years ago. Unfortunately I could only find a 256MB stick of RAM but bigger ones should cost pennies if I’m feeling frisky to supercharge this beast.  I don’t even know the original purpose I had for it anymore (I think it did have to do something with a Delta card), but the great thing is it runs warm but not hot with just a few small heat sinks. Together with a 12V power supply adapter fed from a laptop brick and a compact flash to PATA adapter with a 4GB Sandisk extreme III card it is quiet. Quiet as in SILENT. Your move, Audio Precision.

slow but cool

VIA itx system

That should do it! As slow as this junk hardware is, it probably runs circles around the machines that AP had to work with. The downside is of course that this box will have to do all the heavy analysis (FFT, deconvolution, averaging, etc) lifting. Well, it’s an experiment.


Even though there are a few very nice audio analysis programs for windows, this box is going to run linux. No discussion. Hobby is supposed to be fun, not torture.
Due to the limited hardware capabilities it would have to be a pretty small foot print version, but at the same time it would have to be able to run some exotic software. That led me to Archlinux. Their modular design and custom package manager ticks the right boxes, and the support on their wiki is just stellar.
Getting Arch to run was easy enough. One hiccup was that the disk was formatted as a GPT partition and syslinux is not a good bootloader for that. At least I could not get it to run. GRUB2 did just fine and in just a few hours I had a running machine. Less time than a fresh windows install needs to pull in its 8,000 updates.

The window manager is LXDE, but mostly I’ll be logging in over SSH with X forwarding so just X11 would have been enough. The screenshots below are made on an Ubuntu machine using X11 forwarding.

Jack Alsa Audio Analyzer

Jack Alsa Audio Analyzer

The first analysis programs I installed are Jaaa and baudline. More on that in a subsequent post. It’s not exactly APone style functionality yet, but at least jaaa and japa are open source and that means what you don’t have, you can build. In this case it is unfortunately true that I only trust AP to do a proper implementation, and all others have to be open source and if not, I guess I have little choice but to lead the way. This story is just beginning…



All in all, spending a day or so installing some very nice software and re-using dust-gathering equipment now means I can do some pretty impressive and reproducible measurements. As soon as I’ve cleared my desk and built this all into some enclosure…