rePhase, a loudspeaker phase linearization, EQ and FIR filtering tool - 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 12th October 2012, 04:54 PM   #1
pos is online now pos  Europe
diyAudio Member
 
pos's Avatar
 
Join Date: Feb 2008
Location: Paris
Default rePhase, a loudspeaker phase linearization, EQ and FIR filtering tool

Quote:
as rePhase has evolved a lot since day one of this long thread, it is certainly not a good starting point to understand what rePhase does and what its current state of development is. It is nonetheless a good place to ask questions, report bugs, or request features.

For an introduction to rePhase here is a nice and concise application note from the miniDSP team that explains the use of rePhase way better than I ever could: The rePhase FIR tool | MiniDSP

(this application note is of course focused on the use of rePhase with miniDSP hardware convolution engines, but the same method can also be used with other hardware or software convolution engines)

This first post is somewhat kept up-to-date with links and a change log for the current version of rePhase.

Here is the sourceforge rePhase project page from where the last version can be downloaded.

enjoy
original post:

Here is a little piece of software I have been working on for some months now.
It is called rePhase, and is a tool for loudspeaker phase linearization, EQ and FIR filtering.
It does so by producing correction impulse responses that you can then use in your favorite convolution engine.

It is a free software, without restriction (but without warranty either).

Download: rePhase on sourceforge

At start the first goal of rePhase was to let you generate impulses specifically tailored to reverse the phase shifts introduced by the crossovers of your loudspeakers (passive or active) and boxes, resulting in a linear-phase system.
It is similar to phase arbitrator in this regard (but it is not a processing plugin, just an impulse generator).

rePhase has evolved and now includes other features: it can generate linear-phase EQ and crossover filters of arbitrary slopes, including Linkwitz-Riley (albeit linear-phase) and Horbach-Keele shapes.

With the paragraphic EQ sections you can alter phase and amplitude independently.

You will need a convolution engine to run the generated impulse, such as the minidsp openDRC, foobar2000 convolver or VST convolver, among many other software and hardware tools.

You can use rePhase to linearize passive loudspeakers, active ones, and turn IIR active crossovers into linear-phase crossovers (turn a DCX2496 into a DEQX or a Dolby Lake ).
You can also design the whole filter with rePhase.
In any case you will need one convolution per way (Jriver can be used to run the convolutions for example)

Features include:
  • generate impulse responses (FIR) for convolution engines
  • measurement import
  • loudspeakers phase linearization (passive or active crossovers)
  • linear-phase and minimum-phase gain EQ (paragraphic and in bank)
  • linear-gain phase EQ (paragraphic and in bank)
  • multiple gain EQ algorithms (constant Q, proportional Q, constant slope, raised cosine)
  • arbitrary slopes linear-phase filters (aka FIR filters)
  • real time graphical monitoring of target and results curves
  • automatic optimization for the best result with a given number of taps
  • multiple windowing choices

Sorry for the lack of documentation.
Questions, remarks and suggestions are welcome!

External Ressources:
Changelog:

Code:
0.9.7 2013-09-03
    - Brickwall filters implementation.
      /!\ result slope relies solely on windowing /!\
      Iterative optimization and energy centering algorithms are
      automatically defeated when a brickwall filter is set, to make it
      possible to build complementary crossovers. It is up to the user to
      make sure he uses the exact same number of taps and same windowing
      algorithm on both sides of the crossover to ensure complementarity
    - sampling rate drop down menu can now also be directly edited to input
      arbitrary values, so menu options have been reduced to the most
      common values for clarity and ease of use
    - frequency, amplitude and phase ranges can now also be set to
      arbitrary values
    - optimization floor can now be set (was -40dB fixed)
    - B-weighting in optimization calculation was removed (for now)
    - new amplitude paragraphic presets with fixed frequencies (1kHz) for
      various Q values (0.5, 1, 2, 4, 8, 16)
    - got rid of scientific notation in txt output format to broaden
      compatibility
    - dark graph theme
    - various graphical bugs resolution
    - C float array output formats
    - filename encoding bugfix: accents and other special characters
      handling in setting and measurement filenames
    - "reject" filter slopes bugfix
    - "Save Settings" menu option 
    - "Save modifications" dialog box before loading/resetting/exiting
    - window title now shows the settings name instead of the impulse name
    - updated 'tips' in Linearization and filtering tabs

0.9.6 2013-04-16
    - show frequency, amplitude and phase from current cursor position in
      graph
    - improved measurement handling:
        * drag and drop loading
        * loading speed up (twofold increase)
        * gain and time offset settings
        * polarity inversion and phase hiding functionality
        * bypass option
        * description: name, number of points, frequency and dB ranges
        * ARTA format handling (trailing spaces in frequency column)
    - Save measurment inside *.rephase settings files together with
      corrections and other parameters
    - new 'constant shape' EQ, both for linear-phase and minimum-phase EQ.
      Equivalent to a constant Q EQ at 6dB, it keeps exactly the same shape
      at any dB setting. It should be preferred to constant Q and
      proportional Q at high dB settings as those two are bound to their 2nd
      order definition and have to stay in a +/-90 deg phase range, thus
      leading to odd gain shapes at high dB settings...
    - "What's new" menu entry, exposing this changelog, instead of having a
      separate REDAME file
    - bugfix when loading settings from version prior to 0.9.2: filter
      frequencies were lost
    - going back to forced 'middle' in energy centering when only
      linear-phase corrections are used
    - curve capture functionality teasing...

0.9.5 2013-04-06
    - measurement import implementation, following HOLMImpulse import rules
      and interpolation strategy
      (first draft with limited functionality)
    - Nyquist frequency is now explicitly represented in gain result curve
      as a brickwall low-pass
    - result curves are now cleared upon settings reset or loading
    - improved energy centering algorithm
    - stop forcing energy centering to middle when only linear-phase
      corrections are in use
    - middle click on a fader reset its value to 0
    - bugfix for result phase curve unwrapping
    - bugfix on curves when polarity is inverted and a phase range larger
      than +/-180° is chosen
    - bugfix for 1st order high-pass filters

0.9.4 2013-03-16
    - crash at start problems (previsously requiring temp/ dir content to
      be deleted) should now be solved
    - up to 16 banks can now be used in paragraphic gain and phase EQ
    - removed bank EQ tabs (settings saved with banks EQ will be
      automatically reported to paragraphic EQ banks)
    - improved graph range options: frequency and phase range can now be
      set and saved in settings
    - new phase wrapping implementation, automatically adapted to current
      phase range
    - view mode (compact/normal/large) is now automatically saved and
      restored from one run to the next
    - double-click on a fader value entry reset the fader to 0
    - improved raised cosine EQ. Interactions between EQs should now behave
      exacly like the "Ideal Graphic Equalization" exposed here in this
      application note: http://www.nordicsales.dk/imgdb/docs/lakewh_981.pdf
    - better precision for frequency entries (fractional up to 5 chars
      total to fit the entry) and appropriate up/down key binding (0.1hz
      steps under 10hz)
    - real 2/3 and 1/3 octave frequencies in paragraphic EQ sections
      (mandatory to make the raised cosine graphical EQ "magic" work...)
    - improved biquad precision (constant Q and proportional Q EQs) by
      adapting the sampling rate of each biquad to its fc
    - increased Q range (0.1 to 100)
    - improved phase deg precision in paragraphic EQ
    - added ESS sabre frequencies

0.9.31 2013-01-29
    - mini bugfix for the taps entry...

0.9.3  2013-01-29
    - new Paragraphic EQ implementation, with multiple EQ types:
        * constant Q minimum-phase (new default)
        * constant Q linear-phase 
        * proportional Q minimum-phase
        * proportional Q linear-phase
        * constant slope linear-phase (former implementation)
        * raised cosine linear-phase (beta version...)
      ( bank EQ section remains constant slope linear-phase )
    - FFT size can now be set by user (minimum size is two times the
      smallest power of two equal or bigger than the requested number
      of taps). Setting a larger FFT size makes generation and optimization
      slower, but can increase the precision of the optimization and also
      makes result curves more precise (just a visual effect for that one
      though: no effect on the actual impulse)
    - bug correction: negative gains can now be entered directly from
      the keybord in the Gain EQ Bank tab.
    - exit on repeted errors to avoid "panic mode" effect

0.9.2  2012-11-04
    - added back '24bit LPCM mono' output format, missing since 0.9.0
    - improved up/down key bindings on frequency entries
    - added up/down key bindings for taps entry, with color warnings for
      extreme values
    - new '1st order' and '2nd order' linear-phase filters, meant to be
      combined with an existing (and already corrected in phase) rolloff
      to obtain a linear-phase acoustical Linkwitz-Riley filter
    - made sure 'middle'+'float' centering ends up within -0.5/+0.5 sample
      from middle (was -1/+0.5)

0.9.1  2012-10-29
    - centering 'int' option was not working, this is now fixed
    - more explicit error message when loading a wrong setting file

0.9.0  2012-10-28
    - new file format '.rephase', saving/loading all settings, including
      correction settings, impulse settings, and graph settings
      (old '.jason' files can still be loaded, but impulse and graph
      settings get reset)
    - impulse file is now a three-part thing: directory, filename, and
      format extension. The directory is the only thing that is not saved
      in the '.rephase' file
    - '.rephase' files can be loaded upon start (as a parameter or by drag
      and drop on rephase.exe) or by drag and drop on the user interface
    - new offset option "float" for fractional sample centering, avoiding
      HF ripples in the impulse when the phase target is not a multiple
      of 180° at the Nyquist frequency
    - make "rectangular" the default window function: this should be the
      best choice for phase-only corrections, and "complex" windowing is
      not needed anymore with the "float" offset
      Note: "rectangular" window is still likely to be the worst choice
      for filter generation, when gain target goes far below 0dB...
    - new "ovelapping" filters, to be used for example in the midbass
      region, under Schroeder's frequency...
    - stereo wav formats are now available
    - bug correction in offset calculation in time=inv mode

0.8.4  2012-10-14
    - new time inversion option in general tab, to reverse the generated
      impulse, thus opposing phase corrections. This can be used to better
      visually track a phase target (inverse during correction, and return
      to normal before generating the impulse), or to evaluate the
      audibility of a given correction with headphones for example (in this
      case the convolution of the impulse will simulate the speaker before
      correction)
    - confirmation box when exiting without saving modified correction
      settings, and avoid asking for confirmation on reset when correction
      where saved or loaded without modification
    - Improves advice section in the linear filter tab, and add one in the
      linearization tab

0.8.3  2012-10-12
    - range choices in paragraphic EQs (up to +/- 48dB and 720°)
    - improve arrow keys binding after click in faders
    - stop constraining frequencies to 16Hz-25khz in paragraphic EQs
      (now 1hz-99khz like in EQ banks)
    - ask for confirmation before resetting correction settings
    - bug correction when resetting settings ("wrong format")
    - stop using '.rephase' as default extension when saving an impulse

0.8.2  2012-10-07
    - try to play nice with multiple screens
    - new "large" layout, and "View" menu for layout choice
    - change Q interpretation for phase EQ to be more in line with gain EQ
      (to maintain an ascending compatibility, phase corrections saved from
      versions 0.8.0 and 0.8.1 get their Q divided by 1.8 upon loading)

0.8.1  2012-10-03
    - fix small bug with slope/ratio display when loading a FIR filter

0.8.0  2012-10-02
    - real-time amplitude/phase curves for both target and result
    - save/load correction settings (/!\ beware /!\, still experimental)
    - Horbach-Keele 'last' ratio (special tweeter) is now a different
      filter type for ease of use and clarity reasons
    - added some more window functions

0.7.6  2012-09-20
    - resolved (hopefuly) some issues with windows XP with the program
      refusing to actually start

0.7.5  2012-09-18
    - bug fix (crash during otpimisation step)

0.7.4  2012-09-16
    - bug corrections
    - optimization iterations are now faster
    - new optimization options ("moderate" and "extensive")
    - Horbach-Keele filters
      (ratio above 4.5 is the special "tweeter" ratio)
    - "Reject low" and "Reject high" filters for higher low or high rolloff

0.6.0  2012-08-26
    - first version on SourceForge
Attached Images
File Type: png FIR.PNG (61.7 KB, 3834 views)
File Type: png PEQ.PNG (55.6 KB, 3721 views)
File Type: png IIR linearization.PNG (55.9 KB, 3665 views)

Last edited by pos; 31st December 2013 at 10:21 AM.
  Reply With Quote
Old 12th October 2012, 05:03 PM   #2
diyAudio Member
 
Join Date: Mar 2011
Location: Rochester, MN
Cool! I've been wondering if anyone was going to come out with software with this kind of capability for free

I'm building new speakers right now and I'm an active xo kind of guy so hopefully I'll get some time to play with this this weekend.

Thanks!
  Reply With Quote
Old 12th October 2012, 09:49 PM   #3
KSTR is offline KSTR  Germany
diyAudio Member
 
KSTR's Avatar
 
Join Date: Jul 2007
Location: Central Berlin, Germany
Excellent!

I've been waiting for a phase EQ for some time, for transient (re-)shaping etc. I can do this, as well as lin-phase mag EQ, manually/iterative by EQ'ing diracs (with the time reversion trick) but a tool like this where you see what you get is of course much more convenient.

Did I miss something and one cannot load a pulse and apply your analytical correction on it (as an overlay on the graph) and see the result change directly instead of adjust/generate/convolve/measure cycles? I know that means quite a bit of additional programming and convolution, but any simple (time domain) algorithm would do since we're not realtime. That would really be a killer feature.

While one can do basic phase (& mag) correction with just HolmImpulse and Excel, your tool is much more versatile, thanks for sharing!
  Reply With Quote
Old 13th October 2012, 03:55 AM   #4
diyAudio Member
 
Join Date: Mar 2011
Location: Rochester, MN
Quote:
Originally Posted by KSTR View Post
Excellent!

Did I miss something and one cannot load a pulse and apply your analytical correction on it (as an overlay on the graph) and see the result change directly instead of adjust/generate/convolve/measure cycles?
That's how it looks to me as well.
  Reply With Quote
Old 13th October 2012, 10:22 AM   #5
pos is online now pos  Europe
diyAudio Member
 
pos's Avatar
 
Join Date: Feb 2008
Location: Paris
Hi

Thanks!
The possibility of importing a measurement into rephase (maybe only magnitude/phase curves, not a real impulse, to avoid impulse offset detection issues...) was on the work bench, but I am a little reluctant to add it: It would be too easy then to turn rephase into an automatic inverse correction tool (but without all the care that it would require to be made properly).
I would like to stay on the "manual" side with this tool.

That said, if things are made really clear for the user that no automatic correction must be made without a lot of car, then it could be an interesting addition.
By enabling the user to independently ignore or inverse the phase and amplitude of the measurement, it would also make it possible to import a correction from an external software like PORC, and "mix" (convolve) it with the current correction.

But importing measurements would still require an external tool such as HOLM to do the measurement and impulse offset detection though.

As it is now, to see the effect of a correction you can do the convolution inside HOLMImpulse, using the "C=A*B" manipulation : you put your measurement in one slot, the correction impulse in another, and you generate the result in the C slot.
So the correction cycle is quite easy to do: generate, import, convolve...
(and turning the optimization option to "none" to avoid waiting for its iterations every time...)

HOLM seems to be quite peaky with on some OS with this feature though...
On Win7 you have to import your impluse as a txt only (wav make it crash), and then convolution does not work all the time (sometime you even have to export and reimport your measurement as txt to make it work!).
It looks like it work without issue on XP though (IF you stay around 44khz or 48khz...)

Last edited by pos; 13th October 2012 at 10:38 AM.
  Reply With Quote
Old 13th October 2012, 10:46 AM   #6
KSTR is offline KSTR  Germany
diyAudio Member
 
KSTR's Avatar
 
Join Date: Jul 2007
Location: Central Berlin, Germany
Hi pos,

I'm fine when you decide NOT to add the import because I understand your motives.

Even without that option the software is excellent, and it's for free which we appreciate very much.
  Reply With Quote
Old 14th October 2012, 08:18 PM   #7
pos is online now pos  Europe
diyAudio Member
 
pos's Avatar
 
Join Date: Feb 2008
Location: Paris
New version 0.8.4, with a new "time: inv" option that can be used for ABX testing, to hear the effect of phase shifts form different filters at different frequencies with headphones for example (see changelog below).
Of course this option must not be used for normal filter linearizion, as it would double the original time shifts instead of correcting them

Download: rePhase on sourceforge

Code:
0.8.4  2012-10-14
    - new time inversion option in general tab, to reverse the generated
      impulse, thus opposing phase corrections. This can be used to better
      visually track a phase target (inverse during correction, and return
      to normal before generating the impulse), or to evaluate the
      audibility of a given correction with headphones for example (in this
      case the convolution of the impulse will simulate the speaker before
      correction)
    - confirmation box when exiting without saving modified correction
      settings, and avoid asking for confirmation on reset when correction
      where saved or loaded without modification
    - Improves advice section in the linear filter tab, and add one in the
      linearization tab

Last edited by pos; 14th October 2012 at 08:28 PM.
  Reply With Quote
Old 28th October 2012, 07:07 PM   #8
pos is online now pos  Europe
diyAudio Member
 
pos's Avatar
 
Join Date: Feb 2008
Location: Paris
rePhase 0.9.0 is online

Download: rePhase on sourceforge

Code:
0.9.0  2012-10-28
    - new file format '.rephase', saving/loading all settings, including
      correction settings, impulse settings, and graph settings
    - impulse file is now a three-part thing: directory, filename, and
      format extension. The directory is the only thing that is not saved
      in the '.rephase' file
    - new offset option "float" for fractional sample centering, avoiding
      HF ripples in the impulse when the phase target is not a multiple
      of 180° at the Nyquist frequency
    - make "rectangular" the default window function: this should be the
      best choice for phase-only corrections, and "complex" windowing is
      not needed anymore with the "float" offset
      Note: "rectangular" window is still likely to be the worst choice
      for filter generation, when gain target goes far below 0dB...
    - stereo wav formats are now available
    - bug correction in offset calculation in time=inv mode
  Reply With Quote
Old 28th October 2012, 11:53 PM   #9
diyAudio Member
 
Join Date: Jan 2008
Really need to allow import of real IR; hassles or not for user to get maximum utility from Paragraphic EQs.

Nice start to filter generation interface. Mostly more flexible than building filters with Audacity, but no match for Cool Edit.

Filters Linearization and Linear Filters:

Basic Linkwitz-Riley filter is cascaded Butterworth of appropriate order, to build linear phase version time reversal is simply done between applications of Butterworth.

So all-pass filter for desired frequency and order is generated and reversed in time.

I do this for Linkwitz-Riley 48dB/octave filter with your software, and import to Cool Edit for examination, and see you've done a pretty good job, but tail of result has ringing:

ring1.png

Ringing continues:

ring zoom1.png

And continues with math truncating results to steps, before hitting noise floor of math, granted this is way below 24bit integer floor:

ring zoom truncated math.png

Yes, linearization of phase for active circuits, analog or digital may have benefits, but it is real driver/cabinet/room behavior that provides the details in phase behavior, so again being able to import real IR is way to go.

Andrew
  Reply With Quote
Old 29th October 2012, 01:24 AM   #10
pos is online now pos  Europe
diyAudio Member
 
pos's Avatar
 
Join Date: Feb 2008
Location: Paris
Hello Andrew,

I do not plan to add IR import for the version 1.0.0 milestone, but that could come after that.
Sorry about that. I have to give it some more thoughts before choosing an integration strategy (and avoid the "automated correction" temptation...).
Right now you can use HOLMImpulse and the C=A*B manipulation to check the result of a given correction on a measurement.


Can you please give me the exact settings and version of rephase that generated the ringing shown in your screenshots?

Version 0.8.4 could generate a HF ringing at the Nyquist frequency when the phase target was not a multiple of 180° at the end of the spectrum (which was particularly the case with high order and high crossover freq filter linearizations...). This should now be fixed with the new "float" centering option (the phase target is artificially shifted to the nearest 180° multiple at the Nyquist frequency, and the impulse is then offset by the corresponding sample fraction to restore the original phase target).

Last edited by pos; 29th October 2012 at 01:41 AM.
  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
FIR linear phase plugin for MiniDSP? diyjb01 miniDSP 13 7th February 2014 01:24 AM
FIR filter design tool for Loudspeaker magnitude equalization ttmusic Software Tools 3 24th May 2013 08:30 PM
FIR Filtering experiences Olombo PC Based 8 10th February 2013 03:45 PM
AVX based FIR VST, crossover / EQ / DRC and delay KOON3876 PC Based 97 26th November 2012 07:18 AM
Phase EQ using FIR filters Grasso Multi-Way 2 2nd July 2003 10:37 PM


New To Site? Need Help?

All times are GMT. The time now is 11:18 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