Git Product home page Git Product logo

impulcifer's People

Contributors

godlovesdavid avatar jaakkoai avatar jaakkopasanen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

impulcifer's Issues

New Error since Update

Tried to do a new recording today and getting the following error when trying to process recordings. I am using --no_room_correction. Seems to be related to the most recent update.

(venv) C:\Users\dushy\Impulcifer>python impulcifer.py --test_signal="data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl" --dir_path="data/my_hrir" --no_room_correction
Traceback (most recent call last):
  File "impulcifer.py", line 494, in <module>
    main(**create_cli())
  File "impulcifer.py", line 71, in main
    target = create_target(estimator, bass_boost_gain, bass_boost_fc, bass_boost_q, tilt)
  File "impulcifer.py", line 325, in create_target
    target.raw = target.create_target(
AttributeError: 'FrequencyResponse' object has no attribute 'create_target'

When I revert back to the previous commit with git checkout recordings process fine

Weirdly on a completely fresh install it works fine.

HRIR Volume Is Low

HRIR output volume and especially headphone compensation impulse response volume level are too low. Calculate final output volume level and amplify the HRIR to a maximum level which does not produce clipping.

Spectrogram

Add spectrogram to each impulse response's plot figure. Implement spectrogram with logarithmic frequency axis for easier inspection. 3D surface plot would be preferable to the heat map plot.

New error after the last update, also in the demo

(venv) C:\ProgramsPortable\Impulcifer>python impulcifer.py --test_signal=D:\I\Impulcifer_Data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --room_mic_calibration=D:\I\Impulcifer_Data\demo\room-mic-calibration.txt --room_target=D:\I\Impulcifer_Data\room-target.csv --fs=96000 --dir_path=D:\I\Impulcifer_Data\demo --plot

Traceback (most recent call last):
  File "impulcifer.py", line 536, in <module>
    main(**create_cli())
  File "impulcifer.py", line 112, in main
    raw=0, error=0
  File "C:\ProgramsPortable\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 76, in __init__
    self.raw = self._init_data(raw)
  File "C:\ProgramsPortable\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 108, in _init_data
    data = [None if x is None or math.isnan(x) else x for x in data]
TypeError: 'int' object is not iterable

Sibilant/Bright Headphone Issue (DT990)

I mentioned this on Head-Fi.

When using Headphone Compensation on the DT990 the horrible Siblant treble that headphone naturally has doesn't go away.

When using the no headphone compensation flag for HRIR calculation and instead, relying on Oratory's measurement source and computing a flat EQ via Auto EQ the sound is much better and no horrific treble.

I'm pretty sure this isn't a preference thing - it's not there in the original speaker/room. I also tried A vs Bing the headphone compensation between the DT990 and a Aurvana SE and the Aurvana has no such issue.

I believe the headphone compensation has a hard time with these sorts of issues. It might speak more to headphone selection or relying on GRAS measurements than a fix - but worth nothing.

I've uploaded my headphone.wav here

I've also included a channel ID check of a female human voice which makes the issue very clear.

And my computation of the flat EQ that works well

Edit: Added the full output from AutoEQ's flat calculation to the link too.

Error with --help Verify installation

(venv) C:\Program Files\EqualizerAPO\config\Impulcifer-master>python impulcifer.py --help
Traceback (most recent call last):
File "impulcifer.py", line 9, in
from scipy import signal
File "C:\PROGRA1\EQUALI1\config\IMPULC1\venv\lib\site-packages\scipy\signal_init_.py", line 289, in
from . import sigtools, windows
File "C:\PROGRA
1\EQUALI1\config\IMPULC1\venv\lib\site-packages\scipy\signal\windows_init_.py", line 41, in
from .windows import *
File "C:\PROGRA1\EQUALI1\config\IMPULC1\venv\lib\site-packages\scipy\signal\windows\windows.py", line 9, in
from scipy import fftpack, linalg, special
File "C:\PROGRA
1\EQUALI1\config\IMPULC1\venv\lib\site-packages\scipy\linalg_init_.py", line 213, in
from .sketches import *
File "C:\PROGRA1\EQUALI1\config\IMPULC1\venv\lib\site-packages\scipy\linalg_sketches.py", line 11, in
from scipy.sparse import csc_matrix
File "C:\PROGRA
1\EQUALI1\config\IMPULC1\venv\lib\site-packages\scipy\sparse_init
.py", line 230, in
from .csr import *
File "C:\PROGRA1\EQUALI1\config\IMPULC~1\venv\lib\site-packages\scipy\sparse\csr.py", line 13, in
from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks,
ImportError: DLL load failed: The specified module could not be found.

i got bad sectors in old disk i replaced to new hard drive.This are Fresh installation.And Python version i installed 3.7.4

Documentation

Write documentation including installing, using and recording. Write descriptions about implemented algorithms.

7.1 Channel Sweep

The spinorama is great for when you have two speakers but it's so much quicker to just measure a pre-existing multi channel setup if you have one.

Could we get a sweep that outputs in 7 channels?

I tried to open up the dirac 7 channel impulse and paste in the sweeps - but Audacity confuses me because the first track appears in stereo and the rest are mono.

Reducing Impulse Response Pre-ringing

Impulse responses estimated with logarithmic sine sweeps and inverse filtering have some amount of pre-ringing caused by fade-in and fade-out of the sine sweep. Fades cannot be simply removed because that will introduce greater problems.

High frequency pre-ringing can be removed by setting the end frequency to half of sampling frequency (or higher?) and cutting out the tail at the last zero-crossing.

Low frequency pre-ringing cannot be done similarly because the fade-in cannot be removed. Instead a compacting filter can be constructed for removing the low frequency pre-ringing. See this paper by Angelo Farina for comments and references: http://pcfarina.eng.unipr.it/Public/Papers/238-NordicSound2007.pdf

Tensorflow Errors or Warnings

python impulcifer.py --dir_path=data/demo --test_signal=data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav
WARNING:tensorflow:From C:\Users\dvenk\Documents\GitHub\Impulcifer\venv\lib\site-packages\tensorflow_core\python\compat\v2_compat.py:65: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
(venv)

Suggestion: Amplify/Normalize HRIR

My HRIR has a very low volume relative to others that ship with HeSuVi. I can fix this via applying a 13db boost in peace. The problem with that method is that I then can't A vs B the other HRIR's because they're much too loud.

Would it be possible to normalise the level so that it matches the default ones in HeSuVi?

Channel Balance Correction

As requested on Headfi.

Issue: channel balance due to binural mic placement with my Sound Professional mics.

Is there a way we can ask Impulcifer to assume channel balance with the headphones and then attenuate L or R to get balance?

When I correct for it via HeSuVi's attenuation I'm hard pressed to find anything "wrong" with the sound. It sounds really good and is bang on center then. Again I A vs B against the real speakers and they're remarkably similar. It's not identical though, but even my naturally perfect measurement wasn't identical.

Room Correction causes bass bleed into other (virtual) channels

My usual recording consists of replicating my real surround system that uses LS0's and a sub. Virtual Room correction on that works fine.

Yesterday I tried to measure only my LS50's in "pure direct" mode - so no subwoofer for the bass.

When I ran the room correction on a channel ID test for the front channels you could hear an odd echo from the side or rear channels. I thought this might be a recording error so I re-ran. Same issue.

Without virtual room correction this goes away. I suspect the room correction is boosting above 80hz frequencies too much which confuses the HRTF. The issue does not manifest when I'm taking recordings at around 4-6 feet, likely cause the LS50's can produce enough bass even without a boundary but when I move back, the echo's there.

10mb was the max file size on Git so I uploaded to Google and the channel ID check is here

Manual Equalization

Headphone compensation does not take into account the fact that even around ear open back headphones alter ear canal resonances by dampening some frequencies and shifting peaks and notches. In addition headphone compensation is not possible at all with in-ear monitors.

Implement manual equalization where user creates equal loudness contour by comparing 1/3 octave band noises against each other or single anchor band (such as ~630 Hz) and adjusting gain for each band. This is to be done once with speakers that are used for measurement and once with headphones and speaker virtualization without any modifications to the impulse responses. These two curves can then be used to calculate equalization curve which counters the headphone's effect on ear canal resonance. After the calibration virtualized speaker (without any modifications to impulse response) should sound exactly like the real speaker.

It's important to do the equal loudness contour with virtualized speaker where there have not been any modification to the impulse responses. Cropping out tail, using tracking filter and other things will affect the overall frequency response of the system after which the real speakers and virtualized speakers are not comparable anymore. Once the calibration has been done any modifications to impulse responses for room correction etc can be done.

Headphone Transform EQ Error

Trying to nail a transform from a Bose 700 headphone measurement to Air Pods Pro.

I ran the following command in AutoEQ:

python autoeq.py --input_dir="C:\Users\dushy\AutoEq\oratory1990\data\earbud\Apple Airpods Pro" --output_dir="my_results/APP (Bose700) mk3" --compensation="compensation/harman_in-ear_2019v2.csv" --sound_signature="C:\Users\dushy\AutoEq\results\oratory1990\harman_over-ear_2018\Bose Noise Cancelling Headphones 700\Bose Noise Cancelling Headphones 700.csv" --equalize --parametric_eq --max_filters=5+5 --ten_band_eq --bass_boost=4

However, Impulcifer doesn't seem to like the eq.csv output from AutoEQ and throws the following error:

(venv) C:\Users\dushy\Impulcifer>python impulcifer.py --test_signal="data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl" --dir_path="data/my_hrir" --fs=44100
Traceback (most recent call last):
  File "impulcifer.py", line 499, in <module>
    main(**create_cli())
  File "impulcifer.py", line 115, in main
    fr.error += eq.error
ValueError: operands could not be broadcast together with shapes (641,) (0,) (641,)

I've run other transforms fine - but I'm trying to nail a good HRIR for my Air Pods Pro so experimenting with different headphones and measurement sources. This particular one is throwing that error.

I've uploaded the eq.csv here

Test Signal Generator

Add main function to ImpulseResponseEstimator with command line interface for generating logarithmic sine sweep test signals and test signal sequences. Frame rate, duration, speaker playback order for sequence and output path should be adjustable with the CLI. File needs to be FLAC because WAV channel order beyond two channels cannot be trusted.

7.1 Surround FL Lower Delay

Greetings @jaakkopasanen ! I have recently found out about your project Impulcifer and I have to say it's pretty cool! I've been doing my own headphone equalizing journey for a good while now. I just received my own IEM in the mail yesterday just to try out your method. :)

I was successful in recording all 7 channels via doing the mono speaker method (as I only have one to work with at the moment), though I got an error regarding that the FL channel has a lower delay of the right ear compared to the left ear. Which is funny cause I checked my recordings by ear and it does seem ok for FL as I try to get it to be distinguished compared to SL. Is there something I'm doing wrong? I can upload my audacity project if you have the time to take a quick look.

Doing this method is fun but super tedious when trying to get everything perfect (i.e. putting on the darn IEM's properly ugh).

Thanks in advance and keep up the good work!! :D

7.1_Surround Sound_v2.zip

Early Reflection Removal

Early reflections are very detrimental to imaging and should be avoided whenever possible in the room acoustics design. Impulcifer should be able to reduce amplitude of early reflections for cases when room acoustic treatment is not possible.

Filtering out frequencies that have been excited less than 5 to 20 ms ago with the tracking filter might not be possible because the frequency played only 5 to 20 ms ago is very close to the frequency playing right now and the band-pass filter would need to have too steep notch.

More likely approach is to reduce amplitude of the impulse response with a Tukey window function where the window spans from current time step to 20 ms back.

--Plot error

Impulcifer outputs fine when I run the normal process command without the plot. But when I add the plot switch I get an error. Updated to latest

(venv) C:\Users\dushy\Impulcifer>python impulcifer.py --test_signal="data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl" --dir_path="data/my_hrir" --no_room_correction --channel_balance=3.0 --plot
 ** On entry to DLASCLS parameter number  4 had an illegal value
 ** On entry to DLASCLS parameter number  4 had an illegal value
Traceback (most recent call last):
  File "impulcifer.py", line 489, in <module>
    main(**create_cli())
  File "impulcifer.py", line 121, in main
    hrir.plot(os.path.join(dir_path, 'plots', 'post'))
  File "C:\Users\dushy\Impulcifer\hrir.py", line 354, in plot
    plot_waterfall=plot_waterfall
  File "C:\Users\dushy\Impulcifer\impulse_response.py", line 221, in plot
    self.plot_fr(fig=fig, ax=ax[1, 1])
  File "C:\Users\dushy\Impulcifer\impulse_response.py", line 389, in plot_fr
    fr.smoothen_fractional_octave(window_size=1/3, treble_f_lower=20000, treble_f_upper=23999)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 1180, in smoothen_fractional_octave
    treble_f_upper=treble_f_upper
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 1137, in _smoothen_fractional_octave
    y_normal = savgol_filter(y_normal, self._window_size(window_size), 2)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\scipy\signal\_savitzky_golay.py", line 337, in savgol_filter
    coeffs = savgol_coeffs(window_length, polyorder, deriv=deriv, delta=delta)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\scipy\signal\_savitzky_golay.py", line 139, in savgol_coeffs
    coeffs, _, _, _ = lstsq(A, y)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\scipy\linalg\basic.py", line 1218, in lstsq
    raise LinAlgError("SVD did not converge in Linear Least Squares")
numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares

Reverberation Time Adjustment

Standard for reverberation time in studios is 300ms. Typical listening room at home as a lot longer reverberation time and therefore HRIR measured in such a room will not give the listener the experience "as the mixing engineer intended". Different applications have different needs for reverberation so the time should be adjustable with Impulcifer. Add --reverberation_time parameter to Impulcifer.

There are two approaches for implementing the reverberation time adjustment. Simpler one includes cropping out the tail of the impulse response with a window function such as Hanning. Probably the window function peak needs to be at the impulse response peak and window length should be calculated so that the filtered signal has been reduced by 60 dB at the reverberation time.

Second approach is to do the reverberation time adjustment in the sine sweep recording. Because there is only one frequency playing at any given time and the frequency ascend is known, it it possible to calculate how long ago a certain lower frequency was excited. Any frequency excited exactly the target reverberation time ago should be attenuated by 60 dB at current time steps and all the time steps in between should be linearly related. If 200 Hz was excited 150 ms ago and the target reverberation time is 300 ms then 200 Hz should be at -30 dB currently. If it is for example -20 dB then the current tracking filter needs to reduce 200 Hz by 10 dB. Waterfall plot might be useful for determining the level of a given frequency at current time step.

The second approach is a lot more powerful than the first one because it makes it possible to make reverberation times of all frequencies equal while the first approach will only crop the tail without any regard to reverberation times of individual frequencies. On the other hand this might not be true because typically bass frequencies reverb longer because of standing waves so the impulse response tail would contain mostly bass reverberation and it would be mostly the bass reverberation that is going to be reduced naturally equalizing the reverberation times of individual frequencies.

Output Sampling Rate

Measuring at the same sampling rate as the HRIR needs to be might not be optimal. Although 44.1 kHz is enough for human hearing, deconvolution migth work better if the recording has been made with higher sampling rate such as 192 kHz. If such a high sampling rate is used for recording the HRIR needs to be re-sampled down to 44.1 kHz or 48 kHz.

Add --fs parameter to Impulcifer and implement sampling rate conversion for the final result.

Error, don't create hrir.wav

(venv) C:\ProgramsPortable\Impulcifer>python impulcifer.py --test_signal=D:\I\Impulcifer_Data\sweep-12.30s-48000Hz-24bit-2.93Hz-24000Hz.pkl --fs=96000 --dir_path=D:\I\Impulcifer_Data\my_hrir_01_48k
Traceback (most recent call last):
  File "impulcifer.py", line 489, in <module>
    main(**create_cli())
  File "impulcifer.py", line 94, in main
    plot=plot
  File "impulcifer.py", line 217, in correct_room
    fr = ir.frequency_response()
  File "C:\ProgramsPortable\Impulcifer\impulse_response.py", line 175, in frequency_response
    fr = FrequencyResponse(name='Frequency response', frequency=f[1::step], raw=m[1::step])
ValueError: slice step cannot be zero

Win10 x64, Python 3.7.5

New error after the last update

this error appears both in demo but also with my hrir
Win10 x64, Python 3.7.5

(venv) C:\ProgramsPortable\Impulcifer>python impulcifer.py --test_signal=D:\I\Impulcifer_Data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl --room_mic_calibration=D:\I\Impulcifer_Data\demo\room-mic-calibration.txt --room_target=D:\I\Impulcifer_Data\harman-room-target.csv --dir_path=D:\I\Impulcifer_Data\demo --plot

Traceback (most recent call last):
File "impulcifer.py", line 494, in <module>
main(**create_cli())
File "impulcifer.py", line 94, in main
plot=plot
File "impulcifer.py", line 223, in correct_room
fr.raw -= room_mic_calibration.raw
AttributeError: 'str' object has no attribute 'raw'

Test Signal Parameters

Lock down and document test signal parameters. Test signal parameters should be locked to have starting frequency of 10 Hz, end frequency of half the sampling frequency and silence duration or 2 seconds. Sweep duration, bit depth and sampling frequency can be read from the WAV file. Locking down start and end frequencies allows ImpulseResponseEstimator instances to be created with a test signal file saved on disk without passing any other parameters.

Using the Mono Track for a 7 channel measurement

I tried to record a full 7 channel setup today and ran into an error:

(venv) C:\Python\Impulcifer-master>python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=C,FL,FR,SL,SR,RL,RR --compensate_headphones
Traceback (most recent call last):
File "impulcifer.py", line 167, in
main(**create_cli())
File "impulcifer.py", line 33, in main
hrir.open_recording(recording, speakers=speakers)
File "C:\Python\Impulcifer-master\hrir.py", line 54, in open_recording
speaker = speakers[i + j]
IndexError: list index out of range

I used the mono recording (sweep-seg-FL-mono-6.15s-48000Hz-32bit-2.93Hz-24000Hz) and switched the balance to the right - that suited my setup . Sat on a swivel chair and sat through the various positions.

Tried to run the command

(python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=C,FL,FR,SL,SR,RL,RR --compensate_headphones)

But the above error on pastebin occured.

I uploaded my recording.wav here:

I tried a bunch of things to no avail - splitting stereo tracks to mono etc.

The reason I used the mono track is I can't understand how to get a proper recording from the stereo sweep. You just can't do the side surrounds or center channel that way.

Scipy build failure

Tried on two different windows pcs and in docker, same error:

ERROR: Command errored out with exit status 1:
 command: /usr/src/app/venv/bin/python /usr/src/app/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpln8nwj0i
     cwd: /tmp/pip-install-z9zxmnlc/scipy
Complete output (153 lines):
lapack_opt_info:
lapack_mkl_info:
customize UnixCCompiler
  libraries mkl_rt not found in ['/usr/src/app/venv/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
  NOT AVAILABLE

openblas_lapack_info:
customize UnixCCompiler
customize UnixCCompiler
  libraries openblas not found in ['/usr/src/app/venv/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
  NOT AVAILABLE

openblas_clapack_info:
customize UnixCCompiler
customize UnixCCompiler
  libraries openblas,lapack not found in ['/usr/src/app/venv/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
  NOT AVAILABLE

SNR to Decay Plot

Add signal to noise ration as a sub-title for decay plot. Signal to noise ratio is the ratio between RMS values of the full impulse response and it's tail after reverberation.

Suggestion: Multiple Headphone Compensations / 44khz option

This would be a nice to have:

I've got a collection of 4 headphones. I currently run compensations for all of them manually by replacing headphones.wav and re-running the command.

It'd be neat if I could just label all the headphones headphones-USERTEXT.wav and Impulcifer would then compensate for however many headphones were in the directory.

That way you run one command and have multiple HRIR's for the compensated headphones.

The same thing with 44.1khz for Bluetooth. Currently I take the HRIR produced by Impulcifer and re-sample in Audacity. Be neat if two HRIR's were output - one for 48khz and one for 44khz.

Measurement

Implement measurement with interactive CLI.

Could not install `requirements.txt` - Problem with `tensorflow~=2.0.0`

Hi,

I'm so excited you created this project. This is amazing ๐Ÿ˜ I was on the fence to save and try to get a used realizer a16 somewhere. But this . . . ๐Ÿ˜

So before buying all the equipement I wanted to check out the demo to see how close it'd sound to something like OOYH.

Unfortunately when installing the dependencies I get an error:

ERROR: Could not find a version that satisfies the requirement tensorflow~=2.0.0 (from autoeq==1.2.1->-r requirements.txt (line 9)) (from versions: 2.2.0rc3, 2.2.0rc4, 2.2.0)
ERROR: No matching distribution found for tensorflow~=2.0.0 (from autoeq==1.2.1->-r requirements.txt (line 9))

I tried to fork autoeq-pkg and manually update tensorflow to version 2.2.0. But then I kept having problem with other dependencies ...
... so I figured I'd create an issue ๐Ÿ™‚

If you need me to run any test, just let me know ๐Ÿ™‚๐Ÿ‘
And, once again, thank you for your work ๐Ÿ˜

Errors outputting plots

I get the nice pretty graphs output fine but the following errors are reported on the console

(venv) C:\Users\dushy\Impulcifer>python impulcifer.py --test_signal="data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl" --dir_path="data/my_hrir" --plot
 ** On entry to DLASCLS parameter number  4 had an illegal value
 ** On entry to DLASCLS parameter number  4 had an illegal value
Traceback (most recent call last):
  File "impulcifer.py", line 257, in <module>
    main(**create_cli())
  File "impulcifer.py", line 76, in main
    compensate_headphones(headphones, hrir, fig_path=fig_path)
  File "impulcifer.py", line 141, in compensate_headphones
    min_mean_error=False
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 1036, in compensate
    iterations=DEFAULT_TREBLE_SMOOTHING_ITERATIONS
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 1180, in smoothen_fractional_octave
    treble_f_upper=treble_f_upper
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\autoeq\frequency_response.py", line 1137, in _smoothen_fractional_octave
    y_normal = savgol_filter(y_normal, self._window_size(window_size), 2)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\scipy\signal\_savitzky_golay.py", line 337, in savgol_filter
    coeffs = savgol_coeffs(window_length, polyorder, deriv=deriv, delta=delta)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\scipy\signal\_savitzky_golay.py", line 139, in savgol_coeffs
    coeffs, _, _, _ = lstsq(A, y)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\scipy\linalg\basic.py", line 1218, in lstsq
    raise LinAlgError("SVD did not converge in Linear Least Squares")
numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares

Single Speaker Recording Issue

Trying out the single speaker method for a very near field (arms length) measurement but getting the following error:

(venv) c:\Users\dushy\Impulcifer>python impulcifer.py --test_signal="data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl" --dir_path="data/my_hrir" --channel_balance=trend
Traceback (most recent call last):
  File "impulcifer.py", line 492, in <module>
    main(**create_cli())
  File "impulcifer.py", line 74, in main
    write_readme(os.path.join(dir_path, 'README.md'), hrir, fs)
  File "impulcifer.py", line 440, in write_readme
    f'{ir.reverberation_time(target_level=-60) * 1000:.1f} ms'
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

I've uploaded my speaker and headphone recording here.

Bluetooth Headphone Compensation - Lag?

When compensating for bluetooth headphones - does the lag (192ms for my Bose 700) impact Impulcifer's calculations? Should you trim the recording by the lag value?

I'd prefer to do a compensation for BT headphones without using a wire because frequency response is typically different in passive vs BT modes.

Suggestion: Multiple Sweeps to reduce noise

Audyssey uses multiple sweeps on each loud speaker to reduce any potential noise fro measurement.

I also found a video of a Smyth Realiser A8 being measured here that utilities the same technique: https://www.youtube.com/watch?v=cV1X8ljCRm8

The video also has good audio prompts on head placement when you eventually work on the interactive measurements via the Impulcfier itself.

For a future update I think this would be really worthwhile - my room, for example, constantly has about 35-40db noise due to being in a city.

Room Correction

Room acoustics play huge role in how good the HRIR sounds. Impulcifer should be able equalize room's frequency response into a target listening curve. This implies handling of room impulse response measurement, calculating it's frequency response,creating inverse frequency response FIR filter and equalizing HRIR tracks with it.

Room measurement can have one channel, same number of channels as there are output speakers or double the number of output speakers. In case where there is only one channel in the room measurement that will be used for equalizing all of the head related impulse responses. If there are equal number to the output speakers then each measurement will be used for the respective speaker. Finally for room measurement files with double the output speaker count each channel in the room measurement file will correspond to one virtualized speak and ear pair.

Add --room parameter to Impulcifer which defaults to {out_dir}/room.wav. Add --room_speakers parameter to Impulcifer which tells which speakers each track or track pair in the file match. This is a list of speaker names and will be comma separated list in the CLI like: "--room_speakers=FL,FR,RL,SL,SR,RR,C". If there are equal number of channel as there are output speakers then each item in the --room_spaekers list matches one channel in the file. If there are double the number of channels as there are output speakers then every even number (0, 2, ...) channel will be for left ear and odd number (1, 3, ...) channel for right ear. In this case each item in the --room_speakers list matches two consecutive channels in the room measurement file.

Surround Demo

Currently demo files are stereo only and have been made with unequalized Sennheiser HD 800. Measure 7 channel sourround HRIR for demoing Impulcifer on surround material. Measure headphone compensation with Sennheiser HD 800 that has been equalized to Harman target with 4dB bass boost (AutoEQ style) to have a reference point which can be achieved by anyone who's headphones are supported in AutoEQ.

Tracking Filter

Implement band-pass filter for removing noise from the sine sweep recording. Logarithmic sine sweep signal is playing only one frequency at any given time and all of the other frequencies can be filtered out with a band-pass filter. Filter center frequency needs to track the frequency of the sine sweep. Filter should include frequencies that have been playing recently to avoid cutting out reverberation unintended.

Headphone Transfer Eq

Implement headphone transfer equalization for the processing. A single recording can be used with many headphones if the frequency response of the HRIR is adapted from the original headphone, with which the headphone compensation recording was made, to the headphone intended to be used for listening. This will allow to use in-ear monitors which normally would be impossible to use because the headphone compensation cannot be made with IEMs.

Alternative way to do headphone transfer would be to create an equalization filter which does the transforming directly but this for the time being is not as convenient and would not allow for the HRIR to be transferred to any other headphone. Third option would be to use equalization during listening time but that would require the convolver software to have powerful equalizer which can be used at the same time with the convolution. Easiest way would be to bake the headphone transfer equalization directly into the HRIR.

The process involves using equalization during headphone compensation recording which makes that headphone's frequency response neutral (Harman target or equivalent). Then an equalization FIR filter is given to Impulcifer during processing which makes the target headphone's (eg. IEM's) frequency response neutral. This way both headphones have been equalized to the same target and the HRIR recorded with one headphone would be transferred to another.

Add --eq parameter to Impulcifer and implement FIR filtering after headphone compensation. Add section to the measurement guide for using the headphone transfer.

Zoomed-in Impulse Response Plot

Add additional waveform plot for impulse responses but instead of displaying the whole impulse response only show first 1 millisecond or so.

Support for mic_calibration.py

How can the calibration of binaural microphones ( right-mic-calibration.csv and left-mic-calibration.csv files from mic_calibration.py ) in Impulcifer be accounted for?

Convolver

Implement a convolver tool which uses HRIR to virtualize audio file offline so that it can be used without any real-time virtualization software. Convolver needs to take path to HRIR and path to the audio file as parameters. Perhaps even a path to directory full of audio files.

There also needs to be a parameter for telling the convolver the track order of the HRIR. This will allow usage of non Impulcifer created HRIRs. Shorthand for HeSuVi and other popular HRIRs track orders would be nice.

The call would be something like this:

python convolver.py --input="My Library/Rick Astley" --hrir="data/my_hrir/hesuvi.wav" --tracks=hesuvi

What to do with output? Replace the original files? This would be hazardous but there might not be any other easy way for videos.

Many audio formats need to be supported. There probably exists a Python library which can read "everything".

Obviously the processing has to be made in pieces. Convolving an hour long track will kill any PC:

New Errors since updating

Wanted to run a few new recordings, updated the repo.

Followed the guide on the wiki as usual but now getting the following error. I've not run any plots and even when I add the plot switch, there's still an error. But when I create a blank headphones.png the HRIR outputs fine.

(venv) c:\Users\dushy\Impulcifer>python impulcifer.py --test_signal="data/sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.pkl" --dir_path="data/my_hrir" --no_room_correction
Traceback (most recent call last):
  File "impulcifer.py", line 422, in <module>
    main(**create_cli())
  File "impulcifer.py", line 91, in main
    compensate_headphones(headphones, hrir, dir_path=dir_path)
  File "impulcifer.py", line 344, in compensate_headphones
    fig.savefig(os.path.join(dir_path, 'plots', 'Headphones.png'))
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\matplotlib\figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\matplotlib\backend_bases.py", line 2082, in print_figure
    **kwargs)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\matplotlib\backends\backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "c:\users\dushy\appdata\local\programs\python\python37\Lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\matplotlib\cbook\__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "C:\Users\dushy\Impulcifer\venv\lib\site-packages\matplotlib\cbook\__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\Users\\dushy\\Impulcifer\\data\\my_hrir\\plots\\Headphones.png'

BR impulse response has lower delay to left ear than to right.

I did a re-recording sitting closer to my speakers. For the rear channels I elevated them on the Gorilla stands I have. But I'm getting an error below. I haven't changed anything in the measurement process at all.

(venv) C:\Users\dushy\Impulcifer>python impulcifer.py --dir_path=data\my_hrir --test_signal=data\sweep-6.15s-48000Hz-32bit-2.93Hz-24000Hz.wav --speakers=FL,FR,SR,BR,BL,SL,FC,X  --compensate_headphones
Traceback (most recent call last):
  File "impulcifer.py", line 167, in <module>
    main(**create_cli())
  File "impulcifer.py", line 43, in main
    hrir.crop_heads()
  File "C:\Users\dushy\Impulcifer\hrir.py", line 151, in crop_heads
    raise ValueError(speaker + ' impulse response has lower delay to left ear than to right.')
ValueError: BR impulse response has lower delay to left ear than to right.

If you need my recording.wav let me know and I can upload it

Mixed Phase Room Correction

Mixed phase filters can make the impulse responses more compact reducing ringing and improving dynamics and impact of the end result.

Implement mixed phase FIR filter for room correction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.