Created
August 4, 2023 11:56
-
-
Save NullMember/2dcdefdd6f9ec90f21a86183e249bd7c to your computer and use it in GitHub Desktop.
REW EQ file to EQ preset converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from EQPreset import ProQ3Preset, ReaEQPreset, ReaFIRPreset, SupportedEQs | |
import regex | |
eq_mode = SupportedEQs.ReaEQ | |
input_filename = "eq.txt" | |
output_filename = "eq" | |
placement = ProQ3Preset.Band.Placement.Stereo #Only applicable to Q3 | |
bands = None | |
with open("eq.txt", "r") as f: | |
file = f.read() | |
pattern = regex.compile("Filter\s+(\d+):\s+\w+\s+\w+\s+\w+\s+(.*) Hz\s+\w+\s+(.*) dB\s+\w+\s+(.*)") | |
bands = regex.findall(pattern, file) | |
if eq_mode == SupportedEQs.ProQ3: | |
preset = ProQ3Preset() | |
for band, frequency, gain, q in bands: | |
band = int(band) - 1 | |
preset.bands[band].used = True | |
preset.bands[band].frequency = float(frequency) | |
preset.bands[band].gain_db = float(gain) | |
preset.bands[band].q = float(q) | |
preset.bands[band].placement = placement | |
preset.save_to_file(output_filename) | |
elif eq_mode == SupportedEQs.ReaEQ: | |
preset = ReaEQPreset(output_filename) | |
for band, frequency, gain, q in bands: | |
preset.add_band( | |
ReaEQPreset.Band.Shape.Band, | |
True, | |
float(frequency), | |
float(gain), | |
float(q) | |
) | |
preset.save_to_file(output_filename) | |
elif eq_mode == SupportedEQs.ReaFIR: | |
preset = ReaFIRPreset(output_filename) | |
for band, frequency, gain, q in bands: | |
preset.add_band( | |
float(frequency), | |
float(gain) | |
) | |
preset.save_to_file(output_filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to install this library to use this script.