jaakkopasanen / Impulcifer

Measurement and processing of binaural impulse responses for personalized surround virtualization on headphones.
MIT License
213 stars 14 forks source link

High frequency precision loss of HPTF measurement? #61

Closed conql closed 2 years ago

conql commented 2 years ago

Thank you for your great work!

I write a script to measure and compensate HPTF independently because I don't want it to be embedded in HRIRs. And I found that, Impulcifer's ImpulseResponseEstimator requires much more time to get the same accuracy for high frequency (10k+) as other methods. image image The code I write:

# Create ire and stereo test signal
self.ire = ImpulseResponseEstimator(min_duration=self.test_duration, fs=self.test_fs)
mono_signal = self.ire.test_signal
self.test_signal = np.empty((mono_signal.shape[0], 2))
self.test_signal[:, 0] = mono_signal[:]
self.test_signal[:, 1] = mono_signal[:]
self.audio_manager.set_output_audio(self.test_signal, self.test_fs)
self.audio_manager.start_play()
self.audio_manager.start_record()
while self.audio_manager.playing:
    sounddevice.sleep(100)
rec, sr = self.audio_manager.stop_record()

self.freq_response = []
# Process each channel
for i in range(rec.shape[1]):
    im = ImpulseResponse(self.ire.estimate(rec[:, i]), sr)
    self.freq_response.append(im.frequency_response())
return self.freq_response

Also, it sounds obviously very bright in 10k+, when using Impulcifer alone to measure everything and produce an all-in-one BRIR.

I wonder,

  1. Is this the natural drawback for Angelo Farina's method or I use ire in the wrong way?
  2. Is the "too bright" problem caused by inaccurate high frequency measurement of HPTF or by inaccurate BRIR?
  3. How to reduce the brightness of BRIRs / improve simulation authenticity? Will lengthen measurement time be helpful?

Thanks!!!

conql commented 2 years ago

I figure it out...... Turns out it's my problem. When playing the sweep signal, my code stops recording too early so the high frequency part is cut. I though 100ms was enough for the delay, but it's not... After fixing my bug, Impulcifer can work without problem. This issue can be closed.