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

Fixing a file name in daff generator example, and some minor changes in go example for VA

parent 28347b58
%% VA offline simulation/auralization example for outdoor renderer using ga engine
% Requires VA to run with a virtual audio device that can be triggered by
% the user. Also the rendering module(s) have to be set to record the output
% to hard drive. To shutdown the server from Matlab, remote control modus
% must be activated.
buffer_size = 64;
sampling_rate = 44100;
outdoor_renderer_id = 'MyBinauralOutdoor';
auralization_out_folder = pwd;
auralization_out_file_name = 'outdoor_auralization_static_sine.wav';
%% Geometrical acoustics simulation engine
gsim = itaGeoPropagation();
gsim.load_paths( 'ppa_example_paths.json' );
gsim.pps = gsim.pps( [ 1:83, 85:176, 178:408 ] ); % selection with no errors
gsim.pps = ita_propagation_paths_add_identifiers( gsim.pps );
pos_s = gsim.pps( 1 ).propagation_anchors{ 1 }.interaction_point( 1:3 );
pos_r = gsim.pps( 1 ).propagation_anchors{ 5 }.interaction_point( 1:3 );
%% Connect and set up scene
va = VA( 'localhost' );
va.add_search_path( pwd );
va.set_global_auralization_mode( 'DS, DD' );
L = va.create_sound_receiver( 'VA_Listener' );
va.set_sound_receiver_position( L, pos_r );
H = va.create_directivity_from_file( '$(DefaultHRIR)' );
va.set_sound_receiver_directivity( L, H );
S = va.create_sound_source( 'VA_Source' );
va.set_sound_source_position( S, pos_s );
X = va.create_signal_source_buffer_from_file( 'sine.wav' );
va.set_signal_source_buffer_playback_action( X, 'play' )
va.set_signal_source_buffer_looping( X, true );
va.set_sound_source_signal_source( S, X )
c = va.get_homogeneous_medium_sound_speed;
va.set_rendering_module_parameters( outdoor_renderer_id, struct( 'RecordOutputBaseFolder', auralization_out_folder ) );
va.set_rendering_module_parameters( outdoor_renderer_id, struct( 'RecordOutputFileName', auralization_out_file_name ) );
paths_update = struct();
path = struct();
path.source = S;
path.receiver = L;
for m = 1:numel( gsim.pps )
pp = gsim.pps( m );
anchors = numel( pp.propagation_anchors );
if anchors == 2
continue;
end
wf_origin = gsim.pps( m ).propagation_anchors{ anchors - 1 }.interaction_point( 1:3 );
distance = ita_propagation_path_length( pp );
path.identifier = strcat( 'path_', pp.identifier );
path.position = wf_origin;
path.delay = distance / c;
path.gain = 1 / distance;
if false % if transfer function genetration of itaGeoSim is ready ...
a = itaAudio;
a.freqData = gsim.tf( pp );
tf_energetic = ita_spk2frequencybands( a, 'mode', 'fft' );
path.frequency_magnitudes = tf_energetic.freqData;
else
path.frequency_magnitudes = ones( 31, 1 ); % ... else set unity for now.
end
paths_update.( path.identifier ) = path;
end
% This call will trigger the update based on the data generated by the geo
% propagation simulation class
va.set_rendering_module_parameters( outdoor_renderer_id, paths_update );
va.disconnect
......@@ -99,7 +99,7 @@ disp( ' ' )
dirac_ir_config.numsamples = 128;
dirac_ir_config.channels = 2;
dirac_ir_config.samplerate = 44100;
daffv17_write('filename', 'ExampleMultiChannelDiracOmni_128_44kHz.v17.ir.daff', ...
daffv17_write('filename', 'ExampleMultiChannelDiracOmni_2ch_128_44kHz.v17.ir.daff', ...
'content', 'ir', ...
'datafunc', @dfDiracIR, ...
'userdata', dirac_ir_config, ...
......
Supports Markdown
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