Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
VAMatlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
VAMatlab
Commits
547a2ffc
Commit
547a2ffc
authored
Aug 23, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WiP fixing auralization
parent
5b6720ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
28 deletions
+45
-28
matlab/VA_example_ppa.m
matlab/VA_example_ppa.m
+45
-28
No files found.
matlab/VA_example_ppa.m
View file @
547a2ffc
...
...
@@ -6,20 +6,21 @@
% Requires ITA-Toolbox, obtain from http://www.ita-toolbox.org
%
output_folder = fullfile( 'C:\Users\jonas\sciebo\Thesis stuff\auralization\resources', 'example_ppa/s1_r1' );
output_folder
=
fullfile
(
'D:\Users\stienen\Sciebo\Thesis stuff\auralization\resources'
,
'example_ppa/s1_r1'
);
output_folder
=
fullfile
(
'C:\Users\jonas\sciebo\Thesis stuff\auralization\resources'
,
'example_ppa/s1_r1'
);
%
output_folder = fullfile( 'D:\Users\stienen\Sciebo\Thesis stuff\auralization\resources', 'example_ppa/s1_r1' );
frame_rate
=
128
/
44100
;
% block length / sampling frequency
sort_by_date
=
false
;
record_paths
=
true
;
ppa_diffraction_model
=
'utd'
;
%single_path_id = 'path_003ca6d3a74540310873574908219251';
S
=
1
;
R
=
1
;
ppa_example_mode
=
questdlg
(
'Please select'
,
'VA example ppa mode selection'
,
...
'simulation'
,
'auralization'
,
'all'
,
'auralization'
);
ppa_example_mode
=
'postprocessing'
%% Prepare run data
if
any
(
strcmpi
(
ppa_example_mode
,
{
'simulation'
,
'all'
}
)
)
...
...
@@ -27,7 +28,7 @@ if any( strcmpi( ppa_example_mode, { 'simulation', 'all' } ) )
if
~
exist
(
output_folder
,
'dir'
)
mkdir
(
output_folder
)
end
ppa_folder
=
'../../../dist/win32-x64.vc12/bin/UrbanTrajectory'
;
if
~
exist
(
ppa_folder
,
'dir'
)
...
...
@@ -56,7 +57,7 @@ if any( strcmpi( ppa_example_mode, { 'simulation', 'all' } ) )
% Iterate over frames
n_continue
=
1
;
for
n
=
n_continue
:
N
% Load propagation paths for current frame
ppa_file_path
=
fullfile
(
file_listing
(
n
)
.
folder
,
file_listing
(
n
)
.
name
);
pps
=
ita_propagation_load_paths
(
ppa_file_path
);
%pps = struct containing the current time frame
...
...
@@ -89,8 +90,6 @@ if any( strcmpi( ppa_example_mode, { 'simulation', 'all' } ) )
pu
.
source
=
S
;
pu
.
receiver
=
R
;
pu
.
identifier
=
pps_del
(
p
)
.
identifier
;
pu
.
delete
=
true
;
paths_update
.
(
strcat
(
'path_'
,
pu
.
identifier
)
)
=
pu
;
end
for
p
=
1
:
numel
(
pps_new
)
...
...
@@ -173,7 +172,7 @@ if any( strcmpi( ppa_example_mode, { 'simulation', 'all' } ) )
waitbar
(
n
/
N
)
end
end
close
(
h
)
if
record_paths
...
...
@@ -182,14 +181,11 @@ if any( strcmpi( ppa_example_mode, { 'simulation', 'all' } ) )
fprintf
(
'Finished generating path data for every frame. Data is saved into separate files in folder
''
%s
''
\n'
,
output_folder
);
end
%% Run postprocessing
postproc_all_paths
=
struct
();
if
any
(
strcmpi
(
ppa_example_mode
,
{
'postprocessing'
,
'all'
}
)
)
%% Run postprocessing
disp
(
'Starting post-processing'
)
% Load data
...
...
@@ -212,7 +208,7 @@ if any( strcmpi( ppa_example_mode, { 'postprocessing', 'all' } ) )
% Run postprocessing over frames from front and back
for
n
=
1
:
N
idx_current_front
=
idx
(
n
);
idx_current_front
=
idx
(
n
);
load
(
fullfile
(
output_folder
,
file_listing
(
idx_current_front
)
.
name
),
'-mat'
);
pathnames
=
fieldnames
(
paths_update
);
...
...
@@ -225,7 +221,7 @@ if any( strcmpi( ppa_example_mode, { 'postprocessing', 'all' } ) )
idx_current_back
=
idx
(
N
+
1
-
n
);
load
(
fullfile
(
output_folder
,
file_listing
(
idx_current_back
)
.
name
),
'-mat'
);
pathnames
=
fieldnames
(
paths_update
);
for
p
=
1
:
numel
(
pathnames
)
path_id
=
pathnames
{
p
};
...
...
@@ -246,9 +242,12 @@ end
%% Run auralization
if
any
(
strcmpi
(
ppa_example_mode
,
{
'auralization'
,
'all'
}
)
)
% Load data
load
(
fullfile
(
output_folder
,
'postprocessing_data.mat'
),
'postproc_all_paths'
)
file_listing
=
dir
(
strcat
(
output_folder
,
'/frame*data.mat'
)
);
N
=
numel
(
file_listing
);
fprintf
(
'Found data on %i frames in folder
''
%s
''
\n'
,
N
,
output_folder
)
...
...
@@ -301,26 +300,44 @@ if any( strcmpi( ppa_example_mode, { 'auralization', 'all' } ) )
% frame
load
(
fullfile
(
output_folder
,
file_listing
(
idx_current
)
.
name
),
'-mat'
);
fn
=
fieldnames
(
paths_update
);
for
p
=
1
:
numel
(
fn
)
path_id
=
fn
{
p
};
if
n
<
postproc_all_paths
.
(
path_id
)
.
last_frame
&&
paths_update
.
(
path_id
)
.
delete
paths_update
.
(
path_id
)
.
delete
=
false
;
disp
(
'Prevented path from deletion because it will be re-appear in a follow up frame'
)
end
end
% Update all propagation paths
source_pos_OpenGL
=
ita_matlab2openGL
(
source_pos
(
1
:
3
)
'
);
receiver_pos_OpenGL
=
ita_matlab2openGL
(
receiver_pos
(
1
:
3
)
'
);
va
.
lock_update
va
.
lock_update
;
% Update receiver (last anchor)
va
.
set_sound_source_position
(
S
,
source_pos_OpenGL
);
va
.
set_sound_receiver_position
(
R
,
receiver_pos_OpenGL
);
single_path_id
=
'path_003ca6d3a74540310873574908219251'
;
if
isfield
(
paths_update
,
single_path_id
)
single_path_update
=
struct
(
'p'
,
paths_update
.
(
single_path_id
)
);
va
.
set_rendering_module_parameters
(
'MyBinauralOutdoorNoise'
,
single_path_update
);
if
exist
(
'single_path_id'
,
'var'
)
% Define a single_path_id if you want to run an auralization
% for an individual path, only (see first section)
if
isfield
(
paths_update
,
single_path_id
)
single_path_update
=
struct
(
'p'
,
paths_update
.
(
single_path_id
)
);
va
.
set_rendering_module_parameters
(
'MyBinauralOutdoorNoise'
,
single_path_update
);
else
disp
(
'Single path not found in current frame, skipping update'
)
end
else
disp
(
'not found, skipping update'
)
% Update all paths
va
.
set_rendering_module_parameters
(
'MyBinauralOutdoorNoise'
,
paths_update
);
end
va
.
unlock_update
va
.
unlock_update
;
% triggers scene update for renderers
% Increment core clock
manual_clock
=
manual_clock
+
frame_rate
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment