Closed libowen424 closed 2 years ago
Hello Libowen,
When you perform a convolution you always get a longer signal. If you implement the convolution in time, the new length should be equal to the original length plus the filter length minus one, but right now I don't remember what should be the output length with the frequency implementation that gpuRIR uses. You can see this as waiting for the reverberation of the last original sample to finish.
About not being able to listen to the signal, I don't know what can be happening, I would need more information. The issue is that the wav file is not generated properly and it isn't possible to open it or that you can open it and it is just too quiet? I don't know why are you doing filtered_signal= filtered_signal[0]
but it seems like you might be keeping only the first sample of filtered_signal
, which is something that obviously you won't be able to reproduce.
Best regards, David
``>
thanks so much for your reply! i just have one source and one receiver, so i think i should get the first microphone's received audio my problem is that the audio got from simulateTrajectory can't play, because the format is error
....
nb_src = 1
nb_rcv = 1
....
T60 = 1.0
....
RIRs = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff=Tdiff, orV_rcv=orV_rcv, mic_pattern=mic_pattern)
....
fs, before = wavfile.read('../originalmusic1_16k.wav')
after = gpuRIR.simulateTrajectory(before, RIRs)
after = after.transpose()
after = after[0]
wavfile.write('../after_RIR_originalmusic1_16k.wav', fs, after)
how should i do with a RIR and original audio? thanks again
If you want to keep the first channel of the filtered signal you should do after = after[0,:]
instead of after = after[0]
.
By the way, if you only have a receiver, your filtered signal should have shape (65030, 1)
, not (65030, 2)
. Maybe you're indicating nb_rcv = 1
but then you assign two source positions in pos_rcv
?
i don't figure out what happened. i use soundfile to save audio instead of wavfile. The audio can play normally.
sf.write("../after_RIR_originalmusic1_16k.wav", after, fs)
# wavfile.write('../after_RIR_originalmusic1_16k.wav', fs, after)
thanks again for your help! Best wishes
in example/simulate_trajectory.py:
filtered_signal = gpuRIR.simulateTrajectory(source_signal, RIRs)
in which source_signal.shape = (65030,) but get filtered_signal .shape = (74629, 2), why length is not equal? Besides, when i runwavfile.write('filtered_signal.wav', fs, filtered_signal)
, i can't play the audio filtered_signal.wav even when i addto get a shape of (74629, ), ican't play it thanks~