Home Theater Forum and Systems banner

1 - 20 of 28 Posts

·
Registered
Joined
·
20 Posts
Discussion Starter · #1 ·
Hi
I am new here but have some experience with DSP methods over the years and have been waiting for tools like Convolver to become available. I have been tempted to write something like this myself but the effort involved just gave me a headache just thinking about it. It is wonderful that advanced tools like this are now readily available.

I just have a question on how Convolver has been implemented. Forgive me if this has been answered before (as I am sure it has) but as a newbie it can be a little daunting initially to get your head wrapped around all these threads.

I was a bit surprised to learn that mic calibrations are only done in the frequency domain and that phase is ignored. (eg. at Cross Spectrum). Now frequency domain calibrations are fine for parametric equalisers that seem to be popular but for impulse response measurement surely the mic phase response is important too. If this is not taken into account then the impulse response convolution will include the impulse response of the microphone. So you might get a great looking corrected frequency response on the PC screen but it just includes the mic irregularities. For the popular cheap microphones in use that appear to be popular (eg. Behringer) these problems will start appearing below the cutoff frequency of the mic (which seems to start around 100 Hz).

Is this taken into account by convolver? I would suspect not (but I know next to nothing about how it operates).

If this is a real problem, the solutions would appear to be:
1) Buy very expensive microphones with better response characteristics
2) Get a phase calibration performed on the mic as well from some other source (more expensive)
3) From the microphone amplitude response estimate the phase response (or group delay) making certain assumptions about the equivalent circuit of the microphone.

I guess I am most interested by option 3. Like many of us I am unwilling to spend vast amounts on what is just a hobby for me. I just wonder if Convolver uses this approach or if anyone here has tried to use this approach for subwoofer/satellite EQ. Then again, maybe it is not necessary and correcting for mic phase response in this manner produces inaudible (but measurable) results. It would be nice to find out though.

I am also interested to hear from those who have compared Convolver with the more typical parametric EQ technique in their system and which they prefer to listen to.

regards
tsardoz.
 

·
Premium Member
Joined
·
6,711 Posts
Queries about Convolver would probably be best answered by the author, his email address is on the Feedback section of the Convolver web site. Microphones are largely minimum phase devices so the phase response can be generated via Hilbert transform of the magnitude response.
 

·
Premium Member
Joined
·
1,400 Posts
Tsardoz said:
I just have a question on how Convolver has been implemented. Forgive me if this has been answered before (as I am sure it has) but as a newbie it can be a little daunting initially to get your head wrapped around all these threads.
> As a start on your journey ( researching convolvers ), I think it's worth perusing this thread !

> Within that thread, you'll find links to those who know the inner workings of convolvers ( & much much more ) .

Tsardoz said:
I am also interested to hear from those who have compared Convolver with the more typical parametric EQ technique in their system and which they prefer to listen to.
> This is a question that you can quite easily answer for yourself by implementing ConvolverVST ( & a REW produced correction filter ) within a media playback engine like Media Center ( which hosts VST plugins within its' DSP section ) .
> Media Center has it's own builtin Parametric EQ ( though I haven't used it ).
> Alternatively , you can find some pretty good PEQs online for not much money .
> I bought ( & use for test purposes within Media Center ) this ;
> ( I like it's interface / though 6 bands could be limiting to those wanting to do extensive EQ )




:sn:
 

·
Registered
Joined
·
114 Posts
This is a question that you can quite easily answer for yourself by implementing ConvolverVST ( & a REW produced correction filter ) within a media playback engine like Media Center ( which hosts VST plugins within its' DSP section ).
> Media Center has it's own builtin Parametric EQ ( though I haven't used it ).
JRiver Media Center now has its own native convolution engine with 64 bit precision. Its parametric EQ is excellent and it is easy to setup the filters that are generated by REW.

Here is a description of the features in the JRiver covolution engine:

  • All processing is 64bit
  • With one high sample rate cfg file, all sample rates are supported
  • FFT/iFFT evaluation is lazy (only run when necessary)
  • Pink noise RMS output automatically normalized to -6 dB below input
  • Any number of paths, targetting any input or output channel
  • Filter files (impulse response) can be in any format supported by Media Center (.wav, .ape, .flac, .mp3, etc.)
  • Partitioning is used to reduce latency
  • Partition size will automatically adjust with the sample rate
  • Latency is handled automatically for lip-sync (not including filter delay)
  • Filter files can be any sample rate (one filter can be used for all sources)
  • Handles flushing nicely so the tail of the last song isn't heard when playing a new song
  • Handles volume attenuation for clip protection automatically (JRiver DSP clip protection used)
  • Convolution uses SSE3 in the convolution kernel
  • Output delays supported
  • Multiple input channels to a path
  • Output channel weights
  • Bit perfect (limited testing by Uli Brüggemann of Acourate)
 

·
Premium Member
Joined
·
1,400 Posts
mojave said:
JRiver Media Center now has its own native convolution engine with 64 bit precision.
Its parametric EQ is excellent and it is easy to setup the filters that are generated by REW.

Here is a description of the features in the JRiver covolution engine:

  • All processing is 64bit
  • With one high sample rate cfg file, all sample rates are supported
  • FFT/iFFT evaluation is lazy (only run when necessary)
  • Pink noise RMS output automatically normalized to -6 dB below input
  • Any number of paths, targetting any input or output channel
  • Filter files (impulse response) can be in any format supported by Media Center (.wav, .ape, .flac, .mp3, etc.)
  • Partitioning is used to reduce latency
  • Partition size will automatically adjust with the sample rate
  • Latency is handled automatically for lip-sync (not including filter delay)
  • Filter files can be any sample rate (one filter can be used for all sources)
  • Handles flushing nicely so the tail of the last song isn't heard when playing a new song
  • Handles volume attenuation for clip protection automatically (JRiver DSP clip protection used)
  • Convolution uses SSE3 in the convolution kernel
  • Output delays supported
  • Multiple input channels to a path
  • Output channel weights
  • Bit perfect (limited testing by Uli Brüggemann of Acourate)
Thank-You for the very nice overview about Media Centers new convolution engine . :T
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #6 ·
Thanks for the links everyone.
It will take me some time to digest this.
In the meantime I emailed John from convolver and he said that convolver just convolves whatever you tell it to.
This means there is NO microphone or sound card correction (unless you use tools that take this into account)
When I know more about this I'll post back.
BTW thanks for the tip JohnM about Hilbert transforms.
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #7 ·
Ok now the question is the same but directed at REW rather than Convolver.
Does REW utilise phase response from the microphone and sound card when measuring speaker response?
I notice it measures speaker phase as well as amplitude but does it use special tricks to determine microphone phase from the calibration file (and thus deduct microphone/soundcard phase from speaker phase)?
I realise phase may be less important for parametric EQ but REW has some nice measurement tools which could possibly be used in conjunction with DRC (for example) if it handles phase well.
Its not a criticism if it does not but it would be nice to know.
 

·
Premium Member
Joined
·
6,711 Posts
If the mic cal file has phase data REW will use it, but REW will not synthesise phase data from the cal magnitude data. It would in any case only affect the displayed phase traces. The EQ features only use magnitude data.

Note that REW only applies the mic and soundcard cal data to the magnitude and phase traces on its graphs, it does not use them to modify the impulse response which is derived from the sweep measurement.
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #10 ·
Thanks again for the replies.
So the next question is ... does anyone have a microphone cal file which also has phase?
I can use Matlab to try various approaches (including Hilbert transforms :nerd:) to see if I can generate phase from amplitude plots.
Maybe this is the wrong forum for that question though since REW does not use phase but worth a shot.
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #12 · (Edited)
OK just for completeness I finished writing code for this.
My idea of fitting known filter types to the calibration curves did not work so well. (too many curves fit the data and there is no unique best fit).
Indeed, Hilbert transforms are the way to go.

I could not find ANY mic phase data. Clearly nobody gives a stuff about mic phase.
So why should I?
Only because I think although it is highly unlikely to be audible in its own right, if you say that about everything eventually you are wrong when you add them all up. Kind of an interesting philosophical/logical dilemma that.
(if A,B,C,D are each inaudible then A and B an C and D should logically be inaudible together but not necessarily!)

Anyway I digress.
Here is Matlab code ...

code deleted due to bugs
Here is mic phase data for the averaged ECM8000 found in the download section

calibration deleted due to errors
and here are magnitude and phase plots
Well I was going to post pics but I cant figure out how to so I wont.
A message said I could not post links.

The phase response at frequency extremes (<20 Hz , > 10 KHz) is unreliable.
eg. <20 Hz should keep going up and not curve back down
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #13 · (Edited)
I found some bugs and corrected them.
I have also compared the Hilbert transform approach with the equivalent circuit approach and both give similar phase responses so I now think the bugs are out.
There is still some minor errors below 20Hz and > 20 KHz which I think are due to end effects of the Hilbert transform itself.
(EDIT: Actually this is pretty accurate. The input stage of this microphone looks like a third order high pass filter, so the total phase contributed wont exceed 3*90 = 270 degrees)

But the 20 - 20 000 Hz response looks OK to me.

Matlab code
Code:
deleted again as I cannot get Hilbert transforms to work
and calibration data for ECM8000
Code:
deleted as it has errors from the Hilbert transform
and a graph of frequency response



EDIT - further note to this. I have since discovered that many (all?) of the phase correction systems already do similar microphone phase corrections. This is just unnecessary for PEQ systems like REW that do not use phase and superfluous for the others that already have their own algorithms. So rather a waste of time really. In any case feel free to use the Matlab code, for anyone who wants to.

EDIT2 - There are problems with the Hilbert transform method so I have deleted this data. I have found another method that works better (see next post from me)
 

·
Premium Member
Joined
·
1,562 Posts
Thanks for posting this! I had been looking for a routine to create the phase info for my Mic. I generally agree that it is not needed for good results, but I like to calibrate the measuring system as well a possible for just the reasons you cited above. It gives me more peace of mind when reviewing the charts. Hopefully someday I will also get into DRC, but for now I am still having fun developing a fuller understanding of all the ins and outs of PEQ.
Thanks again!
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #15 · (Edited)
OK the Hilbert transform method does not work, well at least using Matlab in my algorithm.
I have seen another HTF post that demonstrates the same problem I was having with it

http://www.hometheatershack.com/for...sound-cards/31380-ecm8000-phase-response.html

Post #8 shows the same end-effect problems I have encountered (around 10000 Hz). Their conclusion is that you cannot derive mic phase. My conclusion is that the Hilbert transform approach is questionable. I am not saying it wont work but if it does work you need to use it in a special way (that I do not know about).

The good news is that I was able to replicate almost exactly the equivalent circuit phase of the ECM8000 using another Matlab function called genphase.

Code:
function phase = findphase(calfile)
%Determine microphone phase from an amplitude calibration file
%see http://phaseportrait.blogspot.com/2011/07/someone-asked-me-about-hilbert.html
%get calibration data from file

fid = fopen(calfile);
tline = fgets(fid);
mic = [];
while ischar(tline)
    if isnumeric(str2num(tline(1)))
        tline(tline == ',') = ' ';
        mic = [mic;str2num(tline)];
    end
    tline = fgets(fid);
end
fclose(fid);
save mic_data mic

b = [1/2,1/2];  %phase smoothing filter
nhi = 2;          %number of points to use to find slopes at extremes
nlo = 3;          %number of points to use to find slopes at extremes
nextra = 10;    %number of extra points to add at ends
N = 10;         %frequency multiplier at extremes

%extend low frequencies
tlow = logspace(log10(mic(1,1)/N),log10(mic(1,1)),nextra);
blow = regress(mic(1:nlo,2),[log10(mic(1:nlo,1)),ones(nlo,1)]);
xlow = [log10(tlow'),ones(nextra,1)] * blow;

%extend high frequencies
thi = logspace(log10(mic(end,1)),log10(N*mic(end,1)),nextra);
bhi = regress(mic(end - nhi + 1:end,2),[log10(mic(end - nhi + 1:end,1)),ones(nhi,1)]);
xhi = [log10(thi'),ones(nextra,1)] * bhi;

%convert dB to absolute
x = 10.^([xlow(1:end-1);mic(:,2);xhi(2:end)]/10);
t = [tlow(1:end - 1)';mic(:,1);thi(2:end)'];
%x = 10.^(mic(:,2)/10);
%t = mic(:,1);

%resample frequency space to equi (log) space
%tt = logspace(log10(t(1)),log10(t(end)),500);
tt = logspace(log10(t(1)),log10(t(end)),1000);
%interpolate
yy = abs(spline(t,x,tt));
frd1 = frd(yy,2*pi*tt);
resp = genphase(frd1);
[m,p] = bode(resp,2*pi*mic(:,1));
phase = p(:) + 360;

%find phase via hilbert transform NOTE: This does not work for an unknown
%reason
%X = hilbert(log(yy));
%phase = spline(tt,-imag(X)*180/pi,mic(:,1));
%smooth phase response with zero phase filter
subplot(2,1,1);
semilogx(mic(:,1),mic(:,2));
grid;
ylabel('Magnitude (dB)');
title('Microphone magnitude calibration');
%plot phase
subplot(2,1,2);
semilogx(mic(:,1),phase);
grid;
xlabel('Frequency (Hz)');
ylabel('Phase (degrees)');
title('Microphone derived phase response');
outfile = [strtok(calfile,'.'),'-phased.',fliplr(strtok(fliplr(calfile),'.'))];

fid = fopen(outfile,'w');
for k = 1:length(phase)
    fprintf(fid,'%5.1f %4.2f %4.2f\r\n',mic(k,1),mic(k,2),phase(k));
end
fclose(fid); 
return
and ECM8000 cal file
Code:
  5.0 -19.49 264.53
  5.6 -17.79 261.09
  6.3 -16.08 259.63
  7.1 -13.99 253.39
  8.0 -12.39 246.97
  9.0 -10.41 241.86
 10.0 -8.60 231.35
 11.2 -6.98 217.94
 12.5 -5.48 203.90
 14.0 -4.17 186.72
 16.0 -3.05 167.51
 18.0 -2.13 152.05
 20.0 -1.40 137.08
 22.4 -0.88 121.01
 25.0 -0.54 107.02
 28.0 -0.32 94.03
 31.5 -0.20 82.62
 35.5 -0.09 72.88
 40.0 -0.01 64.32
 45.0 0.07 56.79
 50.0 0.11 50.69
 56.0 0.16 44.70
 63.0 0.16 38.91
 71.0 0.14 34.01
 80.0 0.11 29.82
 90.0 0.07 26.45
100.0 0.05 24.06
112.0 0.05 21.68
125.0 0.04 19.60
140.0 0.04 17.71
160.0 0.02 15.94
180.0 0.04 14.79
200.0 0.06 13.63
224.0 0.08 12.44
250.0 0.09 11.38
280.0 0.10 10.47
315.0 0.11 9.53
355.0 0.10 9.09
400.0 0.17 8.72
450.0 0.20 6.89
500.0 0.09 6.74
560.0 0.19 6.91
630.0 0.14 5.79
710.0 0.16 5.78
800.0 0.12 4.91
900.0 0.03 5.18
1000.0 0.00 6.55
1120.0 0.10 7.22
1250.0 0.12 6.40
1400.0 0.02 5.38
1600.0 -0.28 9.55
1800.0 0.11 13.21
2000.0 0.19 9.94
2240.0 -0.15 12.71
2500.0 0.21 16.22
2800.0 0.14 14.85
3150.0 0.08 19.80
3550.0 0.44 23.51
4000.0 0.67 23.76
4500.0 0.78 25.00
5000.0 0.89 28.10
5600.0 1.28 32.02
6300.0 1.78 31.41
7100.0 1.85 32.90
8000.0 2.55 40.73
9000.0 3.93 36.54
10000.0 4.46 23.33
11200.0 4.29 16.38
12500.0 4.73 13.23
14000.0 4.99 5.14
16000.0 5.35 -3.21
18000.0 5.70 -16.83
20000.0 5.37 -29.53
22400.0 5.09 -39.99
25000.0 4.48 -50.52
and this graph actually shows the equivalent circuit phase in red against the genphase phase in blue so you can see that this is now an excellent match.



Uploaded with ImageShack.us

I should add that the assumption here is that a condenser microphone is a minimum phase device. Now I dont know if this is true or not but we should be able to correct any minimum phase behaviour. Anything outside that may not be possible but some correction is better than no correction IMHO.

Hopefully I wont have to add any more errata as I am beginning to feel foolish! :dumbcrazy:
 

·
Premium Member
Joined
·
397 Posts
Post #8 shows the same end-effect problems I have encountered (around 10000 Hz). Their conclusion is that you cannot derive mic phase.
Well now, my conclusion (well, speculation really) is that you can't derive it based on freq response alone, obviously if you have all the relevant microphone capsule parameters (diaphragm tension & thickness, air gap, etc) you can derive the phase directly from a condenser mic model. :)

genphase hasn't been ported to Octave yet so I can't run the script. If I send you the B&K 4145 data I used for my phase calc, can you run it through the script and see what you get?
 

·
Banned
Joined
·
516 Posts
After you get everything worked out, you can then go to work on the electronics (including mic pre-amps) that are conveniently assumed to all exhibit linear phase...

But hey, as the popular goal seems to be to spend no more than $50 on 'ideal'(sic) pre-amps with limiting noise floors this all may be a bit of overkill....

I fear we may be falling victim to the assumption that the difference between a Styrofoam rubber band powered airplane and an F-35 fighter is the quality of the rubber band.
 

·
Premium Member
Joined
·
1,562 Posts

·
Registered
Joined
·
20 Posts
Discussion Starter · #19 ·
Ah thanks for that.
These are the results I have from that calibration file



Red is equivalent circuit model
Blue is calculated from genphase
Green is phase as supplied by calibration file

So the blue phase is a very similar shape to the supplied phase but roughly twice the size.
Rather than just immediately think the routine I am using is wrong, I am questioning the validity of the phase supplied in the calibration file.
From what Anechoic has said, phase is very hard to measure for microphones and that he would be doing it if he could.
If that is true (and it sounds fair enough to me), then how did this calibration file include phase?
Was it just generated with a Hilbert transform routine?
That is what most of the software packages out there tend to do.
If that is the case then there is really no reason to think that the green curve is any more valid than the blue curve.

This whole thing stinks of chicken and egg. Without properly validated microphone phase, any routine I come up with will really just be conjecture. I might go check the academic sources to see if I can find anything truly trustworthy.

On the plus side the HF frequency response extends a bit further than most and catches the resonance peak. Maybe I can try fitting an equivalent circuit to the HF for this mic.
 

·
Registered
Joined
·
20 Posts
Discussion Starter · #20 ·
Anechoic, in another thread someone suggested just measuring impulse response of microphones by measuring the sound from electric spark discharge. This sounded like a pretty good idea to me. Electric sparks are pretty easy to generate. I can't think of anything that would be closer to a true impulse generator.

eg.
http://www.electricstuff.co.uk/marxgen.htm

The SPL might be on the low side but you can fix any SNR problems that arise from that by ensemble averaging of the impulse response. Once you have impulse response you can get phase response. It would be better than these roundabout ways that make assumptions of minimum phase.
 
1 - 20 of 28 Posts
Top