DIY DSP for Digital Room Correction

This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Continuing on from page 3, post 56 of the "DIY Digital Parametric EQ" thread....

Hi all,

(I wanted to start a thread here so as not to hijack the Parametric EQ thread with my ramblings)....

Kevin_Murray said:
First of all hello everyone, this is my first post to this forum.:) I was very happy to find this thread because I'm planning a project of this type myself. I haven't even entered the design phase yet because I'm in the middle of a speaker project (TL, another great reason to be a member here) and well... the busy Christmas season will be here soon anyway.

OzOne: is this something you'd be interested in?
It's for a PC but could help you get started. Near the bottom are links to digital filter generators and other useful stuff.

Mark, good progress! Hope you get the bugs worked out soon. Anyone else completed or currently working on a digital crossover/EQ project? I'm looking for collaborators. A year ago I took a job with a company specializing in embedded processing (which has taken me back to all the schooling in DSP that I've forgotten).:rolleyes: This is primarily why I'm interested in pursuing a mostly digital signal path, I've now got the tools to do it effectively. When (and if) I finish I plan to post all my info, code, schematics and PCB artwork online for anyone interested to see. I'm a firm believer in sharing knowledge.



@Kevin - I've been using PC based DRC for a few years now, and I've used ACXO Player etc. a few times. I'm currently using Denis Sbragion's DRC to generate the filters (as does ACXO), but the main goal is to try to get away from using a PC at all....

Firstly, I've got major problems with ASIO playback on my new Quad Core system - I have a nasty audio glitch which happens every 25 seconds or so (this can be 50 seconds, or 12 seconds etc. depending on the latency / buffer setting.)....

Although I have HD-DVD on the PC, and do use it to output to the projector, it would be great to have the amp perform the usual DD / DTS / THX processing and have DRC applied on the speakers at all times (with a choice of house curves / XO's etc.)

It seems that it would be much better to do everything in the digital realm rather than getting a sound card with 6 or 8 inputs, then having so many ADC / DAC conversions. Also, many integrated amps won't output audio from the internal decoder while allowing external inputs simultaneously.

Unless you encode back to AC3 or DTS again after DRC has been applied on the PC, you generally have to connect to the amp via analog cables. I my case, this would mean four or more 5-metre cables, probable noise problems, and ground loop issues etc. (I can't even get AC3 / DTS passthrough to work atm.)

All these issues mean that although DRC is still a HUGE improvement, there are often lots of unneccesary ADC / DAC conversions in the loop, and the practical hassles of using PC's takes some of the enjoyment out of things.

The other big reason I'm looking into a DSP project is simply for the learning experience and the fact that I can't find a commercial solution that's remotely affordable compared to a PC. I think it would be a hugely rewarding project, and I'd love to start programming a nice LCD UI and adding features.

Then again, as far as I've been told, it does take a large amount of processing power to compute the FIR filters.....

eg. if MACs = (filter length in samples) * (sample rate), then for a single 50ms filter at 48KHz, it would need 115,200,000 MACs !!!

Is this just the case for raw computation, or are there ways of partitioning the filter algorithms? As you can tell, I don't have much idea when it comes to DSPs, but I'm hungry to learn. I have a fair amount of experience with FPGA programming - would an FPGA be a better choice?

Most of it can be done with open source software....

I use rec_imp (part of DRC) to record the log sweeps from each speaker and extract the speaker / room impulses. Then DRC itself is used to create the correction filters....

The filters are then loaded into either Voxengo Pristine Space (commercial) or you could use ConvolverVST instead (open source) to run the filters on. ConvolverVST is a tad trickier to set up on first use, but still good.

Pristine Space or ConvolverVST can run under VSTHost (open source), or in Console (commercial).

The main thing is having a sound card with drivers which can route everything from Windows (WDM / MME) through VSTHost, then from VSTHost out to the speakers via ASIO.

Or, you could use something like Virtual Audio Cable (must be registered I think, source code can be purchased?) which should work with most sound cards.

So basically, DRC / ConvolverVST / VSTHost are all open source. All you would need then is a method for passing the audio through VSTHost or a sound card which supports DirectWIRE etc.
OzOnE_2k3 said:

Firstly, I've got major problems with ASIO playback on my new Quad Core system - I have a nasty audio glitch which happens every 25 seconds or so (this can be 50 seconds, or 12 seconds etc. depending on the latency / buffer setting.)....


Which sound card are you using?

Are you trying to play music from hard drive?

I discovered an interaction between PCI hard drive controller and sound card which caused glitches on my Windows XP based system.

I also found that simple IIR filters are much less intense for a PC than FIR.

And mostly, I found that things like antivirus programs can really effect audio.

I am using a Quad Core system with RME sound cards and IIR style filters with no problems provided I don't play music while the hard drive is running.

I will say that I've been looking for a non PC (Windows or Linux) solution to FIR/IIR filtering for years.

A DIY version of the Behringer DCX2496 is what I'd like.
Something where you have a choice between IIR or FIR filters.

Something where instead of buying an expensive sound card, it includes reasonably good DAC's.
Hi, Daveis,

Nice to see that you're like-minded when it comes to a non-PC solution!....

I'm using an Audiotrak Prodigy HiFi 7.1 sound card atm. I don't think I had any glitches when it was running on my older HTPC (Athlon XP 2800+). The new PC is a Quad (Q6600) and I've also heard that SATA or IDE controllers can be a common cause of audio problems.

I actually have the hard drive and DVD writer on the same IDE channel (yes, I should know better, I'm a PC engineer!), but I have to backup some files on my SATA drives before I can get my RAID setup running on here again. With any luck, using SATA alone might help (probably unlikely though.)

The glitch I get is always within the same period of time (around 25 seconds with the Audiotrak buffer set to 512 samples). It only happens on the ASIO output and does not seem to get recorded when looping ASIO back to WDM (using DirectWIRE). Some of the Audiotrak drivers are terrible (I've tried every version I could), which is a shame because the DirectWIRE feature is something I'd hate to be without now.

I know most of the high end audio cards can loop signals back digitally etc., but I've invested a fair amount in this stuff already, and would rather ditch the PC for the filtering side of things altogether. However, if I didn't have these glitch problems, I would gladly go ahead and add the 8-channel muxit interface to the card and my amp.

All I really need to know is how much power is actually needed as a guide to if it's even cost effective to use a DSP or FPGA? Is it worth me trying to hail a DSP guru?


Edit: Yes, I play all music from the hard drive (MP3's atm, or DivX / DVD / HD-DVD).

Also, with a stand-alone unit my aim would be to bypass the multiple ADC / DAC conversions altogether, and only ever have the one set of DACs before the power amps. (or even use digital amps.)

I don't mind if it runs Linux or something similar (eg. Blackfin) as long as it has enough power, but without it costing more than a basic PC....

I think this is going to be the main challenge because a basic PC for running 6-8 channels of FIR filters with a cheap I2S modded sound card can be brought for much less than £180 nowadays.

I like the idea of SHARC / Blackfin DSPs simply because they are used so commonly in AV amps etc. and seem to be geared toward audio processing.

But, if I only knew how to calculate the power needed and what the raw algorithm is, I could start playing with my basic FPGA dev board....

As far as I understand it - the number of taps you have is simply the filter length (in samples), the calculation basically shifts the incoming audio bits through each "tap", it then multiplies each of the "tap samples" with the corresponding sample from the filter itself. (although the filter's bits are reversed before loading.). The results are then summed, then, erm, something else happens! (magic dust?)

The problem is, the DSP / processor has to be fast enough to multiply all the taps at once (at the sample rate), which results in needing a massive number of multiplications per second.

(Even if the sample rate was 48KHz initially, I would happily use a DSP box in place of the PC. The thing is, it would be nice to have 6 or possibly 8 channels of filtering.)

A while back I purchased a dspstak 21261zx - c96k46 ADSP-21261 Cyclone DSP and FPGA Eval Package.

I think it was like $300 and took weeks to get.

I never did anything with it because:

a) Needed 8 channels of 24/96
b) Getting everyone to agree on a DSP platform to work on is hard.

this post here might worth reading. I know there is another thread on the same subject on The previous version of this project is described here and is having somewhere here on this forum a separate thread as it has on too a separate one. Plenty of informations on these 4 threads.

As you might see, comercial hardware solutions have some shortcomings for this kind of implementation. (specially when including the price in the equation). The need for sufficient procesing power, memory space and large number of I/O, while keeping the costs and the heat/EMI interferences low triggerd the need for a diy hardware solution.

This kind of dsp/crossover, whith all the hard number crunching taking part in the computer while the DACs are totaly isolated from the PC is what we would really need.
Taking this thread back to a non-PC solution...

Daveis: I see the ADSP-21261 is part of the Sharc family of processors which I think are used in the DCX2496. Is this why you went in that direction? Did you get anywhere? If you no longer want/have use for the development kit I'd be interested in buying it.

OzOne: The Blackfin is a superb processor. I read about one commercial Audio Processor that uses two Blackfins to get the job done. Obviously things get extremely expensive at that point. I think in order for this project to work (regarding price and development time) it will have to rely heavily on open source code and the experience of people who have already been down this road. After doing some online research I think much of the information and code is available, though some may be for a different platform. I'm still 100% interested in this project and I'll call on anyone else who has DSP experience to chime in. Even if only to give me a pat on the head :)

Everyone: Please post any links you know of to code or information on audio DSP. In particular for the Sharc family of processors since this is the direction I'm leaning at the moment. Before someone points it out, I'm aware a DSP developement kit alone will cost more than a Behringer DCX2496. I'm willing to absorb that to get a solution for everyone.

Time to get the ball rolling on a non-PC solution.
Sorry slightly OT, my current PC based system to do DRC:
- old PC with 500MHz PIII with 512MB RAM, + HD + ...
- Terratec Aureon 7.1 Space (Envy24HT - spdif in and out - spdif in can be used for external synch)
- linux kernel 2.6.(don't remember - i' am at work now) recompiled for low latency
- jack
- brutefir
- DRC to calculate coefficients filter for brutefir after measuring my audio set + room.
The interesting thing about this system is that with such an old PC brutefir apply the filter with 32768 taps in realtime using only 20% of the CPU.

I can certainly understand the desire for a non-PC approach to DSP, but it's never really caught on in these forums. I think there are a bunch of contributing reasons

- specialized skill set - not many high-level DSP programmers hang out here
- specialized hardware; moving beyond the use of EVM/DevKit packages is highly non-trivial
- timelines - hobby stuff moves relatively slowly, and staying current with the hardware tech can be a challenge
- horsepower. If all you want is IIR filters, modding a DCX2496 is way easier than building from scratch. OTOH, a single DSP chip will be very hard-pressed to handle high-rate multi-channel FIR filters without some serious programming (see point 1)
- you still need all the other stuff like good DACs, volume control etc

I started off years ago on Motorols DSP56k dev kits, and quite happily bailed out the day I discovered BruteFIR. IMHO the downsides of the PC approach are outweighed by the convenience and flexibility.

I do think that peufeu's ethernet/fpga/I2S project holds the promise of the best of both worlds - PC flexibility on the software side with somewhat more conventional hardware that "should" be easier to optimize than a PC approach. It seems to have stalled for the moment, though.
Re: Taking this thread back to a non-PC solution...

Kevin_Murray said:
Daveis: I see the ADSP-21261 is part of the Sharc family of processors which I think are used in the DCX2496. Is this why you went in that direction? Did you get anywhere? If you no longer want/have use for the development kit I'd be interested in buying it.

I followed a forum link about someone wanting to do audio processing with DSP. Yes, I recognized the chips as being similar to DCX2496 (which I previously used). I discussed with engineers at Dansville to see if it was in the ballpark of the processing power I needed. I think at the time I just wanted a 2-way stereo crossover.
I'll go look for the manual and board. It may take a while to find it all.

About the same time, I became aware of Voxengo Pristine Space convolver, brutefir, and Thuneau's IIR.

I went down the road of Windows PC, good sound card (RME), good external DAC's.

The cost in amps and DAC's has been significant. And I am stuck with only a stereo system that doesn't interface with my HD DVD player. (at least not without an A/D conversion) And I misuse a 6.1 multi-channel receiver as volume control. And I have cables running out to the living room littering things.

DRC by itself, however, seems a much more compelling use of DSP's.
You are talking just an FIR convolver for maybe one or two channels at a time.

I think it's when you add crossover functions into the mix that DSP becomes unwieldy due to the number of channels involved.
Hi all,

@sunra - I looked into peufeu's project some time ago - it looks great, but I think the main aim of it was to separate the PC side more from the audio / DAC side to isolate noise, buffer the data etc.

@all - Although I'm still very much interested in at least working out if this project would be feasible, I can see how the costs could quickly add up etc. This has got me thinking about the PC approach again because the improvement I've had from using DRC is huge.

Atm, I don't have the PC hooked up for 7.1 due to moving rooms and upgrading the PC. The issue is that there's no easy was to use the AV amp as normal, then apply DRC to all channels (ie. I can't use the DD / DTS / PLII / THX processing on the amp, then apply DRC to the speakers.)

Then again, DRC addresses one of the main features that THX processing addresses - re-equalization. Because of this, enabling THX while using a standard house curve via DRC would probably take too much treble off.

Really, it all comes down to the practicalities of using a PC for constant listening. Also because I hate having analog connections to the amp and it would be fantastic to use I2S links directly (especially after reading Brian Brown's thread about the muxit interface.).....

@anbello - how does your system handle external 5.1 / 7.1 inputs? Or do you use the PC as the DVD player? Or, are you mainly using it for 2 channel audio?

@dwk123 - if you're interested in having an I2S link to more conventional DACs, I would highly recommend modding a sound card with a muxit interface (for 2 channel and full 5.1 / 7.1). I haven't got round to testing this myself yet, but fully intend to soon. (edit: forgot you are already using equibit amps etc. I'm guessing you're way past the I2S point - ignore this part! :xeye: )

@solve - I can't use asio4all because of the way I loop Windows audio through VSTHost using the Audiotrak drivers. eg....

Winamp > drivers (WDM to ASIO IN) > VSTHost > ASIO out to speakers.

...If I used asio4all, it would try to play the audio through WDM again, which is effectively already in use for the "incoming" audio from Winamp / Windows apps.

What I'm trying to get away from is having these glitch problems with the audio and chaging more towards a great project we can bolt bits onto and start programming / learning with. This would also allow people to add better DACs (if going the analog route) and add features.

(I'm pretty good with PIC chips / FPGAs, but useless with C++ / Windoze / Linux programming, so I'd personally love to mess around with DSP chips / LCD screens / I2S etc.)

We basically need a DSP guru to tell us if this project is achievable without costing more than a Beatles court case! :)


Edit: Almost forgot - here's another example of how expensive these things can be.....

Interestingly, to use this for DRC, you have to measure the room's response first, send the data off to the manufacturer, then have them send the correction info back - I can already do all this myself with open-source software! Again, another advantage of having our own unit.

Surely there must be many manufacturers missing out on a big market share? I'm sure plenty of people would be interested in a resonably priced DRC solution to add to their home theater / hifi setups?
This is what I suspected. Fortunately this project relates to my job so in time it will happen (plus I'm stubborn). Regarding keeping current, I'm finding out just how much has changed since I've been away from DSP. There is some impressive hardware available now, though it's making choosing a platform more difficult :)

I expect I will be doing nothing but reading through the new year. I hadn't planned on determining a hardware configuration till the end of January. Initially I had planned on just a crossover and maybe delay added in. I think that parameteric eq wouldn't be too hard to integrate with DRC the ultimate goal. I see that some people are interested in 6-8 channel DSP which is a processing nightmare, unless going to multiple hardware paths. Maybe a feature wishlist would help to generate a block diagram which would then help determine hardware requirements?

Food for thought:
Hello, I think you guys missed the bandwagon, there were Xilinx Virtex4 ml402 devkits on ebay for months, for laughable 200-250 usd with lvds io. Afaik the debugger for the ADSP sharc is not free like the xilinx webpack , only for x days with the Ev-kit, then restricted mode.

I have a Lynx AES -16 ( similar to RME aes-32 ) and i want to use it as digital crossover too. Basically all i want to see in relation to the pc case is xlr cables. Ive yet to plug the soundcard in, but I know it shows up as 8 2in 2 out audio drivers. The winamp -> VST route is what i want to do, and just reroute the filtered audio to a pair of XLR's. BTW, any monoblock ideas to power hi-eff (95.4 dB) JBL 15 inchers?
I've just ordered up a Analog Devices 21262 EZ dev board. I'm a hardware & C/C++ guy looking to add DSP chops to my resume. I am looking for a good audio project to learn on. Maybe this is it. I've never worked with the AD DSP software tools. Are they any good? How about open source and freeware tools and libraries? What's out there?

Best Regards,
Carl Huff
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.