You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a project where I need to simulate one room by adding sources to a single ShoeBox room object and clearing the sources after each iteration. That is, I want to keep the characteristics of the room the same but just change the position and content of the source. However, I am encountering errors during the simulation process, specifically when calling the compute_rir() function.
Here's the code snippet for my current implementation:
for i in range(4620):
# Add source to the room
room.add_source(sources_pos[i, :], signal=data_train[i, :].numpy(), delay=0.2)
# Compute RIR and simulate
room.simulate()
# Save the simulation result
room.mic_array.to_wav('/root/autodl-tmp/base_env/audio_signal_processing/audio_data/TIMIT/Simulated_train_data/room_rir{}.wav'.format(i), norm=True, bitdepth=np.float32)
# Measure RT60
rt60 = room.measure_rt60()
print('The desired RT60 was {}'.format(rt60_tgt))
print('The measured RT60 is {}'.format(rt60[1, 0]))
print('The {}th room is simulated'.format(i))
# Remove the source before the next iteration
room.sources.clear()`
I just received the error without any description and it just referer there is something wrong in 'compute_rir()'
Thanks for your help.
The text was updated successfully, but these errors were encountered:
Hi @alexandergwm , the simulator has some internal state that needs to be manually reset after changing the sources.
The easiest is to just re-create the object. I don't think this has a lot of overhead.
If you insist on reusing the same object, you can reset the state as follows:
room.simulator_state["ism_done"] =Falseroom.simulator_state["rt_done"] =False# only needed if you use ray tracing
Hello,
I am working on a project where I need to simulate one room by adding sources to a single ShoeBox room object and clearing the sources after each iteration. That is, I want to keep the characteristics of the room the same but just change the position and content of the source. However, I am encountering errors during the simulation process, specifically when calling the compute_rir() function.
Here's the code snippet for my current implementation:
`room = pra.ShoeBox(room_dim, fs=16000, materials=pra.Material(e_absorption), max_order=max_order)
room.add_microphone_array(mic_locs)
for i in range(4620):
# Add source to the room
room.add_source(sources_pos[i, :], signal=data_train[i, :].numpy(), delay=0.2)
I just received the error without any description and it just referer there is something wrong in 'compute_rir()'
Thanks for your help.
The text was updated successfully, but these errors were encountered: