-
Notifications
You must be signed in to change notification settings - Fork 441
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
Time delay when sound source is far away and amplitude of the signal #257
Comments
Oh! I've never made such a big room 🤯 Do you have a code fragment for me to try this out ? |
I just figured out that i made a mistake with sample rate when saving result signal.... time delay seems to be alright. But Still having the amplitude of beamformed signal issue. here is the code i am using
` |
Good that you figured out the delay issue! 👏 For the amplitude, it is actually the energy that reduced by the square of the distance. The amplitude is reduced inversely proportional to the distance. Can you please check the energy ? Also, this is true only in anechoic conditions, but that would be the case with |
I checked the energy also but didn't get the result we thought.
and i got the result |
Hum, this looks pretty strange. I'm wondering if you may not be getting overflows due to using int16. Can you try doing the computations in floating point arithmetic ? |
I tried to divide the output signal in each case with same amount 2^16 (data type of output signal was float64) to prevent the overflow when getting the squar value and didn't convert to int16.
but got result and by the way thanks for the fast reply. |
I tried to write a test and I get nearly perfect decay by 1/d^2 for the energy. import numpy as np
import pyroomacoustics as pra
if __name__ == "__main__":
fs = 16000
n = fs * 1
x = np.random.randn(n)
source = np.array([1.0, 1.0, 2.5])
mics = np.array(
[
[1.0, 2.0, 2.5],
[1.0, 11.0, 2.5],
[1.0, 101.0, 2.5],
[1.0, 1001.0, 2.5],
]
)
room = pra.ShoeBox([10000, 10000, 5], max_order=0, fs=fs)
room.add_source(source, signal=x)
for mic in mics:
room.add_microphone(mic)
room.simulate()
signals = room.mic_array.signals
energy = np.mean(signals ** 2, axis=-1)
mic_1m = mics[0]
energy_1m = energy[0]
for idx in range(1, mics.shape[0]):
dist = np.linalg.norm(mics[idx] - source)
print(f"distance={dist:.3e} : energy decay = {energy_1m / energy[idx]:.3e}") And the output of running the script is > python test_energy.py
distance=1.000e+01 : energy decay = 1.004e+02
distance=1.000e+02 : energy decay = 9.976e+03
distance=1.000e+03 : energy decay = 9.922e+05 |
With signal from single mic, I am getting the same result. I tried to make a rake_perceptual_filters - beamforming based on your code.
and the result was
|
I would suggest to check out the code of the beamformer. I think it may be compensating for the amplitude. This would explain why you are not seeing much decay. |
I am doing some experiment with pyroom acoustics.
Made a big room with one source and mic array with 0 max_order.
Distance from sound source and center of the mic array was set to 1000m, but the time delay i got was 0.47 sec.
And also I though that if the distance between source and mic become twice longer, the calculated amplitude of beamformed signal from the mic array should be reduced as well but got different result form the simulation by pyroomacoustics.
Am I doing some thing wrong?
The text was updated successfully, but these errors were encountered: