-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgetLoudnessEstimates.m
More file actions
41 lines (35 loc) · 1.46 KB
/
getLoudnessEstimates.m
File metadata and controls
41 lines (35 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function [loudnessEstimates loudnessStructure]=getLoudnessEstimates(audiofile, times)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% nmat=getTimingData(midifile, times)
%
% Description: Get loudness estimate based on Glasberg and Moore (2002)
% for time-varying sounds using the Loudness Toolbox
%
% Inputs:
% audiofile - name of audiofile
% times - onset and offset times
%
% Outputs:
% loudnessEstimates - maximum short-term loudness (in sones) vs time
% loudnessStructure - complete structure returned by
% Loudness_TimeVaryingSound_Moore
%
% Dependencies:
% Genesis Acoustics. 2010. Loudness Toolbox for Matlab.
% Available from http://www.genesis-acoustics.com/index.php?page=32
%
% Automatic Music Performance Analysis and Analysis Toolkit (AMPACT)
% http://www.ampact.org
% (c) copyright 2011 Johanna Devaney (j@devaney.ca) and Michael Mandel
% (mim@mr-pc.org), all rights reserved
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read audiofile
[sig,sr]=wavread(audiofile);
for i = 1 : length(times.ons)
% get loudness estimate for time-vaying sounds based on Glasberg and
% Moore (2002)
loudnessStructure{i}=Loudness_TimeVaryingSound_Moore(sig(times.ons(i)*sr:times.offs(i)*sr),sr);
% save the maximum short-term loudness (in sones) vs time in a seperate
% variable
loudnessEstimates(i)=loudnessStructure{i}.STLlevelmax;
end