Audio Processing in Interpreted Languages

It’s no surprise that today’s computer programs are getting bigger and more complex. CPU and memory are now in available in a way they never were before. A quick glance at the Raspberry Pi gaining dust in the corner of the room and you’re looking at something that could outperform the systems I learned on all those decades ago.

It’s this world that I’ve started my latest project in – writing a software audio processor. I know there’s already a fair few out there but I’ve got my own twist to add. Oh, and besides, it seemed a more interesting challenge than the usual playout systems you’ll see most engineers write. Not that I totally didn’t write AllDay DJ a few years back nor did it contribute to my Advanced Higher Computing qualification. 😉

With the challenge set and a bucket load of naivety (well, it is supposed to be a learning exercise), I started coding… in Python. Yes, I fully understand that performance is the order of the day in DSP. However, with today’s computer power available, it should be possible to perform real-time audio processing in an interpreted language?

On that basis, and with some hints from a few articles, I wrote a simple audio limiter in pure Python. Well, I say simple, it’s got a buffer in there as well to allow for lookahead.

While the code does work, I can’t say the “remix” version of every song you pass through the processor in “real time” goes down well in the home. Nor is the single core being run at 100% to achieve this a good thing. I could try parallelising the task but it’s a simple limiter would be very difficult to achieve this with.

It turns out I’m not the only person trying this stuff out. A blog post from 2012 talks about achieving the result though the use of Cython. While it does work, it somewhat kills the reason for using an interpreted language if C code needs to be compiled.

On that note, it looks like I’ll be dusting off the old C knowledge from university (who has lectures on that at 8am?!?) and maybe even branching into the odd world of C++. Let’s hope it’s a little more sane than Objective C…

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *