Closed YangangCao closed 1 year ago
Hi Yangang,
I'm not sure if the issue being closed means that you figured out by yourself how to do it... but I'll try to answer just in case:
If all the microphones are pointing toward the sound source, the steering vector of all the microphones would be equal to the position of the source minus the position of the microphones. I'm not sure if you want every microphone to have a slightly different orientation so each one steers exactly towards the source or if you want the whole array to steer towards the source with all the microphones having exactly the same orientation (being parallel). If you want the second case, I would compute the average position of the microphones (the center of the array) and subtract it to the position of the source and use the result for all the microphones.
For the steering vector of the source, If it is looking in the opposite direction of the array I would use the same steering vector as for the microphones and if they are looking towards the array I would multiply the steering vector of the microphones by -1.
I hope this helped. Let me know if you have further doubts.
Best regards, David
Hi David
Thanks for your detail and timely answer. Some minutes ago, I just found this issue https://github.com/DavidDiazGuerra/gpuRIR/issues/5 , I think it enough to me. I'm sorry to have taken up your time.
Regards, Yangang
Another small question: If there are 2 sources, they have different patterns and steering vectors, can I write code like this?
RIRs = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff=Tdiff, spkr_pattern=[pattern1, pattern2], orV_src = [orV_src1, orV_src2])
or I must write twice?
RIR1 = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff=Tdiff, spkr_pattern=pattern1, orV_src=orV_src1)
RIR2 = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff=Tdiff, spkr_pattern=pattern2, orV_src=orV_src2)
I'm afraid you have to do it twice. The sources can have different steering vectors (orV_src is a matrix of size Nsrc x 3 so you can stack orV_src1 and orV_src2) but they must have the same pattern.
OK,get it, thanks.
Hi David
I encounter a problem today, when I set spkr_pattern="card", and I set nb_rcv to different number, some of them will report errors. In detail, when I set nb_rcv to 1,2,3,4,5,6,10,11,12,13 the output is normal, 7,8,9,14,15... will report an error:
GPUassert: an illegal memory access was encountered /xxx/gpuRIR/src/gpuRIR_cuda.cu 828
when I don't set spkr_pattern, all nb_rcv number are OK.
I am not sure if you can re-produce this error, you can try, thanks! here is my test code:
import numpy as np
import numpy.matlib
from math import ceil
import gpuRIR
gpuRIR.activateMixedPrecision(False)
gpuRIR.activateLUT(True)
room_sz = [3,3,2.5]
nb_src = 1
pos_src = np.random.rand(nb_src,3)
orV_src = np.random.rand(nb_src,3)
nb_rcv = 8 # Number of receivers, 1~6 10~13 are OK, 7~9 and other will report error
pos_rcv = np.random.rand(nb_rcv,3)
orV_rcv = np.matlib.repmat(np.array([0,1,0]), nb_rcv, 1)
mic_pattern = "card"
spkr_pattern = "card"
abs_weights = [0.9]*5+[0.5]
T60 = 1.0
att_diff = 15.0
att_max = 60.0
fs=16000.0
beta = gpuRIR.beta_SabineEstimation(room_sz, T60, abs_weights=abs_weights)
Tdiff= gpuRIR.att2t_SabineEstimator(att_diff, T60)
Tmax = gpuRIR.att2t_SabineEstimator(att_max, T60)
nb_img = gpuRIR.t2n( Tdiff, room_sz )
print(pos_src.shape,pos_rcv.shape,orV_rcv.shape,orV_src.shape)
#set spkr_pattern, some of nb_rcv number will report error
RIRs = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff=Tdiff, orV_rcv=orV_rcv, mic_pattern=mic_pattern,orV_src=orV_src,spkr_pattern=spkr_pattern)
#don't set spkr_pattern, all nb_rcv number are OK
RIRs = gpuRIR.simulateRIR(room_sz, beta, pos_src, pos_rcv, nb_img, Tmax, fs, Tdiff=Tdiff, orV_rcv=orV_rcv, mic_pattern=mic_pattern,orV_src=orV_src)
print(RIRs.shape)
Hi Yangang,
Thanks for pointing this out, there was indeed a bug in the CUDA code of the library. It should be fixed with the last commit.
Best regards, David
Hi, thanks for your great work! I want to generate some precise RIRs, for example, the cardioid microphone array is pointed to the direction where a people exists, and this people back to the microphone array(so this people should be cardioid too). I don't know how to decide the direction of speaker and micphone when setting their patterions. Thanks for your help!