-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impulse responces of gpuRIR very different compared with pyroomacoutics with similar settings #25
Comments
Hi Fra, Could you provide a minimal example where this behavior can be observed and, if possible, a plot of the RIRs obtained with it? Best regards, |
Thanks for reporting this. There might be some differences between gpuRIR and pyroomacoustics since gpuRIR uses negative reflection coefficients and (optionally) a random late reverberation model, but this seems to be indeed too much difference. I'll take a look at this during the week. Best regards, |
Yes I noticed from the paper. In fact I removed the late reverb. part not setting the |
The implementations of the Sabine formula from both libraries are equivalent, the difference is due to gpuRIR returning the energy reflection coefficients while pyroomacoustics returning the energy absorption coefficients. You can see how About the RIRs from gpuRIR having less amplitude than the ones from pyroomacoustics, the amplitude of the direct path is expected to be |
However, here below you can see a plot comparing RIRs from pyroom, gpuRIR and field measured RIRs with similar acoustic parameters from the BUTReverb dataset. On the top of the plot I added the distance between the source and the recording microphone. PS: about pyroom I see your point and I know about the deprecation but I wanted to compare the parameters calculated with the two tools and the coeffs are reasonably in accordance. |
Yeah, that's right. That formula is employed for all the image sources (just using the distance of the image source instead of the original source) and, as you can see, that would generate amplitudes in the same order of magnitude as the ones obtained by gpuRIR. As you say, the use of a windowed sinc function can affect the amplitudes of the different peaks (though it would be even worse if instead of using sinc functions we just rounded the fractional delays) since the side lobes of each peak overlap with the rest of the peaks. Using positive reflections coefficients can make this effect stronger since all the peaks are positive, but I'm not sure whether only this can explain such a big difference.
I have to admit I have never compared the results of gpuRIR with field measured RIRs, in order to validate the results of gpuRIR I compared them with the results from the Lehmann's Matlab library. I've run again some Matlab simulations to check if any of the last gpuRIRs updates might have introduced any bug, but everything looks fine: I don't know how the amplitudes of the BUTReverb dataset have been normalized, since I guess that's not a trivial task. Since usually you only care about the position and the relative amplitudes of each peak but the absolute amplitude doesn't matter (since you usually have to normalize the results after having applied it), maybe they just ensured that the RIRs were never saturated and they were coherent along the dataset.
If you're using energy absorption coefficients, like the ones provided by To sum up: I think that the results obtained with gpuRIR are the results that can be expected from the Image Source Method (at least when using negative reflection coefficients) and there's nothing wrong with it. About pyroomacoustics, I don't know if its higher amplitudes can be explained just by the use of positive reflection coefficients or if maybe they're doing some extra processing that can explain it but, in any case, I think it would be better if you ask to its developers. Best regards, |
Hi, I am also observing difference between gpuRIR and (rirgen and rir_generator). Please see below and let me know if I am missing anything: import rirgen
import gpuRIR
import rir_generator
import numpy as np
import matplotlib.pyplot as plt
T60 = 0.413 # seconds
room_dim = [7.875, 5.839, 3.088] # meters
fs = 8000 # Hz
room_sz = room_dim # Size of the room [m]
pos_src = np.array([
[3.810, 1.919, 1.423],
]) # Positions of the sources ([m]
pos_rcv = np.array([
[3.974, 2.979, 1.418],
]) # Position of the receivers [m]
att_diff = 15.0 # Attenuation when start using the diffuse reverberation model [dB]
att_max = 60.0 # Attenuation at the end of the simulation [dB]
beta = gpuRIR.beta_SabineEstimation(room_sz, T60) # Reflection coefficients
Tdiff= gpuRIR.att2t_SabineEstimator(att_diff, T60) # Time to start the diffuse reverberation model [s]
Tmax = gpuRIR.att2t_SabineEstimator(att_max, T60) # Time to stop the simulation [s]
nb_img = gpuRIR.t2n( Tdiff, room_sz ) # Number of image sources in each dimension
gpuRIR_RIRs = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff = Tdiff, c = 343)
rir_generator_RIRs = rir_generator.generate(
c=343,
fs=fs,
r=np.ascontiguousarray(pos_rcv),
s=np.ascontiguousarray(pos_src[0]),
L=np.ascontiguousarray(room_dim),
reverberation_time=T60,
mtype=rir_generator.mtype.omnidirectional,
)
rirgen_RIR = rirgen.generate_rir(
room_measures=room_dim,
source_position=pos_src[0],
receiver_positions=np.ascontiguousarray(pos_rcv),
reverb_time=T60,
sound_velocity=343,
fs=fs,
)
plt.plot(gpuRIR_RIRs[0, 0, :], label = "gpuRIR", color = "k")
plt.plot(rir_generator_RIRs[:, 0], label = "rir_generator")
plt.plot(rirgen_RIR[0], label = "rirgen")
plt.xlim(0, 200)
plt.legend() |
Hello, As explained in the paper, In the picture, you can also observe how I think those are the only differences between libraries in the picture. Best, |
Hi,
while trying to obtain similar RIRs with gpuRIR and pyroomacoustics, I alwayse obtain very different filters for similar acoustic settings: it looks like the filters generated with gpuRIR are ~ one order of magnitude smaller. Con you give me any hints?
Thank you very much
The text was updated successfully, but these errors were encountered: