rePhase, a loudspeaker phase linearization, EQ and FIR filtering tool

rePhase 1.1.0 is out: http://sourceforge.net/projects/rephase/

Code:
1.1.0 2016-10-27
  New features:
    - screenshot functionalities added to the file menu :
        * "Save Graph Screenshot As..." saves current graph view with a
          logo added to the bottom right corner
        * "Save Window Screenshot As..." saves current window view with the
          directory entry hidden for anonymity concerns
        * supported bitmap file formats are PNG, GIF and JPEG
        * graph screenshot also supports EPS vector file format
    - 64 bits output formats handling (mono/stereo IEEE wav, txt)
    - All-Pass filters added to the Minimum-Phase Filters tab
    - measurement compensate mode to manually replicate a given measurement
      (eg replicating a mic calibration file and getting its missing
      minimum-phase response, replicating a target curve, etc.)
    - added a "Clear Result" entry in the File menu, clearing result curves
      and status
    - reworked "what's new" changelog window to make it easier to read
  Removed features:
    - removed "complex" windowing algorithm which was deprecated since
      version 0.9.0
      An alert box will popup when loading settings using it
  Bug corrections:
    - bug correction for 2nd order minimum-phase filters with Q<0.5
      An alert box will popup when loading settings containing that bug
        * bug report: [url=http://tinyurl.com/z59qw4t]rePhase, a loudspeaker phase linearization, EQ and FIR filtering tool - Page 118 - diyAudio[/url]
    - filename encoding bugfix: accents and other special characters
      handling in setting, impulse, and measurement filenames and paths
      (was supposed to be resolved since 0.9.7, but was not...)
    - last updated graph setting sometimes remained unchanged after
      resetting or loading new settings
    - fixed a few instabilities:
        * Horbach-Keele filters with R=1
        * clipboard corner case errors
        * NaN detection bugs
    - fixed various graphical bugs:
        * generation status remaining after reset
        * misbehaved result phase curve when hide=-Inf
        * view slots flickering in large view mode
  Adjustements:
    - faster constant Q, proportional Q and constant shape EQs calculation:
      should be around three times as fast now, and should be notable when
      manipulating EQ faders as well as during the first generation step
      when a lot of EQ points are used
    - added "Pano Phase Shuffler" presets in the Paragraphic Phase EQ tab
        * source: [url=http://tinyurl.com/pano-shuffler]Fixing the Stereo Phantom Center - Page 10 - diyAudio[/url]
        * settings: [url=http://tinyurl.com/pano-shuffler-preset]Fixing the Stereo Phantom Center - Page 25 - diyAudio[/url]
      status text under the generation button 
    - added a final optimization step in moderate/extensive/maximal modes
      with a correction factor set to 1
    - added ± 15dB and ± 18dB ranges for convenience in paragraphic EQ tab
    - increased EQ dB precision from 0.1dB to 0.01dB for manual editing
    - set default optimization floor to -100dB
    - faster startup time
 
Thanks Pos. I really appreciate the effort you put into this software and your generosity in making it available for us to use.

Can you elaborate on appropriate use of the Compensate function in the measurement import section, please?

I tried this ...

I loaded up a measurement:

m2JsFUi.png


I hit Compensate:

XuxUiXF.png


It appears that rePhase is producing both phase and amplitude curves to correct the response of the driver. Great! But it's also trying to correct below (20 Hz) and above (19999 Hz) the imported data range with 'infinite' gain.

First, is this an appropriate use based on what you had in mind for that function?
Second, if it is, would it be appropriate for the algorithm to ignore correction below and above the available data points in the measurement?

Awesome work Pos. Thanks again.
 
Last edited:
Thank you all for your kind words :)

micfre, the compensate function is just a visual guide, and the correction is still supposed to be done manually.
I see your point though, and the name "compensate" is a poor wording choice and somewhat misleading as it implies an action. I should have used the word "inverse" here. I might change it for the next release.

As noted in the changelog the purpose of this function is to let the user replace a given response curve, like a target curve, a calibration curve, or maybe a correction generated by another tool.
Once that target measurement is loaded and the compensate function engaged, using EQ and filters to seek for a fat flat will result in correction that mimic the original measurement.

As a use case example, I was able to regenerate the calibration file of my microphone which was missing phase info. As a microphone is a minimum-phase device I was able to get its phase response using minimum-phase EQ and filters, and also ignore some "glitches" from the calibration file I was not very happy with (probably artifacts from the calibration procedure). Of course I had to turn back the generated FIR into a freq/mag/phase measurement file using HOLM in order to be able to actually use it...

This method proved more efficient and "correct" than an automated calulation of the minimum-phase response from the measurement, because using filers I was able to "guess" the behavior of the mic down low and get a more precise phase response.
 
Hi,

Using a umik1 in REW to generate data for rephase. I see when measuring that the phase is different depending on the measurement length, likely due to some delay. Is there an easy way to compensate for this, or an appropriate measurement length to use? Looks like 256K is most coherent.
 
Last edited:
I don't use REW too much so I cannot help you on this, but what you want is a phase response that asymptotically tends towards 0° in the HF.
This is not linked to the length of the measurement, but to the t=0 reference, which should be placed roughly on the first major pic of the impulse response. Additionally polarity should be adjusted in order for that peak to be positive.
These time offset and polarity settings can be adjusted within rephase, but it is better to do so within the measurement software, before exporting the measurement.
 
Regarding the "compensate" measurement function, I will rename it to "invert" in the forthcoming 1.1.1 release.
I plan on releasing it very soon to avoid misunderstanding from spreading, so if you have encountered bugs or typos, or if you have suggestions that can be easily implemented please tell me ASAP :)
 
  • Like
Reactions: 1 user
I don't use REW too much so I cannot help you on this, but what you want is a phase response that asymptotically tends towards 0° in the HF.
This is not linked to the length of the measurement, but to the t=0 reference, which should be placed roughly on the first major pic of the impulse response. Additionally polarity should be adjusted in order for that peak to be positive.
These time offset and polarity settings can be adjusted within rephase, but it is better to do so within the measurement software, before exporting the measurement.

I think something may be weird with REW, even the impulse responses look different with different measurement lengths. will use something else.
 
actually, seeing the same thing in holm impulse. wonder if these focusrite drivers are horked. figures it happens as soon as I instasll rephase for the first time. Anyway, liking it so far, thanks for the great software. I came across an interesting bug though, if you tab to the slider, and hit up and down, it moves the entire image and not just the slider.

TXBEtaD.png
 
I plan on releasing it very soon to avoid misunderstanding from spreading, so if you have encountered bugs or typos, or if you have suggestions that can be easily implemented please tell me ASAP :)
Hi Pos,
- not sure it is a bug, but the directory in which the impulses are generated is not saved as part of the config file. So it has to be changed every time a modification is made
- for future versions:
- if you could use one run of optimization to generate multiple impulses with various sampling frequencies, it could be useful
- also, if you could import sets of amplitude corrections (gain EQ) from REW, (which has all the mechanics in place to generate this set of corrections to match a target curve), it could help avoid the manual entry of these corrections. This does not save the fine tuning of the curve inside rePhase; but helps using the optimization included in REW for this purpose.
- finally, I have considerably reduced the pre-ringing of my correction impulses trying to stick to the minimum phase curve related to the amplitude. Would it be possible to have the option to display this minimum phase curve in real time inside rePhase, to help this manual tuning ?
Thanks :)
 
Last edited:
A quick illustration of the importance of sticking to the minimum phase in the low range to limit pre-ringing:
- two graphs before optimizing the phase response in the low range: the pre-ringing is quite substantial
- two graphs after optimizing the phase response to stick to the minimum phase curve: the pre-ringing has massively decreased
All charts with the same amplitude curve.

What remains to be sorted out is the divergence with minimum phase in the high frequencies range. May be related to the absence of mic phase calibration. Any suggestions welcome.
 

Attachments

  • Phase Comparison Before.jpg
    Phase Comparison Before.jpg
    203.7 KB · Views: 265
  • Step before.jpg
    Step before.jpg
    157.5 KB · Views: 261
  • Phase Comparison After.jpg
    Phase Comparison After.jpg
    204.8 KB · Views: 263
  • Step after.jpg
    Step after.jpg
    151.8 KB · Views: 256
Last edited:
Hi SwissBear,

Thank you for the suggestions!

- not sure it is a bug, but the directory in which the impulses are generated is not saved as part of the config file. So it has to be changed every time a modification is made
The directory part is dependent on your particular directory layout, and should not be saved in the settings.
The filename should not either, but it is, for historical reasons... :eek:

I will probably try to rework all this in a future release, and have the user choose a destination file *after* the generation process.

I would have to rethink a few things about the ergonomic principles at play though, as right now not only the filename but also the format is part of the settings, and that can be convenient at time.

The "noise floor" of the result curves also shows the real noise floor implied by the output format...

Well, I will have to think about all this some more.
- if you could use one run of optimization to generate multiple impulses with various sampling frequencies, it could be useful
I can see your point!
This could be addressed by the above suggestion, if the user can save a given FIR several time, choosing a different format each time.

- also, if you could import sets of amplitude corrections (gain EQ) from REW, (which has all the mechanics in place to generate this set of corrections to match a target curve), it could help avoid the manual entry of these corrections. This does not save the fine tuning of the curve inside rePhase; but helps using the optimization included in REW for this purpose.
Good suggestion again.
AFAIK there are several "profiles" to choose from in REW when generating the automated EQs, encompassing a number of usable EQ points, types (shelving, constant Q, etc.), parameters (BW vs Q, etc.) and limits (dB range).
When I looked into this a few months ago I found one "profile" that was close enough (17 EQ points max, only EQ, ideal to fit one paragraphic EQ bank).
I will have to look it up again. The ideal solution would be for REW to implement a rePhase profile :D

- finally, I have considerably reduced the pre-ringing of my correction impulses trying to stick to the minimum phase curve related to the amplitude. Would it be possible to have the option to display this minimum phase curve in real time inside rePhase, to help this manual tuning ?
Thanks :)

Extracting an accurate full range minimum-phase curve is not as easy as it looks. And once you have it why not simply automatically apply the phase correction? ;)
I don't think I will implement this feature, as you should not really need it if you start with minimum-phase EQs, adressing both magnitude and phase linearization, and then only apply phase linearization (preferably from the filter linearization tab) for the crossover points (not the system's high and low pass filters).

What remains to be sorted out is the divergence with minimum phase in the high frequencies range. May be related to the absence of mic phase calibration. Any suggestions welcome.

You should play with measurement time offset to get a proper phase there, and not try to linearize anything that is outside of the scope of a crossover point.
Regarding the phase response of your mic, if it is not included in the calibration file you can try to "resynthesize" it using the measurement "compensate" (soon to be called "invert") functionality as explained above.
I did so with mine (coming from cross spectrum with no phase info) and I found it worked pretty well.
 
Last edited:
  • Like
Reactions: 1 user
is the internal processing precision along updated to 64bit?
yes
And guess what: it always was :D
The txt output format, for example, always had 64 bit double precision.
I don't know were I got the idea that the FFT library I was using was working with 32 bit float precision :scratch:
It is a library called fft4g, written by Takuya OOURA in 1999.
I also recently tried the industry standard FFTW, but could not record any difference in precision, or any significant/consistent speed gain.
FFTW has other advantages though, so I will pursue my tests with it...
 
yes
And guess what: it always was :D
The txt output format, for example, always had 64 bit double precision.
I don't know were I got the idea that the FFT library I was using was working with 32 bit float precision :scratch:
It is a library called fft4g, written by Takuya OOURA in 1999.
I also recently tried the industry standard FFTW, but could not record any difference in precision, or any significant/consistent speed gain.
FFTW has other advantages though, so I will pursue my tests with it...

Thats great :). Thanks.