Commit bdc3093b authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

WIP pass-by auralization works, but IIR filtering is not working except for 31 ones

parent 97ff167f
......@@ -4,12 +4,15 @@
% the user. Also the generic path prototype rendering module(s) has to record the output
% to hard drive.
free_field_only = false;
%% Connect and set up simple scene
va = VA( 'localhost' );
va.add_search_path( 'D:/Users/andrew/dev/ITASuite/VA/VACore/data' );
va.add_search_path( 'D:/Users/andrew/dev/ITASuite/VA/VAMatlab/matlab' );
va.add_search_path( 'C:/dev/VA/VACore/data' );
va.add_search_path( 'D:/Users/stienen/dev/VA/VACore/data' );
c = va.get_homogeneous_medium_sound_speed();
f = ita_ANSI_center_frequencies;
......@@ -23,7 +26,6 @@ H = va.create_directivity_from_file( 'ITA_Artificial_Head_5x5_44kHz_128.v17.ir.d
va.set_sound_receiver_directivity( L, H );
S = va.create_sound_source( 'VA_Source' );
%X = va.create_signal_source_buffer_from_file( '$(DemoSound)' );
X = va.create_signal_source_buffer_from_file( 'WelcomeToVA.wav' );
va.set_signal_source_buffer_playback_action( X, 'play' )
......@@ -56,71 +58,65 @@ for n = 1:length( x )
% Modify scene as you please (position has no real effect for prototype generic path renderer)
source_pos = [ x( n ) 1.1 -3 ]; % OpenGL coordinates
distance = sum( abs( source_pos - receiver_pos ) );
va.set_sound_source_position( S, source_pos );
va.set_sound_source_position( S, source_pos );
% Manually create direct sound path and diffracted sound path
shadow_zone = ita_diffraction_shadow_zone(w, source_pos, receiver_pos); %is receiver in shadow zone?
if( shadow_zone == false )
prop_path_direct = struct();
prop_path_direct.distance = distance;
prop_path_direct.delay = distance / c; %delay from sound emitting from source to being received at listener
prop_path_direct.frequencies = f; %Frequencies corresponding to the mags
values = ones(1,31);
prop_path_direct.frequency_magnitudes = values;
prop_path_direct.source = S; %sound source ID
prop_path_direct.receiver = L; %sound receiver ID
prop_path_direct.path = strcat( 'direct_', num2str(S), '_to_', num2str(L) ); %sound path ID
prop_path_direct.ID = 0;
prop_path_direct.delete = false; %set to true when the path should be deleted
prop_path_direct.position = source_pos;
direct_deleted = false;
% Direct sound path (id 0)
prop_path_direct = struct();
prop_path_direct.ID = 0;
prop_path_direct.path = strcat( 'direct_', num2str(S2), '_to_', num2str(L) ); %sound path ID
prop_path_direct.distance = distance;
prop_path_direct.delay = distance / c; %delay from sound emitting from source to being received at listener
prop_path_direct.frequencies = f; %Frequencies corresponding to the mags
values = ones(1,31);
prop_path_direct.frequency_magnitudes = values;
prop_path_direct.source = S; %sound source ID
prop_path_direct.receiver = L; %sound receiver ID
prop_path_direct.delete = false; %set to true when an existing path should be deleted
prop_path_direct.position = source_pos;
if free_field_only
prop_path_direct.audible = true;
else
prop_path_direct = struct();
prop_path_direct.ID = 0;
prop_path_direct.path = strcat( 'direct_', num2str(S), '_to_', num2str(L) ); %sound path ID
prop_path_direct.delete = true; %if source is in shadow zone, delete direct path
%direct_deleted = true;
prop_path_direct.audible = ~shadow_zone;
end
%maybe use this to fade out direct sound by setting distance to inf or
%seting flter to 0
% Diffracted sound path (id 1)
apex = w.get_aperture_point( source_pos, receiver_pos );
detour = norm( source_pos - apex ) + norm(apex - receiver_pos );
prop_path_diffracted = struct();
detour = norm( source_pos - apex ) + norm(apex - receiver_pos );
prop_path_diffracted = struct();
prop_path_diffracted.distance = detour;
prop_path_diffracted.delay = detour / c;
prop_path_diffracted.frequencies = f;
values = abs( ita_diffraction_utd( w, source_pos, receiver_pos, f, c ) );
prop_path_diffracted.frequency_magnitudes = values';
%values = abs( ita_diffraction_utd( w, source_pos, receiver_pos, f, c ) );
prop_path_diffracted.frequency_magnitudes = values;
prop_path_diffracted.source = S;
prop_path_diffracted.receiver = L;
prop_path_diffracted.ID = 1;
prop_path_diffracted.path = strcat( 'diff1_', num2str(S), '_to_', num2str(L) );
prop_path_diffracted.delete = false;
prop_path_diffracted.position = apex;
prop_path_diffracted.audible = true;
% @todo at some point: load all paths from pre-calculated simulation -> ITAPropagationPathSim (C++) output
% @todo at some point: load all patqhs from pre-calculated simulation -> ITAPropagationPathSim (C++) output
% D:/Users/andrew/dev/ITASuite/VA/VACore/tests/BinauralOutdoorNoiseRendererTest.VACore.ini
disp(strcat('**diff dirn: ', num2str(apex),' Delay = ',num2str(distance/c),'** Direct sound: ',num2str(source_pos),' Delay = ',num2str(detour/c),'**'));
%disp(strcat('**diff dirn: ', num2str(apex),' Delay = ',num2str(distance/c),'** Direct sound: ',num2str(source_pos),' Delay = ',num2str(detour/c),'**'));
% Update wave fronts in renderer
path_update = struct();
%if( direct_deleted == false )
path_update.prop_path_0 = prop_path_direct;
path_update.prop_path_1 = prop_path_diffracted;
%else
% path_update.prop_path_0 = prop_path_diffracted;
% end
va.set_rendering_module_parameters( 'MyBinauralOutdoorNoise', path_update );
paths_update = struct();
paths_update.prop_path_0 = prop_path_direct;
if ~free_field_only
paths_update.prop_path_1 = prop_path_diffracted;
end
va.set_rendering_module_parameters( 'MyBinauralOutdoorNoise', paths_update );
% Increment core clock
manual_clock = manual_clock + timestep;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment