Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

microphone phase derivation (Matlab)

Status
Not open for further replies.

Tsardoz

Newbie level 3
Joined
Nov 27, 2009
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,334
In high end audio enthusiasts sometimes want to know the phase response of their microphone.
Although they can get them calibrated the labs just return the magnitude response.
So tricks are used to calculate the phase response from the magnitude response.
I have only ever seen mention of Hilbert transforms for this.

eg. see Phase Portrait: Someone asked me about Hilbert transforming minimum-phase magnitude responses today...

The trouble is - it does not seem to work!
I just wondered if anyone could show me what I am doing wrong here.

Now I do not have a microphone calibration that shows magnitude and phase.
So I have something else I developed before I had tried using Hilbert transforms.

This method is based on an equivalent circuit representation as follows:
1) First find a high pass filter that be configured to track a frequency response as closely as possible. For the Beyrerdynamic MM1 microphone I tired various filter types and found it could be accurately modelled by a first order (real pole) high pass filter in series with a second order section with adjustable damping factor.
2) You can easily find an expression for the amplitude response of such a filter which has 3 unknowns (fc1,fc2 and damping factor).
3) Set up a nonlinear regression (nlinfit) with the target being the low end frequency response. Find the best fit to suit the data.
4) Repeat steps 1-3 until a good match is found (I did this and came up with the filter described as being best).

This is what I came up with

**broken link removed**

This makes sense. A third order hpf will have a lower end phase limit of 270 degrees and at the corner frequency of about 30 Hz the phase should be about 3*45 = 135 degrees (check).
So this is the next best thing to having a measured phase response.

Now to the various methods of estimating this...
Raw Hilbert transform
(data was resampled at constant 500 log frequency intervals)
X = hilbert(log(microphone_magnitude_spectrum));
phase = -imag(X)*180/pi;

**broken link removed**

You can see this does a poor job at estimating the low frequency phase shift.
Then in Matlab I foun another method with a function called genphase
"genphase uses the complex-cepstrum algorithm to generate a complex frequency response resp whose magnitude is equal to the real, positive response d, but whose phase corresponds to a stable, minimum-phase function."
frd1 = frd(microphone_magnitude_spectrum,2*pi*microphone_sample_frequencies);
resp = genphase(frd1);
[m,p] = bode(resp,2*pi*microphone_sample_frequencies);
phase = p:)) + 360;

raw genphaset.png

This performs marginally better than the Hilbert transform (why is it different?) but is still inadequate at modelling the expected 270 degree low frequency phase shift.

Then I had the idea that this problem appears to be related to end conditions. What if I were to artificially extend the frequency response at each end by a decade?
Just use linear regression of the magnitude response to work out the slopes so you can make a good estimate of what the magnitude response is doing in these regions. Then you can remove them again and hopefully do away with these end problems.

extended genphase

corrected genphaset.png

Hey it worked!
genphase is now accurately modelling the predicted phase response.

What about if we do the same for the Hilbert transform?

extended hilbert transform

corrected hilbert.png

It did not work!
The phase response looks either shifted to right, or up, from what it should be (the red curve).

What is going on with Hilbert transforms?
Why dont they work?
If I had not managed to successfully generate the phase curve from the genphase command I would be having doubts about my algorithms.
However this is not the case.
I know I can just use genphase but I'd like to know what is going on.

Can anyone help identify the problem here?
 

In high end audio enthusiasts sometimes want to know the phase response of their microphone.
I wonder why. Can you hear signal phase?
So tricks are used to calculate the phase response from the magnitude response.
What makes you think that a microphone is a minimum phase system? The accoustic delay already involves that it isn't.
 

I wonder why. Can you hear signal phase?

Why yes you can. Eventually nonlinear phase (non-constant group delay) causes timing issues in the extreme. Reverb filters are phase filters and not amplitude filters, for example.

What makes you think that a microphone is a minimum phase system? The accoustic delay already involves that it isn't.

I never said I thought a microphone was a minimum phase system. I am interested in correcting what is possible, not the parts that are impossible.

However I am not interested in debating these issues.
This is a specific question related to what seems (to me) unusual behaviour in the Hilbert transform when compared with the Matlab genphase routine.
If you cannot address this specific issue then please keep your thoughts to yourself as anything else is outside the topic.
 

I don't want to further debate the topic, just wanted to question the motivation of your work. Thus I don't comment your examples about role of phase.

An ideal Hilbert transform requires infinite data length. It's quite understandable, that FIR approximations of Hilbert transformation and similar methods have problems near the lower frequency band limits.

If I wanted to know the phase response of a microphone, I would measure it directly with a short duration spark discharge as reference signal.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top