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