Recording Impulse Responses for Speaker Virtualization
Apr 30, 2022 at 9:56 AM Post #1,306 of 1,817
Quick question, I'm trying new ways of getting a better result from my best measurement. Channel balance mid is helping but wanted more clarification on room measurement. I have room-BL-left, room-BL-Right, room-BR-left etc. Do I need to have a command when processing to have these "room".wav files included or does Impulcifer process everything together? Not sure If I should be using commands such as --fr_combination_method=average and --fr_combination_method=conservative. My room measurements were done for each ear for each speaker position.
Been a while since I've used room correction or read the documentation but I believe that as long as your file names are correct then the room correction will work just as you want it to. The fr_combination_method options are just different ways of processing the room correction vs. the default. I think of if them as similar to the channel_balance options (trend, mids, etc); they are alternatives to the default method but the processing still uses all available recorded speaker measurements.
 
Last edited:
Apr 30, 2022 at 1:28 PM Post #1,307 of 1,817
my first measurement with the master series...meh i don't know, i get a lot of zigzag in my graph, my last graph is with headroom 22!!! isn't that too much???

9O13bhv.png



plus the left and right mics gains are very unbalanced, even worst that the primo mics, i had to lower the right mic a lot
MQkeP5I.jpg


Do someone experienced the same issue? i had to lower both mics and headphone volume otherwise i get a lot of zigzag even at 10db headroom
 
Apr 30, 2022 at 2:30 PM Post #1,308 of 1,817
my first measurement with the master series...meh i don't know, i get a lot of zigzag in my graph, my last graph is with headroom 22!!! isn't that too much???

9O13bhv.png



plus the left and right mics gains are very unbalanced, even worst that the primo mics, i had to lower the right mic a lot
MQkeP5I.jpg


Do someone experienced the same issue? i had to lower both mics and headphone volume otherwise i get a lot of zigzag even at 10db headroom
How does it sound though? And what does the Results.png graph look like? The headphone graph isn't really all that useful for determining how it will sound but the Results.png can at least provide some insight as to the overall frequency response.

If you're getting a lot of sharp zipzagging in the headphones.png measurement then try lowering the playback in Windows/OS by about 30 notches or so and see what happens. Raise the gain on your speakers and your preamp to compensate. This solved the issue when I was getting the same issue since the it was caused be digital distortion when the sweep.wav was being played while taking measurements.

By the way, I used to try to match the gain on the microphones but stopped doing that once I realized that Impulcifer is pretty good at compensating for the difference - manually matching the gain didn't end in better results in all of my tests.
 
Last edited:
Apr 30, 2022 at 4:07 PM Post #1,309 of 1,817
How does it sound though? And what does the Results.png graph look like? The headphone graph isn't really all that useful for determining how it will sound but the Results.png can at least provide some insight as to the overall frequency response.

If you're getting a lot of sharp zipzagging in the headphones.png measurement then try lowering the playback in Windows/OS by about 30 notches or so and see what happens. Raise the gain on your speakers and your preamp to compensate. This solved the issue when I was getting the same issue since the it was caused be digital distortion when the sweep.wav was being played while taking measurements.

By the way, I used to try to match the gain on the microphones but stopped doing that once I realized that Impulcifer is pretty good at compensating for the difference - manually matching the gain didn't end in better results in all of my tests.

Thank you, i'm using the hrir right now and seems like the front left is a little bit inaccurate, i tried with some games and i can localize the front right very well but the front left is not well localized, the side left is well localized tho

this is my pre folder https://imgur.com/a/qqj6Ggw
and this is my post folder https://imgur.com/a/dMqtQdR

Do you see any discrepancies in the measuerements? what should i pay attention in the pre and post graphs?

i placed some pillows here and there to correct the overreverb i have and i think i exxagerated, tomorrow i'll try to lower the playback in windows like you suggest and remove some of the pillows, thank you
 
Apr 30, 2022 at 4:31 PM Post #1,310 of 1,817
Do you see any discrepancies in the measuerements? what should i pay attention in the pre and post graphs?

Whoah, your left and right measurements have WILDLY different noise levels! -- NEVERMIND, I just noticed that I had viewed one from your Post and one from your Pre folder on accident, oops! That's why the variance was so huge. Looking to see if I notice anything sticking out that might point to why the front left doesn't sound quite right...

Looking at your FC-left and FC-right measurements, it seems that you're getting fairly consistent measurements from the microphones, which is good, though there does seem to be more low-end ringing fairly late on the spectrogram at below 10hz, but that shouldn't affect localization too much. It might cause an annoying kind of low-end echo that MIGHT be noticeable, but that's so low that I doubt it'd be a problem. Overall, it looks good to me from what I can see from these plots.

My guess is that the poor localization you're getting on the front left might be a combination of both speaker placement and possibly head movement. Are you getting a nice, strong phantom center in the listening position where you recorded these? One thing I've found with Impulcifer is that little changes in position make a BIG difference, so getting your speaker and sitting position as optimal as possible makes more difference than you'd get compared to listening to your speakers ordinarily.

Also, is this with using a measurement mic and Impulcifer's room correction, and if so then are you using generic measurements or ear-specific ones? It might be worth processing the same BRIR without the room correction just to see if it's over-correcting anything due to incorrect mic placement. That can really throw a wrench in the quality of the results if not done correctly. I've found that to be less of an issue with generic room correction processing though, so if you're using ear-specific then it might be worth just trying out a single center-of-head measurement and using that for troubleshooting purpose, if nothing else.
 
Last edited:
Apr 30, 2022 at 5:23 PM Post #1,311 of 1,817
This is a bit weird I have been experimenting a little and found that with Impulcifer already including the headphone equalization I have good localization on my 5.1/7.1 games and movies. I then extracted my Headphone EQ from Impulcifer by using the script below as given earlier, and also included that into hesuvi virtualization. I know having double EQ should be bad but the localization and surround effect is so much more pronounced I'm having a hard time not using it. Can someone else try it and give their views?

import os

import numpy as np
import soundfile as sf
from matplotlib import pyplot as plt

from autoeq.frequency_response import FrequencyResponse
from impulse_response import ImpulseResponse
from impulse_response_estimator import ImpulseResponseEstimator


def equalize(dir_path,
sweep_duration=5,
target=('flat',),
record='headphones.wav',
fig='fig.png',
geq='geq.txt',
channel_balance=True,
max_gain=40, treble_f_lower=10000, treble_f_upper=20000):
record_path = os.path.join(dir_path, record)
record_data, sr = sf.read(record_path)
ire = ImpulseResponseEstimator(min_duration=sweep_duration, fs=sr)

frs = []
for ch in range(record_data.shape[1]):
ir = ImpulseResponse(ire.estimate(record_data[:, ch]), sr)
fr = ir.frequency_response()
fr.interpolate()

if ch >= len(target):
target_index = 0
else:
target_index = ch

if target[target_index] == 'flat':
target_fr = FrequencyResponse(name='flat', frequency=fr.frequency, raw=np.zeros(len(fr.frequency)))
else:
target_fr = FrequencyResponse.read_from_csv(target[target_index])

target_fr.interpolate()
fr.compensate(target_fr)
fr.equalize(max_gain=max_gain, treble_f_lower=treble_f_lower, treble_f_upper=treble_f_upper)
frs.append(fr)

if channel_balance:
ref = np.mean(frs[0].equalized_raw[np.logical_and(frs[0].frequency >= 100, frs[0].frequency <= 3000)])
gains = []
for fr in frs:
gain = ref - np.mean(fr.equalized_raw[np.logical_and(fr.frequency >= 100, fr.frequency <= 3000)])
gains.append(gain)

if geq:
channel_names = 'L R C LFE BL BR SL SR'.split()
geq_full = ''
max_raw = 0
for ch in range(len(frs)):
geq_full += f'Channel: {channel_names[ch]}\n'
if channel_balance:
geq_full += f'Preamp: {gains[ch]} dB\n'
max_raw = np.max(frs[ch].equalization)
geq_full += frs[ch].eqapo_graphic_eq(normalize=False) + '\n'
geq_full += f'\nChannel: ALL\nPreamp: {-max_raw} dB'

geq_path = os.path.join(dir_path, geq)
with open(geq_path, 'w') as geq_file:
geq_file.write(geq_full)

if fig:
fig_path = os.path.join(dir_path, fig)
figure = plt.figure()
ax = plt.gca()
figure.set_size_inches(10, 5)
a_min = np.median(frs[0].raw[:10000]) - 30
frs[0].plot_graph(fig=figure, ax=ax,
show=False, error=False, equalization=False, equalized=True, target=False,
raw_plot_kwargs={"label": "Left", "color": "red", "linewidth": 1})
frs[1].plot_graph(fig=figure, ax=ax,
show=False, error=False, equalization=False, equalized=True, target=False,

raw_plot_kwargs={"label": "Right", "color": "blue", "linewidth": 1})
plt.savefig(fig_path)


equalize(dir_path=r"C:\Windows\System32\Impulcifer\data\demo")
 
Apr 30, 2022 at 6:56 PM Post #1,312 of 1,817
Whoah, your left and right measurements have WILDLY different noise levels! -- NEVERMIND, I just noticed that I had viewed one from your Post and one from your Pre folder on accident, oops! That's why the variance was so huge. Looking to see if I notice anything sticking out that might point to why the front left doesn't sound quite right...

Looking at your FC-left and FC-right measurements, it seems that you're getting fairly consistent measurements from the microphones, which is good, though there does seem to be more low-end ringing fairly late on the spectrogram at below 10hz, but that shouldn't affect localization too much. It might cause an annoying kind of low-end echo that MIGHT be noticeable, but that's so low that I doubt it'd be a problem. Overall, it looks good to me from what I can see from these plots.

My guess is that the poor localization you're getting on the front left might be a combination of both speaker placement and possibly head movement. Are you getting a nice, strong phantom center in the listening position where you recorded these? One thing I've found with Impulcifer is that little changes in position make a BIG difference, so getting your speaker and sitting position as optimal as possible makes more difference than you'd get compared to listening to your speakers ordinarily.

Also, is this with using a measurement mic and Impulcifer's room correction, and if so then are you using generic measurements or ear-specific ones? It might be worth processing the same BRIR without the room correction just to see if it's over-correcting anything due to incorrect mic placement. That can really throw a wrench in the quality of the results if not done correctly. I've found that to be less of an issue with generic room correction processing though, so if you're using ear-specific then it might be worth just trying out a single center-of-head measurement and using that for troubleshooting purpose, if nothing else.

Yeah, i did just the center of the head room correction, this is my first measurement with this master series and i moved some pillows so i was expecting the measurement being not what i want achieve, tomorrow i will lower the mics gain in windows as you suggested and remove some of the pillows; anyway the umik does have a lot of noise due to the bad audio of the intergrated motherboard, is that a problem?


anyway i'm pretty sure can be something related to the mics placement in my ears or the right mic set too low compared to the left one, i'm not sure, i use a single speaker for the measurement so can be also related to my position during the measurements, of course my room is NOT ideal for recording (is my bedroom) but i'm trying my best to be in the center of the room; do you still suggest me to set the audio interface in instrument mode for both the mics?
 
Last edited:
Apr 30, 2022 at 8:05 PM Post #1,313 of 1,817
Yeah, i did just the center of the head room correction, this is my first measurement with this master series and i moved some pillows so i was expecting the measurement being not what i want achieve, tomorrow i will lower the mics gain in windows as you suggested and remove some of the pillows; anyway the umik does have a lot of noise due to the bad audio of the intergrated motherboard, is that a problem?


anyway i'm pretty sure can be something related to the mics placement in my ears or the right mic set too low compared to the left one, i'm not sure, i use a single speaker for the measurement so can be also related to my position during the measurements, of course my room is NOT ideal for recording (is my bedroom) but i'm trying my best to be in the center of the room; do you still suggest me to set the audio interface in instrument mode for both the mics?


Ah, using one speaker for the measurements is definitely doable with great results but it's also tough since you can't get a good feel for the stereo image and tweak placement in time. If you're not already, I recommend using a measuring tape and then mark the positions for the speakers ahead of time. I found that very helpful when I tried doing single-speaker measurements.

It's going to take a bit more trial and error than it would with two speakers but if you stick with it I think you'll be impressed with the results.

I don't have a UMIK mic but measurement microphones in general are noisy, that's just inherent in their design, so that is expected and likely won't make much of an impact on the room correction. I wouldn't worry too much about that.

In my experience the vast majority of the issues with my past measurements have been caused by the in-ear mic placement, especially problems caused by one being tilted towards the wall of the ear and getting muffled while the other is unobstructed.

I don't think that the instrument button has an affect when not connecting to the front inputs via 1/4th inch instrument cables, but I'd make sure they are both set to the same setting in case it does affect the gain. If they DO affect gain then setting to Instrument would supply more gain and Line would give less.
 
Last edited:
May 1, 2022 at 3:09 AM Post #1,314 of 1,817
Do someone experienced the same issue? i had to lower both mics and headphone volume otherwise i get a lot of zigzag even at 10db headroom
I have the same interface and mics and my results are similar to yours. My mics are more matched than yours it seems but I wouldnt worry about not having the gain knobs at the exact same level for both channels. I adjust them to where they are more or less matched and don't give too much weigh to their physical position. I also have a different interface that I will use to try and see if the results are the same.

do you still suggest me to set the audio interface in instrument mode for both the mics?
The line/instrument button has no effect when XLR mics are plugged in.
 
Last edited:
May 1, 2022 at 5:03 AM Post #1,315 of 1,817
I have the same interface and mics and my results are similar to yours. My mics are more matched than yours it seems but I wouldnt worry about not having the gain knobs at the exact same level for both channels. I adjust them to where they are more or less matched and don't give too much weigh to their physical position. I also have a different interface that I will use to try and see if the results are the same.


The line/instrument button has no effect when XLR mics are plugged in.
how much headroom do you get when doing good headphone measurerements with the ms? can you also tell me how you set the mics knobs?

i tried the trick @Brandon7s lowering the mics volume from windows but doesn't help, i still have zigzag when i'm lower than 22db headroom
KvFZMmg.png





EDIT

I removed some pillows and cut the ear foam a little bit so i could place the mics more deep inside

I like the results despite still the 11db headroom for the mics and 20db for the speaker measurements,

this is my test n.11 https://drive.google.com/file/d/14tmXSLxXXXSXMioAZ_GW-gDeh67yqsMM/view?usp=sharing

now i start to understand why you guys do 100+ measurements, it's like discovering a new treasure every time, you just can't stop trying new stuff

hRnK8z2.png


I also there's not much difference with and without the channel balance set to TREND, very good this means i got a good positioning this time, right?
 
Last edited:
May 1, 2022 at 8:51 AM Post #1,316 of 1,817
how much headroom do you get when doing good headphone measurerements with the ms? can you also tell me how you set the mics knobs?

i tried the trick @Brandon7s lowering the mics volume from windows but doesn't help, i still have zigzag when i'm lower than 22db headroom
KvFZMmg.png





EDIT

I removed some pillows and cut the ear foam a little bit so i could place the mics more deep inside

I like the results despite still the 11db headroom for the mics and 20db for the speaker measurements,

this is my test n.11 https://drive.google.com/file/d/14tmXSLxXXXSXMioAZ_GW-gDeh67yqsMM/view?usp=sharing

now i start to understand why you guys do 100+ measurements, it's like discovering a new treasure every time, you just can't stop trying new stuff






hRnK8z2.png


I also there's not much difference with and without the channel balance set to TREND, very good this means i got a good positioning this time, right?
When you say zigzag are you really referring to the big spikes/dips at about about 12kHz or so? That's the only place I see any real zizagging, the rest looks good to me. My headphone graphs for some of my favorite measurement look FAR more uneven and choppy than yours so below that point and sound great.

The spikes/dips above 12kHz are a bit extreme but aren't too far off from how the high frequency content looks on my own measurements. Most of that isn't going to be audible though, since it's so high frequency. I don't know what causes it but that doesn't look like distortion. Distortion is easier to see in the low frequencies and those look decent on your graph but my guess is they are caused by noise since the pattern looks so irregular, I doubt that such small variances will have a noticeable impact on the final results though.

By the way, if you want to reduce your headroom then crank the preamp gain on your mic inputs up. It looks like you have plenty of room to turn it higher.l from the knob positions in your photos. I usually aim for 6dB but I've gotten excellent sounding measurements at above 10dB before. 11dB ain't too low for good results. The speaker measurement being at about 20dB Is a bit low. How high do you have the gain knobs when taking the speaker measurements? If you've got more room to turn up the preamp gain, try it.

If you have the gain maxed on the speaker measurements though then that's a bit more of a challenge and the only other option is to make your speakers louder or get another interface (or stand-alone preamp) with more preamp gain on tap.
 
Last edited:
May 1, 2022 at 9:45 AM Post #1,317 of 1,817
When you say zigzag are you really referring to the big spikes/dips at about about 12kHz or so? That's the only place I see any real zizagging, the rest looks good to me. My headphone graphs for some of my favorite measurement look FAR more uneven and choppy than yours so below that point and sound great.

The spikes/dips above 12kHz are a bit extreme but aren't too far off from how the high frequency content looks on my own measurements. Most of that isn't going to be audible though, since it's so high frequency. I don't know what causes it but that doesn't look like distortion. Distortion is easier to see in the low frequencies and those look decent on your graph but my guess is they are caused by noise since the pattern looks so irregular, I doubt that such small variances will have a noticeable impact on the final results though.

By the way, if you want to reduce your headroom then crank the preamp gain on your mic inputs up. It looks like you have plenty of room to turn it higher.l from the knob positions in your photos. I usually aim for 6dB but I've gotten excellent sounding measurements at above 10dB before. 11dB ain't too low for good results. The speaker measurement being at about 20dB Is a bit low. How high do you have the gain knobs when taking the speaker measurements? If you've got more room to turn up the preamp gain, try it.

If you have the gain maxed on the speaker measurements though then that's a bit more of a challenge and the only other option is to make your speakers louder or get another interface (or stand-alone preamp) with more preamp gain on tap.

No i was referring to the up and down curves i get at 200hz and above, never had with the primo mics...

the speaker output knob is set at 2 o'clock, and the mics are also somewhere there while i set the mic gain 30 in windows like you see in the screen
DHCgRSi.jpg


I'm very happy with the results despite the 20db headroom for the speaker, tomorrow i will try again
 
Last edited:
May 1, 2022 at 3:32 PM Post #1,318 of 1,817
how much headroom do you get when doing good headphone measurerements with the ms? can you also tell me how you set the mics knobs?

i tried the trick @Brandon7s lowering the mics volume from windows but doesn't help, i still have zigzag when i'm lower than 22db headroom
I get around 8-12db headroom, sometimes a little more or less. I make sure the room is quiet (no fans, or other ambient noise) and adjust the gains so that the signal LEDs are blinking at about the same rate for both channels. I found that if you back off the gain to the point where you arent pickup up ANY signal, the overall headroom is too high. Picking up a little intermittent signal on the indicator before you start isnt a problem if your recorded signal is decent volume; you will get a good SNR. Knobs are around 12 o'clock position or maybe higher. I'll verify in the headphones plot that the L and R channels are about even in amplitude. Here's one from my latest session. I also have the small zigzag at around 1k, not sure why but mine seems slightly less severe than yours.
 

Attachments

  • headphones.png
    headphones.png
    43.7 KB · Views: 0
May 2, 2022 at 10:45 AM Post #1,319 of 1,817
ok i did 3 measurements today, same position same room, same of everything, i cut some of the ear foam to be able to plug them deeper and i reset the mics gain to 100 in windows, considering the previous measurement i was expecting a better result, oh my, they are the worst of the worst for some reason! no clarity, the sound is like muffled and inside my head, it's the total opposite i achieved in the previous measurement!!!
I spent a lot of time positioning the mics inside my ears so they were facing exactly outside my ears.

I got somehow both good headroom (4DB or so) a good curve but the result is bad bad bad!
PcJwpJD.png

PRE: https://imgur.com/a/aDYivdQ
POST: https://imgur.com/a/OrFz1RH


you can compare it with my best measurement with the same speaker positioning, the one i got 11db headroom for headphones and 20db for speakers:
PRE: https://imgur.com/a/0QvFnnJ
POST: https://imgur.com/a/wHCxeFy



again, i'm struggling to find a reason why i got so difference despite the speaker position is the same for both the measurements: maybe is the headroom too low? maybe is that i set back the mics gain to 100 in windows? or the reason is that i cut the ear foam to slip them more inside? i don't really know, i'm shocked, really





EDIT

seems like a stability factor, probably cutting the foam wasn't the smartest idea, the mics weren't stable anymore so they moved along the measurement, that's why i get the muffled sound
 
Last edited:
May 2, 2022 at 12:31 PM Post #1,320 of 1,817
ok i did 3 measurements today, same position same room, same of everything, i cut some of the ear foam to be able to plug them deeper and i reset the mics gain to 100 in windows, considering the previous measurement i was expecting a better result, oh my, they are the worst of the worst for some reason! no clarity, the sound is like muffled and inside my head, it's the total opposite i achieved in the previous measurement!!!
I spent a lot of time positioning the mics inside my ears so they were facing exactly outside my ears.

I got somehow both good headroom (4DB or so) a good curve but the result is bad bad bad!
PcJwpJD.png

PRE: https://imgur.com/a/aDYivdQ
POST: https://imgur.com/a/OrFz1RH


you can compare it with my best measurement with the same speaker positioning, the one i got 11db headroom for headphones and 20db for speakers:
PRE: https://imgur.com/a/0QvFnnJ
POST: https://imgur.com/a/wHCxeFy



again, i'm struggling to find a reason why i got so difference despite the speaker position is the same for both the measurements: maybe is the headroom too low? maybe is that i set back the mics gain to 100 in windows? or the reason is that i cut the ear foam to slip them more inside? i don't really know, i'm shocked, really
Your frequency response graphs in the POST folder show a pretty big valley between 4kHz and 9kHz which is probably why they sound so muffled. As to what caused that dip, there's no way for us to know for sure. I would assume that it's due to mic placement though and the only way to sort that out is through trial and error, unfortunately.

Are you doing the full 7.1 every time you make a measurement? I'd recommend just doing normal stereo measurements with just the front left and front right speakers while you are experimenting. I can't imagine that doing full surround measurements is a quick process when using one speaker, but if it is then ignore that recommendation. :stuck_out_tongue:

Try out different depths systematically, if you can. One thing that I did after about 60 different measurements, instead of being smart and doing it early on, is to make 3 measurements in a session at different mic depths. Starting with the mics inserted as far as possible without serious discomfort and then pulling the mic out a little bit at a time for the following measurements, so I ended up with a deep measurement, a medium depth one, and then a shallow measurement. I then tried out all three and greatly preferred the deepest one. That might not be the case for everyone though and the only way to find out is to try it. Unfortunately this is the hard part about using Impulcifer due to the fact that everyone's ears are different and the mics aren't purpose-built for this kind of thing and they are very easy to accidentally obstruct due to their size. You might also want to try changing the path of the mic cables, too. The cable is pretty thick on these mics compared to the structure of the ear so if you normally wrap the cable up and over the ear like one typically does with IEMs then maybe try having them hang loose straight towards the ground like one would earbuds instead and see if that makes any difference.


This is a bit weird I have been experimenting a little and found that with Impulcifer already including the headphone equalization I have good localization on my 5.1/7.1 games and movies. I then extracted my Headphone EQ from Impulcifer by using the script below as given earlier, and also included that into hesuvi virtualization. I know having double EQ should be bad but the localization and surround effect is so much more pronounced I'm having a hard time not using it. Can someone else try it and give their views?

import os

import numpy as np
import soundfile as sf
from matplotlib import pyplot as plt

from autoeq.frequency_response import FrequencyResponse
from impulse_response import ImpulseResponse
from impulse_response_estimator import ImpulseResponseEstimator


def equalize(dir_path,
sweep_duration=5,
target=('flat',),
record='headphones.wav',
fig='fig.png',
geq='geq.txt',
channel_balance=True,
max_gain=40, treble_f_lower=10000, treble_f_upper=20000):
record_path = os.path.join(dir_path, record)
record_data, sr = sf.read(record_path)
ire = ImpulseResponseEstimator(min_duration=sweep_duration, fs=sr)

frs = []
for ch in range(record_data.shape[1]):
ir = ImpulseResponse(ire.estimate(record_data[:, ch]), sr)
fr = ir.frequency_response()
fr.interpolate()

if ch >= len(target):
target_index = 0
else:
target_index = ch

if target[target_index] == 'flat':
target_fr = FrequencyResponse(name='flat', frequency=fr.frequency, raw=np.zeros(len(fr.frequency)))
else:
target_fr = FrequencyResponse.read_from_csv(target[target_index])

target_fr.interpolate()
fr.compensate(target_fr)
fr.equalize(max_gain=max_gain, treble_f_lower=treble_f_lower, treble_f_upper=treble_f_upper)
frs.append(fr)

if channel_balance:
ref = np.mean(frs[0].equalized_raw[np.logical_and(frs[0].frequency >= 100, frs[0].frequency <= 3000)])
gains = []
for fr in frs:
gain = ref - np.mean(fr.equalized_raw[np.logical_and(fr.frequency >= 100, fr.frequency <= 3000)])
gains.append(gain)

if geq:
channel_names = 'L R C LFE BL BR SL SR'.split()
geq_full = ''
max_raw = 0
for ch in range(len(frs)):
geq_full += f'Channel: {channel_names[ch]}\n'
if channel_balance:
geq_full += f'Preamp: {gains[ch]} dB\n'
max_raw = np.max(frs[ch].equalization)
geq_full += frs[ch].eqapo_graphic_eq(normalize=False) + '\n'
geq_full += f'\nChannel: ALL\nPreamp: {-max_raw} dB'

geq_path = os.path.join(dir_path, geq)
with open(geq_path, 'w') as geq_file:
geq_file.write(geq_full)

if fig:
fig_path = os.path.join(dir_path, fig)
figure = plt.figure()
ax = plt.gca()
figure.set_size_inches(10, 5)
a_min = np.median(frs[0].raw[:10000]) - 30
frs[0].plot_graph(fig=figure, ax=ax,
show=False, error=False, equalization=False, equalized=True, target=False,
raw_plot_kwargs={"label": "Left", "color": "red", "linewidth": 1})
frs[1].plot_graph(fig=figure, ax=ax,
show=False, error=False, equalization=False, equalized=True, target=False,

raw_plot_kwargs={"label": "Right", "color": "blue", "linewidth": 1})
plt.savefig(fig_path)


equalize(dir_path=r"C:\Windows\System32\Impulcifer\data\demo")
The furthest I've gotten into programming is making Autohotkey scripts to make my life easier, but I'd be willing to try this out if I knew how to use it. Would I just paste all of this into a text file or something?
 
Last edited:

Users who are viewing this thread

Back
Top