Old 07-16-2021, 08:33 PM   #1
Thuneau
Human being with feelings
 
Join Date: Nov 2006
Posts: 242
Default ReaFir coefficients export?

I really like the linear phase crossover that Dan Worall made in this video: https://www.youtube.com/watch?v=951MnO8M1Qs . He uses two instances of ReaFir and clever routing to make a phase perfect crossover for multiband processing.

I would like to reproduce this method in a hardware DSP that has FIR filter blocks available. But, I need to load the coefficients from a text file.

Is it possible to get the coefficients from ReaFir (doubt it), and if not, what third party tool could be used to generate the equivalent?
Thuneau is offline   Reply With Quote
Old 07-16-2021, 11:42 PM   #2
rafa1981
Human being with feelings
 
Join Date: Feb 2008
Posts: 188
Default

Matlab, Octave, Scipy and many more have functions to calculate coefficients for FIR filters, usually on a package called "signal".

E.g.
https://docs.scipy.org/doc/scipy/ref...al.firwin.html
rafa1981 is offline   Reply With Quote
Old 07-17-2021, 11:15 AM   #3
Thuneau
Human being with feelings
 
Join Date: Nov 2006
Posts: 242
Default

I found a cool little program called rePhase that generates and optimizes FIR coefficients for arbitrary frequency response. It's meant to help with loudspeaker design and reproduction, but it works great for what I need.

The only problem I have is that there is no direct equivalent of ReaFir when it comes to parameter setting.

I doubt that the FIR filters generated by rePhase would null with the source perfectly like ReaFir filters do in the Dan Worall video. That's because they still do have some ripple after design and optimization. Whatever algorithm ReaFir is using nulls perfectly with the source. I followed the video and tried for myself.
Thuneau is offline   Reply With Quote
Old 07-19-2021, 05:21 AM   #4
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 346
Default

Quote:
Originally Posted by Thuneau View Post
The only problem I have is that there is no direct equivalent of ReaFir when it comes to parameter setting.
SciPy can read and write WAV files, and should be able to generate whatever text format you need.

If you stick an impulse (a WAV with [1, 0, 0, ....]) through ReaFIR, you'll capture the impulse response. If you export the result as a 32-bit WAV (trimmed appropriately), you should be able to convert that WAV into the text format you need using Python.

Having said that: I'm pretty sure ReaFIR is using cubic curves on a logarithmic frequency scale. It does its processing in the frequency domain, rather than producing an IR (so isn't actually completely linear, but the errors are usually miniscule), but it should be very possible to create IRs for the same shape of filters in Python.

You'd probably want to: (a) produce a Hz->dB function following the cubic curve, (b) assemble a spectrum, (c) IFFT, (d) apply some windowing.
__________________
JSFX set | Bandcamp/SoundCloud/Spotify
geraintluff is offline   Reply With Quote
Old 07-20-2021, 01:45 AM   #5
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 346
Default

Quote:
Originally Posted by Thuneau View Post
Whatever algorithm ReaFir is using nulls perfectly with the source. I followed the video and tried for myself.
It's not actually ReaFIR that makes this null perfectly, it's the routing in REAPER (specifically, flipping the polarity).

Any linear-phase high/low filters (with appropriate latency compensation!) can be used for this. Mathematically, if:

Code:
mid = original - high - low
then:
Code:
high + low + mid = original
As long as you compensate for the latency of the linear-phase high/low filters, this will give the perfect-reconstruction bandsplit you want.
__________________
JSFX set | Bandcamp/SoundCloud/Spotify
geraintluff is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -7. The time now is 08:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.