-
Notifications
You must be signed in to change notification settings - Fork 39
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
Correct WFS driving function time delay #115
Conversation
I was wrong. Here is the result from the code above: |
I think we are in a dilemma between having the correct delay corresponding to the virtual sound field and keeping all the information from the impulse response. If conf = SFS_config;
X = [1.45 0 0];
phi = 0;
xs = [2.5 0 0];
src = 'ps';
hrtf = dummy_irs(conf);
% Using an impulse response
ir = ir_wfs(X,phi,xs,src,hrtf,conf);
% Using sound_field_imp() for every time step
[s,t] = time_response_wfs(X,xs,src,conf);
figure;
plot(0:700,ir(1:701,:),'-g');
hold on
plot(t,s,'-b');
grid;
xlabel('samples');
hold off; |
I had a closer look at the delays, especially in
Point 2. could be corrected. But depending on the resampling and/or fractional delay method, the resulting impulse response cannot be free of "processing delays" because of point 3. In combination with the point raised by Fiete, it might be better to not correct for the delays at all? Instead they could be just returned to let the user know so he can understand the start of the simulated impulse response. The auralisation function I think the change to |
@fietew: that's a good point. For @VeraE: that's another good point: depending on the exact applied delay line method, there could always be a delay. Your point of calling I would propose to do the following:
If you agree I will incorporate the changes accordingly. The main downside of this solution is that |
I agree with this. Thanks for applying the fixes. As I mentioned above,
|
I added Now you can do the following to get an aligned plot: conf = SFS_config;
X = [0 0 0];
phi = 0;
xs = [2.5 0 0];
src = 'ps';
hrtf = dummy_irs(conf);
[ir,~,delay] = ir_wfs(X,phi,xs,src,hrtf,conf);
offset = round(delay*conf.fs);
[s,t] = time_response_wfs(X,xs,src,conf);
figure;
plot(0:700,ir(1+offset:701+offset,:),'-g');
hold on
plot(t,s,'-b');
grid;
xlabel('samples');
hold off; NOTE: there is still an offset of 1 sample between both impulse responses, which could come from a slightly different use of time axis in both cases. |
5b06641
to
db1415e
Compare
The commits are now integrated into master, besides the last one regarding documentation, this will be continued at #118. |
This is a follow up on #113 and deals only with the delay of the impulses.
Try the following code:
Before the result was
The desired time delay of the first wave front is 321 samples corresponding to a distance of 2.5 m of the virtual point source. The blue impulse response created with
time_response_wfs()
is shifted to the left by the delay offset from the WFS driving function due to the time reversal insound_field_imp()
. The green impulse response is shifted to the right by the same delay. This is not a new discovery, see #62, but we have corrected it only insidesound_field_imp_wfs()
so far.This pull request now also corrects it in
time_response_wfs()
andir_wfs()
. Running the code from above now results in@VeraE, @fietew: is it desireable to fix this delay at all inside
ir_wfs()
? Or would it be better to add it two times insidetime_response_wfs()
to correct for the difference?