-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_convert_pitch_to_CRP.m
79 lines (68 loc) · 3.18 KB
/
test_convert_pitch_to_CRP.m
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Name: test_convert_pitch_to_CRP.m
% Date of Revision: 2011-03
% Programmer: Meinard Mueller, Sebastian Ewert
%
% Description:
% * Computes CRP features (f_crp) from pitch features (f_pitch)
% * CRP is a chroma-like feature tuned for timbre-invariance
%
% Reference:
% Details on the feature computation can be found in the following articles:
%
% Meinard Mueller, Sebastian Ewert, and Sebastian Kreuzer
% Making chroma features more robust to timbre changes.
% Proceedings of IEEE International Conference on Acoustics, Speech, and
% Signal Processing (ICASSP), Taipei, Taiwan, pp. 1869-1872, 2009.
%
% Meinard Mueller, and Sebastian Ewert
% Towards Timbre-Invariant Audio Features for Harmony-Based Music.
% IEEE Transactions on Audio, Speach, and Language Processing.
%
% License:
% This file is part of 'Chroma Toolbox'.
%
% 'Chroma Toolbox' is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 2 of the License, or
% (at your option) any later version.
%
% 'Chroma Toolbox' is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with 'Chroma Toolbox'. If not, see <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
close all hidden;
directory = 'data_feature/';
%filename = 'Bach_BWV988-Aria-Measures1-4_Meinard_fast.wav';
%filename = 'Burgmueller_Op100-02-FirstPart_Meinard_SE.wav';
%filename = 'Systematic_Cadence-C-Major_Meinard_portato.wav';
%filename = 'Systematic_Cadence-C-Major_Meinard_staccato.wav';
%filename = 'Systematic_Scale-C-Major_Meinard_fast.wav';
%filename = 'Systematic_Scale-C-Major_Meinard_middle.wav';
filename = 'Systematic_Chord-C-Major_Eight-Instruments.wav';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Loads pitch features (f_pitch) and computes CRP features (f_crp)
%
% Note: feature filename is specified by WAV filename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
win_len = 4410;
filename_pitch = strcat(filename(1:end-4),'_pitch_',num2str(win_len));
load(strcat(directory,filename_pitch)); % load f_pitch and sideinfo;
parameter.coeffsToKeep = [55:120];
parameter.applyLogCompr = 1;
parameter.factorLogCompr = 1000;
parameter.featureRate = sideinfo.pitch.featureRate;
[f_crp,sideinfo] = pitch_to_CRP(f_pitch,parameter,sideinfo);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Visualization of CRP chromagram
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parameter.featureRate = sideinfo.CRP.featureRate;
parameter.xlabel = 'Time [Seconds]';
parameter.title = 'CRP chromagram';
visualizeCRP(f_crp,parameter);