Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
toolbox
Commits
0ed59c24
Commit
0ed59c24
authored
6 years ago
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Downloads
Patches
Plain Diff
Updating offline simulation parameters
parent
85e3807b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/VirtualAcoustics/VA/itaVA_example_offline_simulation.m
+60
-0
60 additions, 0 deletions
...ns/VirtualAcoustics/VA/itaVA_example_offline_simulation.m
with
60 additions
and
0 deletions
applications/VirtualAcoustics/VA/itaVA_example_offline_simulation.m
0 → 100644
+
60
−
0
View file @
0ed59c24
%% itaVA offline simulation/auralization example
% 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.
buffer_size
=
64
;
sampling_rate
=
44100
;
%% Connect and set up simple scene
va
=
itaVA
(
'localhost'
);
L
=
va
.
create_sound_receiver
(
'itaVA_Listener'
);
va
.
set_sound_receiver_position
(
L
,
[
0
1.7
0
]
)
H
=
va
.
create_directivity
(
'$(DefaultHRIR)'
);
va
.
set_sound_receiver_directivity
(
L
,
H
);
S
=
va
.
create_sound_source
(
'itaVA_Source'
);
X
=
va
.
create_signal_source_buffer_from_file
(
'$(DemoSound)'
);
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
)
%% Example for a synchronized scene update & audio processing simulation/auralization
timestep
=
buffer_size
/
sampling_rate
;
% here: depends on block size and sample rate
manual_clock
=
0
;
va
.
set_core_clock
(
0
);
spatialstep
=
0.005
;
disp
(
[
'Resulting sound source speed: '
num2str
(
spatialstep
/
timestep
)
' m/s'
]
)
numsteps
=
6000
;
disp
(
[
'Simulation result duration: '
num2str
(
numsteps
*
timestep
)
' s'
]
)
x
=
linspace
(
-
1
,
1
,
numsteps
)
*
60
;
% motion from x = -100m to x = 100m
h
=
waitbar
(
0
,
'Hold on, running auralization'
);
for
n
=
1
:
length
(
x
)
% Modify scene as you please
va
.
set_sound_source_position
(
S
,
[
x
(
n
)
1.7
-
3
]
);
% Increment core clock
manual_clock
=
manual_clock
+
timestep
;
va
.
call_module
(
'manualclock'
,
struct
(
'time'
,
manual_clock
)
);
% Process audio chain by incrementing one block
va
.
call_module
(
'virtualaudiodevice'
,
struct
(
'trigger'
,
true
)
);
waitbar
(
n
/
numsteps
)
end
close
(
h
)
va
.
disconnect
disp
(
'!!! Please stop VA manually to export simulation results from rendering module(s) !!!'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment