Welcome, Guest
Username: Password: Remember me

TOPIC: Re: Digital crossover for my WMTMW speakers

Digital crossover for my WMTMW speakers 7 years 10 months ago #4472

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
Hi,

The topic of this is the implementation of active crossovers for my 3-way WMTMW loudspeakers and continues this thread.

Jakster wrote:
I just read through this thread again and I guess I wrote a little fast and didn´t read your entire posts - sorry about that.

WMTMW it is and apparently it is possible to do this using IIR BIQUADS (however finding the allpass IIR filter (reverse phase filter) for each of your biquads and speaker response might not be trivial). I would still leave the whole IIR filter world and enter the FIR world, and thereby discard using the miniDSP.

I haven´t really started using Scilab yet - I used to work in matlab but since I can´t afford the licence I am going to start using scilab. Scilab should be able to create the filters you need, but if you´re not accostumed to matlab and digital signal processing in general, there is a steep learning curve (windowing, fft, ifft etc). I don´t know your theoretical background so if this in any way sounds patronizing, its not my intension - I just want to make sure that you understand that you need to design the filters from scratch - not via "point and drag" interfaces such as acourate. You also need another program to do the measuring of acoustic responses (fx holmimpulse or REW).


As you say you need your filter (IIR or FIR) combined with the acoustic response of your speaker unit to give the desired linear phase crossover response at depicted in your post. I´ve done this previosly and if I remember correctly we used a wiener filter (en.wikipedia.org/wiki/Wiener_filter) - though we used a different target response.

I have not created "arbitrary linear phase responses" (target functions), so I can´t give you much advice in this direction, other than it´s probably done in frequency domain and inverse fftéd.

regarding brutefir - I think Acourate has a brutefir usb linux version for free download (but it´s probably the same one as you saw). What kind of soundcard will you be using??

Amazing looking speakers by the way - a lot prettier than what I´ve got.

Thank you again Jakster :)

Well, I have a background in physics so I have some basic understanding of FFT etc. and did some work in Matlab a couple of years ago. As I said earlier, I have no experience with DSP so I'll certainly need some help from you guys! ;)

I also have all equipment needed for acoustic measurements (which I used a lot during the construction of my speakers).

Just to see if I understand this right: filtering with FIR is a convolution of the input signal with a filter kernel that is a vector of coefficients. If this vector is symmetric about the center, the kernel itself will not affect the phase characteristics (other than delay). So, in order to make a linear phase acoustic response, the kernel should not be symmetric - it should produce a phase response that is opposite to the speaker phase itself. By importing the response data and target data, maybe a kernel can be calculated iteratively by fitting the convoluted response to the target response?
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4479

  • Jakster
  • Jakster's Avatar
  • Offline
  • Junior Boarder
  • Posts: 24
  • Thank you received: 4
  • Karma: 3
Just to see if I understand this right: filtering with FIR is a convolution of the input signal with a filter kernel that is a vector of coefficients.
Correct, for each output Y[n] filtervector G[1]....G[filterlength] is multiplied with signalvector X[n]....X[n-filterlength], vectorsum equals Y[n].
If this vector is symmetric about the center, the kernel itself will not affect the phase characteristics (other than delay).
Correct
So, in order to make a linear phase acoustic response, the kernel should not be symmetric - it should produce a phase response that is opposite to the speaker phase itself.
Correct (opposite speaker phase + pure delay), and to me and important design parameter, I see a lot of diy loudspeaker projects (passive, active and digital) discarding speaker units level and phase correction by placing a std. LR crossover somewhere in the overlap of the two units. Probably because most of the available litterature deals with theoretical crossovers with perfect speakerunits.
By importing the response data and target data, maybe a kernel can be calculated iteratively by fitting the convoluted response to the target response?
Yes, though I think you can do it iteratively and "non-iteratively"
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4483

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
Yes, it should be non-iteratively (much simpler). I am looking on one algorithm right now, looks very easy actually (not sure that it works yet though):

Define the sampling frequency and filter length
Define what filter response you want (ideal filter) and input this as a vector
Do IFFT of this to get the corresponding impulse response
Window this (for example with a Hanning window)- and there is the coefficient vector you are looking for!

Does it look reasonable?
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4487

  • curryman
  • curryman's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 791
  • Thank you received: 181
  • Karma: 100
The general procedure looks resonable.
Filter development (inverse speaker response + crossover) can be done in frequency domain (complex of course) and then transferred to time domain (IFFT -> impulse response).
However the exact implementation can be very tricky ;) Are you working with matlab now? Do you have access to any toolboxes (signal processing toolbox helps a lot).
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4497

  • Jakster
  • Jakster's Avatar
  • Offline
  • Junior Boarder
  • Posts: 24
  • Thank you received: 4
  • Karma: 3
Agree with Curryman, and be prepared to try numeorous ways in search of "the perfect correction filter".

See Horbach and Keele part 1 for their method: corr. filter = ifft( Hcrossover/fft(driverresponse))

You probably need to try different approaches in both time an frequency (convolution in time = multiplication in frequency and deconvolution = division) and always check time and frequency response of your correction filter before applying it to your speaker.

I would probably start like this (simplified):

-Measure speaker unit impulse responses (you have that).
-Create target curve using in frequency domain (only magnitude)
-Transform target curve to linear phase impulse response (using Parks-McClellan for matlab www.mathworks.se/help/toolbox/signal/ref/firpm.html or remez function in Scilab)
- Create correction filter by using wiener filter og LMS in time domain (en.wikipedia.org/wiki/Similarities_between_Wiener_and_LMS)

I really hope you continue down this path and share your progress in this thread - maybe even share some of the Scilab code.

Only because I remember using the wiener filter and because I think I had problems while doing this in the frequency domain (I´m not exactly sure, but I think the IFFT(correctionfilter) I did once resulted in complex numbers in time domain. Please note that I haven´t been doing any signal processing for a long time, so this is all based on "what I think I remember" - I hope that Curryman and other will correct me if I´m wrong.

I think windowing (hanning, hamming, kaiser) should be applied to you desired response, not your filter - Im not sure though.
The administrator has disabled public write access.
The following user(s) said Thank You: Crumboo

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4498

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
Yes, I'll try different approaches if needed.

Shouldn't I be able to use measured frequency (and phase) response for the driver? This could be transformed to impulse response using IFFT? The measurement software I use can automatically convert the response to minimum phase.

One thing I'm really not sure about is how I should define the phase of the target function. I guess the target cannot be zero phase since the output will be delayed (constant)? I'll probably try to define the phase as zero at first and check if the result seems right...

I figure the windowing should be applied to the "ideal" filter response (that is IFFT(target) / IFFT(measured data)) in order to obtain a filter impulse response of reasonable length (number of taps)?

Currently I'm working in a program called IDL, which has many similarities with Matlab. I'll probably switch to Scilab though.

By the way, you asked in a previous post about what soundcard I'll use. I'm not sure yet, but believe M-AUDIO 1010LT can be a good candidate.

One more thing: check out this link. It's a Java applet found on wikipedia for looking at different filters. It's interesting to use the "Custom filter" where you can "draw" the target response you like (and choose filter length) and see the filter impulse response and frequency response changing in real time. :)
Last Edit: 7 years 10 months ago by Crumboo.
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4500

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
Having some thoughts on the equipment I need. I think I'll build a box containing all parts (computer etc.).

I found this remotely operated multichannel volume control (I have heard that it is a good idea to have volume control after the DAC). What do you think?

Also, as I want to keep the signal in the digital domain as long as possible I need some kind of input selector (which don't need do be remotely operated). Any tips on this? It should accept at least two sources of digital signals (spdif coax and toslink). Thought about using a miniDIGI, but I'm not sure about the input selector - is it only set by jumpers on the board or can it be controled from "outside"?
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4510

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
Hi again,

Have been struggling to create the filters in need and I think I'm on the right track. In order to prepare the "ideal" response i wish for my filter (HP part as example) I found SpeakerWorkshop (SW) to be useful. In that program it's easy to export data in equally spaced frequency (not log). The way I prepared the data in SW was this: I imported measured data for a tweeter (frequency and phase) and for the high-pass target curve (which I calculated in Excel). Then I divided the target curve with the measured curve to get how the "ideal" filter would look. In the resulting plot, I changed the frequency scale to be 2000 (arbitrarily chosen) points, covering the range 0 Hz to 22050 Hz, equally spaced elements (not log spaced) and exported it as a text file.

I imported the text file in the programming language IDL (which is quite similar to Matlab and Scilab, and I choose it because I've used it before and is somewhat used to it AND for I found some useful examples that I followed). The "ideal" frequency response of the filter looked like this:



I'm really not sure about all the steps below - I just followed an example:
I defined the frequency spacing (the reciprocal of the sampling frequency) and chose the filter length to be 1024 (i.e. the number of filter coefficients in the resulting filter - I could have chosen whatever I wanted here, but 1024 seemed enough in this case). The next step was to rescale the "ideal" response to be a vector of the length (filter length/2+1) and mirror the vector (not really sure about this, but it gives the right result it seems). Then IFFT of the vector and scale the amplitude with the filter length. Then I shifted the result so that the high amplitude part of the vector moved to the center of the vector (and not in the edges). Thereafter I applied a Hanning window. Here's the result (the vector of filtercoefficients):



By doing FFT of this I got this result:



The result look right. Also I tried to validate this by importing a filter found here (which was used in bruteFIR) and by doing FFT of this the response came out right. This should verify that the filter actually produces the right magnitude response in bruteFIR.

So that was that. There is one problem however which I haven't been able to solve. The above calculation used only the magnitude data and not phase. The IFFT algorithm converts the input data to complex numbers (if it wasn't complex in the first place) - and I guess it sets the imaginary part to zero. I've tried to use the imported phase data to produce the complex response data to insert in the IFFT, but then the result comes out wrong. I haven't figured this out and it's a bit annoying since I wanted the filter to correct the phase turning in the speaker itself (apart from the magnitude); that is, I wanted to have a filter response that was NOT linear phase. Also, the filter phase that comes out looks a bit weird (not only with my data, but also with the data I used for verify the calculations).

Any comments on this? I'll try to implement the same thing in Scilab and I'm happy to share the code if I get it working alright. By the way, feel free to comment on my previous two posts! :)
Last Edit: 7 years 10 months ago by Crumboo.
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4515

  • Jakster
  • Jakster's Avatar
  • Offline
  • Junior Boarder
  • Posts: 24
  • Thank you received: 4
  • Karma: 3
damn, you work fast...


I´m flooded workwise, so I can only give a few short comments.

1) I read the papers describing your crossover. I like it!! but I need to read it a few times, not entirely caught up on the mathematics of it.
2) soundcard seems fine, Anders Torger has preference for RME hammerfall, buts it´s pricey
3) I´m pretty sure minidigi could be used (with or without sample rate conversion), but devteam or Curryman should confirm this
4) what sample rate are you planning on using on bruteFIR?
5) What program do you use to measure your loudspeakers?
6) regarding your last post - Impressive progress on a short period of time. As far as I can tell, you´re definitely on the right track. Here´s few thoughts: I would do the speaker response / targetcurve in IDL. And you need to know the phase response of your ideal filter (maybe look at a std linear phase fir filter in frequency domain and steal that phase reponse, but maybe that´s what you tried?) A few steps:

Target response phase & mag --> target response complex numbers

speaker response phase & mag --> speaker response complex numbers

Inverse Filter = Ifft(speaker_complex/target_complex)


I wish I had more time to look into this!!



/Hans
The administrator has disabled public write access.
The following user(s) said Thank You: Crumboo

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4516

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
I´m flooded workwise, so I can only give a few short comments.

Thats usually the case, but I'm currently on parental leave! :)

Just wanted to add another picture from Speaker Workshop just to clarify:



Top left: measured response for a tweeter with minimum phase (just as an example, I'll do new measurements for the real implementation).

Lower left: The target curve I want (from Keele and Horbach). The phase is zero.

Top right: The ideal filter I want - that is the target curve divided by the measured curve. Not that the phase curve is inverted.

Lower right: IFFT calculated in SW of the ideal filter (the impulse response).

The impulse response has the peaks in the edges of, so I guess that vector must be shifted before applying the window function. I'll try to do this next and get back with the results from this in IDL.

About your comments:

2) Yes I looked at the RME Hammerfall, but as you say it's pricey....:dry: I read some positive comments on the 1010LT so I hope it will be good enough.

3) I hope it can be used as input selector. Actually I even think about adding a basic miniDSP 2x4 for simple room corrections. The drawback of bruteFIR is that isn't very easy to quickly try different room corrections etc. So I figure that I use bruteFIR for the crossover functions and miniDSP (with its graphic interface) to fine tune the response in my listening room. If I understand it right, by combining a miniDSP and one miniDIGI I can have both digital input and output from the miniDSP? Or is a second miniDIGI required to get digital out as well? Is it possible to use a combined input selector for the digital and analog in's?

4) Haven't thought about it...suggestions?

5) I have used different programs: Loudspeaker Lab, SIRP and lately REW. The possibility to use corrections for the microphone response and soundcard response is essential as I see it.

Best regards! :)
Last Edit: 7 years 10 months ago by Crumboo.
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4518

  • curryman
  • curryman's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 791
  • Thank you received: 181
  • Karma: 100
very interesting work. Unfortunately I am also full of work and not able to follow and comment everything ;(

Just want to add one remark: miniDIGI can work as input selector and has one! stereo digital SPDIF output. But I am not sure if it can work standalone, since the output samplerate of the SRC is set by the microcontroller on board of miniDSP (depending on used plugin). So a miniDSP may be necessary.
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4520

  • KAMIKAZE
  • KAMIKAZE's Avatar
Crumboo wrote:
Having some thoughts on the equipment I need. I think I'll build a box containing all parts (computer etc.).

I found this remotely operated multichannel volume control (I have heard that it is a good idea to have volume control <em>after</em> the DAC). What do you think?
After filter it's very good, however if miniDSP will have hi-end boards with good quality components - it's will be a reasonable to use vol. control after filter or after DAC's. But for now it's not necessary to use vol. control for miniDSP, because of it low quality and as result low price. What better? :)
I have 8-channel vol. control (forum.cxem.net/index.php?showtopic=80013...w=findpost&p=1045705) and its wait for a time a hi-end boards and FIR filters :)) and of course DAC's so for 4-way system it will be 4 DAC's, 8 amplifiers in A class for mid-tweet, and AB for wof-sub. Try to find out cost of this project :lol:
Also this is best it can be - altor.sytes.net/Articles/Vol_Control_2/V...sh/vol2_english.html

www.vegalab.ru/forum/showthread.php/4202...мкости-Никитина-с-ДУ
Last Edit: 7 years 10 months ago by KAMIKAZE.
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4522

  • curryman
  • curryman's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 791
  • Thank you received: 181
  • Karma: 100
I am wondering about your target response in the lower left figure. You mentioned zero phase, however linear phase system does not have zero phase, but linear rising or falling phase. This corresponds to a constant group delay.
So for a linear phase system the part with the longest group delay (should be the woofer, b.t.w. closed or vented box?) will define the complete group delay of the complete system. Thus it makes sense to start with the woofer, define the group delay of the overall system (e.g. 50ms, quite typical for vented boxes) and then use this group delay to define the group delay (phase) for the other speakers. Does this make sense? Just a thought :)

Best regards :)
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4523

  • Crumboo
  • Crumboo's Avatar
  • Offline
  • Expert Boarder
  • Posts: 144
  • Thank you received: 14
  • Karma: 13
Curryman...I have to give this some thought. The most important thing is that the individual speakers are perfectly in phase with each other throughout the crossover region. I guess this is easiest to achieve of the phase is constant for all speakers (zero group delay), but also if the group delay is constant (linear phase). Then, it would be a bonus if there is a perfect transient response. What is the difference between zero phase and linear phase with regard to the transient response?

By the way, found something useful about creating filters with arbitrary response here! :)

And yes, it's a vented box.
The administrator has disabled public write access.

Re: Digital crossover for my WMTMW speakers 7 years 10 months ago #4525

  • curryman
  • curryman's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 791
  • Thank you received: 181
  • Karma: 100
What you ideally want for a speaker system is a constant group delay for all frequencies. This (theoretically ;)) results in a perfect step response.

The difference between zero phase and linear phase is just a shifted impulse response. While the zero phase response has an impuls response symmetrical arround time zero (an thus needs negative indexes to be described), the corresponding linear phase impulse reponse is equal in shape but shifted to positive time values (-> this is the group delay ;)).

The source you mentioned does explain most of it quite detailed. Good link!
The administrator has disabled public write access.
Moderators: devteam