Digital X-over project - diyAudio
Go Back   Home > Forums > Loudspeakers > Multi-Way

Multi-Way Conventional loudspeakers with crossovers

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 2nd July 2008, 03:54 PM   #1
borges is offline borges  Norway
diyAudio Member
 
Join Date: Dec 2003
Location: Oslo, Norway
Default Digital X-over project

Hi guys,

For some time now I have been working on a CD player project. It so happens that I'm using an FPGA and 4 fully separate DAC channels. So why not try to put a digital X-over into the thing!

But I've never built X-overs before. My experience is more on combined digital and analog filter design without speaker elements involved. So I need some feedback on what makes sense and what does not.

My initial design is as follows:
An 8x oversampler takes CD input samples gives me stereo data at 32bits / 352800 samples pr. second. The resolution at this stage is more or less arbitrary. It comes form the 16bit dynamic range of a CD and will eventually be dithered down to 24bit for the DACs.

Each of the stereo channels is passed through 2 X-over filters to produce L-hipass, L-lopass, R-hipass, R-lopass. I can make more filters but four is the number of analog outputs on the board. The four outputs will have separate digital volume control (0 to -6dB) to adjust for any gain differences between bass and treble. Master volume control will still be analog and external.

The X-overs themselves I imagine as 5th order IIR filters where the coefficients can be uploaded via RS232 on the fly. The coefficients are also 32bit, although the FPGA compiler can stretch a bit further. The output signal to be fed back in the IIRs is dithered down to 32 bits. I plan to use Direct Form I with parts from the Xilinx MAC core.

With digital IIRs it is possible to make X-overs where the hipass and lopass parts add to 1, and hence play back with linear phase. (Search for my previous posts.) But to do that the IIR itself needs higher order (5) than the resulting hipass and lopass (3). Hence generic 5th order digital IIR filters.

So to some questions:
1) Do you think 32 bit coefficients and feedback will do?
2) What types of filters would be interesting? Remember that bilinear transform may emulate Laplace filter equations that don't necessarily map into RCL structures.

My ultimate goal is to build a speaker with very simple and linear analog electronics (perhaps only DC blocking for the tweeter) and then use digital filters to make the whole setup linear phase.

What do you think?


Cheers,
Borge
  Reply With Quote
Old 2nd July 2008, 07:19 PM   #2
diyAudio Member
 
darkfenriz's Avatar
 
Join Date: Jun 2004
Location: Warsaw
Last time I (with my collegue) designed a FPGA filter I downloaded a free filter design software, which calculated everything to me. It was for video, so I used FIR design. I guess you can also use a FIR for lowpass and use subtraction to get hi-pass.

Hope this helps.

Regards
Adam
  Reply With Quote
Old 3rd July 2008, 01:27 AM   #3
diyAudio Member
 
Join Date: Mar 2003
Location: Mountain View, CA
Quote:
Originally posted by borges
An 8x oversampler takes CD input samples gives me stereo data at 32bits / 352800 samples pr. second.
More out of curiosity than anything, but how does your oversampler work? Is it an FIR oversampler with 16-bit coefficients, or are you dithering down to 32 bits after some other process?

Quote:
The four outputs will have separate digital volume control (0 to -6dB) to adjust for any gain differences between bass and treble. Master volume control will still be analog and external.
I will put in a recommendation here for an all-digital volume control. My rationale is described in this thread. There are some measurements from Post #75 onwards. Certainly not everybody in that thread was convinced, but I personally can't see any reason to ever use analogue volume control.

Quote:
The output signal to be fed back in the IIRs is dithered down to 32 bits. I plan to use Direct Form I with parts from the Xilinx MAC core.
Direct Form I is a good choice, in my opinion. For most applications, 32-bit feedback is probably fine. Note though that the 32-bit quantisation noise is also fed back, and subsequently boosted by the filter's poles; it is possible for it to breach the 24-bit noise floor. The effect gets worse as the filter's cutoff frequency goes down and/or as the Q is increased. However, unless you're using the filter for something like a subwoofer Linkwitz Transform or some other LF equalisation, it is unlikely to be a problem.

Quote:
With digital IIRs it is possible to make X-overs where the hipass and lopass parts add to 1, and hence play back with linear phase. (Search for my previous posts.) But to do that the IIR itself needs higher order (5) than the resulting hipass and lopass (3). Hence generic 5th order digital IIR filters.
This approach isn't something I've come across before. Sounds interesting, though. Can you give a little more detail on how this works? I couldn't find it in your previous posts.
Certainly, FIR filters are the "traditional" way of obtaining linear phase, and they give a lot of flexbility. Modern FPGAs are definitely powerful enough to implement reasonable-length FIR filters with no trouble.
__________________
Wingfeather
  Reply With Quote
Old 3rd July 2008, 11:30 AM   #4
borges is offline borges  Norway
diyAudio Member
 
Join Date: Dec 2003
Location: Oslo, Norway
Quote:
Originally posted by Wingfeather


More out of curiosity than anything, but how does your oversampler work? Is it an FIR oversampler with 16-bit coefficients, or are you dithering down to 32 bits after some other process?
The FIR I'm using now has been generated in Octave. It's more or less a standard windowed sinc. (Please, don't start a pre-echo discussion here. I'm interested in that too, but I'll initiate a separate thread.) The input data is CD 44.1/16bits. The coefficients have been rounded off to 32 bits. The FIR output is a hideous number of bits, where I choose to hold on to 32 of them for further processing. The DACs need 24, and anything above 16 is more details than in the source, anyway.

If I go above 35 bits for coefficients or indata, Xilinx starts needing more resources than 18x18 multipliers working in parallel. So that's sort of a hard limit. And the SPI I/O that uploads coefficients has been set to 32 bits. No hassle really to add another byte to the I/O and accomodate 35.....

Quote:

I will put in a recommendation here for an all-digital volume control. My rationale is described in this thread. There are some measurements from Post #75 onwards. Certainly not everybody in that thread was convinced, but I personally can't see any reason to ever use analogue volume control.
Okay, I plan to implement a volume control that uses 16 bit coefficients and then performs a 14-bit right-shift. That way 2^14 represents unity gain, and I have room to easily represent +- unity and go to +6dB on the upside. I haven't simulated the resolution of the volume control but believe it will be good enough for practical audio.

Quote:

Direct Form I is a good choice, in my opinion. For most applications, 32-bit feedback is probably fine. Note though that the 32-bit quantisation noise is also fed back, and subsequently boosted by the filter's poles; it is possible for it to breach the 24-bit noise floor. The effect gets worse as the filter's cutoff frequency goes down and/or as the Q is increased. However, unless you're using the filter for something like a subwoofer Linkwitz Transform or some other LF equalisation, it is unlikely to be a problem.
I plan to do pretty thorough simulation of the IIR. This is a place where I believe I may have to go to 35 bit feedback and coefficients.

Quote:

This approach isn't something I've come across before. Sounds interesting, though. Can you give a little more detail on how this works? I couldn't find it in your previous posts.
Certainly, FIR filters are the "traditional" way of obtaining linear phase, and they give a lot of flexbility. Modern FPGAs are definitely powerful enough to implement reasonable-length FIR filters with no trouble.
Here's my previous post:
New digital XO project

It's amazing what you can do with FPGAs. I used to work with Xilinx distributed arithmetic filters. But on June 27 they released version 4.0 of the FIR generator. Now I'm able to seriously upscale my FIR filters since the library uses the embedded multipliers on the chip. Just plug in what I want and it makes the hardware for me.

The trick, though, is still to develop the math behind the filters and coefficients. That's still an art. But it has become so much more fun now that the tools have improved.

I didin't plan on going brick-wall with the speaker outputs, even though that is possible with FIRs. I don't have a good reason to prefer IIRs, that's just a hunch.

Please let me know what you think of that previous post on linearizing the phase.


Cheers,
Borge
  Reply With Quote
Old 3rd July 2008, 03:35 PM   #5
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
linearizing the phase requires adding delay, something you get for free with an FIR. 10-20ms to do the job properly although you can get good results (minimum phase) with 5-10ms.

edit: you're thinking about a 2way right? so XO frequency is higher (>1KHz)? I was talking 3 way where midrange HP can be 200Hz or so. Wil you be correcting the drivers also?
  Reply With Quote
Old 3rd July 2008, 09:04 PM   #6
borges is offline borges  Norway
diyAudio Member
 
Join Date: Dec 2003
Location: Oslo, Norway
Sure, if I knew more about speakers, I'd try linearizing them too. As you saw in my previous post, I do consider using the natural poles of the speaker elements to build sum-to-unity IIRs.


Borge
  Reply With Quote
Old 4th July 2008, 12:38 AM   #7
diyAudio Member
 
Join Date: Mar 2003
Location: Mountain View, CA
Quote:
Originally posted by borges
The FIR output is a hideous number of bits, where I choose to hold on to 32 of them for further processing.
You know, I might be tempted to dither down to 32 bits here. Not that a 32-bit quantisation is really problematic on its own, but it might become so if subsequent filters are boosting things.

Quote:
Okay, I plan to implement a volume control that uses 16 bit coefficients and then performs a 14-bit right-shift.
What's the basic word-length, there? Are you operating on 32-bit audio samples (with a 48-bit intermediate result)? Be aware that the right shift will be a quantisation, and might have to be dithered if the word length is short.

Quote:
I plan to do pretty thorough simulation of the IIR. This is a place where I believe I may have to go to 35 bit feedback and coefficients.
Yeah, that's good. An extra couple of bits might help. In all likelihood though, 32-bit feedback will be fine for 24-bit output if the filters don't have low-frequency cutoffs.
In my own filters I've used 32-bit coefficients with double-precision feedback to yield 96-bit intermediate results. It's a bit overkill most of the time, admittedly, but keeps quantisation noise in the 32-bit filter below the 32-bit noise-floor for all feasible IIR designs (a cutoff of 1Hz and a Q of 30 was the toughest I tested), and can even be computed relatively efficiently.

Quote:
Here's my previous post:
I must admit I'm a little rusty with my Laplace at the mo, but I'm unsure of the meaning of T in your notation - since it's Laplace-domain, there's no notion of sample-rate yet, right? Also, bear in mind that the poles have to be in the left-half of the s-plane (inside the unit circle in the z-domain) for the filter to be stable, and so a totally arbitrary choice of transfer function isn't viable.
The approach looks interesting, though. I have yet to find the time to break out the pen and paper and see if I can come up with anything useful. I'll let you know when/if I can, and am definitely interested in anything good you can find.
__________________
Wingfeather
  Reply With Quote
Old 4th July 2008, 05:41 AM   #8
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
with a 5th order IIR as you spec'ed, I think you'll be OK with 32bit math. However, the 5th order IIR may not be sufficient to phase correct your crossover. As you increase the IIR filter order the math precision requirement increases to keep noise in control.

This is where your tricks may be patentable. I think this is why there isn't much advice on how to proceed here.
  Reply With Quote
Old 4th July 2008, 07:32 AM   #9
borges is offline borges  Norway
diyAudio Member
 
Join Date: Dec 2003
Location: Oslo, Norway
Quote:
Originally posted by Iain McNeill
This is where your tricks may be patentable. I think this is why there isn't much advice on how to proceed here.

It's not really that patentable after I put it in public view on diyAudio :-)

It might be in the US, where I believe you can publish up to a year before patenting. I did think about patenting the trick, but it's a tricky kind of investment and also hard to patent algorithms and equations.
  Reply With Quote
Old 4th July 2008, 07:39 AM   #10
borges is offline borges  Norway
diyAudio Member
 
Join Date: Dec 2003
Location: Oslo, Norway
Quote:
Originally posted by Wingfeather


You know, I might be tempted to dither down to 32 bits here. Not that a 32-bit quantisation is really problematic on its own, but it might become so if subsequent filters are boosting things.
Oh, certainly. I'm dithering wherever there is quantization going on. If the IIR approach makes sense, I'll first dither to 32 bits in the FIR, then to 32 or 35 for feedback and output in the IIR, then apply the 16-bit volume control, and finally dither to the DAC's 24 bits.

And the T in my equations is \tau, the time contsant. Let me know if the equations make sense. What I do is to use a very bengn set of poles (denominator being (Ts+1)^3 or (Ts+1)^5 ) and do weird things with the numerators (zeros). I did try designing some custom poles, and took a big trip down unstability lane!


Borge
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone interested in a digital amplifier project? Rookie Class D 552 24th September 2014 08:29 PM
New digital XO project borges Multi-Way 2 8th January 2008 06:49 PM
digital volume pot project digi01 Digital Source 172 27th August 2005 01:31 PM
AC3 - Dolby digital project ksprul Digital Source 3 2nd July 2004 01:14 PM


New To Site? Need Help?

All times are GMT. The time now is 04:15 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2