annotate matlab/MATLAB-Chroma-Toolbox_2.0/test_convert_pitch_to_CENS.m @ 60:1ea2aed23d4a tip

Fix version
author Chris Cannam
date Thu, 13 Feb 2020 13:37:36 +0000
parents b54ee0a0be67
children
rev   line source
Chris@0 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chris@0 2 % Name: test_convert_pitch_to_CENS.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 CENS features (f_CENS) from pitch features (f_pitch)
Chris@0 8 % * CENS is a chroma-like feature
Chris@0 9 % (Chroma Energy Normalized Statistics)
Chris@0 10 %
Chris@0 11 % Reference:
Chris@0 12 % Details on the feature computation can be found in the following book:
Chris@0 13 %
Chris@0 14 % Meinard Mueller: Information Retrieval for Music and Motion,
Chris@0 15 % Springer 2007
Chris@0 16 %
Chris@0 17 % License:
Chris@0 18 % This file is part of 'Chroma Toolbox'.
Chris@0 19 %
Chris@0 20 % 'Chroma Toolbox' is free software: you can redistribute it and/or modify
Chris@0 21 % it under the terms of the GNU General Public License as published by
Chris@0 22 % the Free Software Foundation, either version 2 of the License, or
Chris@0 23 % (at your option) any later version.
Chris@0 24 %
Chris@0 25 % 'Chroma Toolbox' is distributed in the hope that it will be useful,
Chris@0 26 % but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 27 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 28 % GNU General Public License for more details.
Chris@0 29 %
Chris@0 30 % You should have received a copy of the GNU General Public License
Chris@0 31 % along with 'Chroma Toolbox'. If not, see <http://www.gnu.org/licenses/>.
Chris@0 32 %
Chris@0 33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chris@0 34
Chris@0 35 clear;
Chris@0 36 %close all hidden;
Chris@0 37
Chris@0 38 directory = 'data_feature/';
Chris@0 39
Chris@0 40
Chris@0 41 %filename = 'Bach_BWV988-Aria-Measures1-4_Meinard_fast.wav';
Chris@0 42 %filename = 'Burgmueller_Op100-02-FirstPart_Meinard_SE.wav';
Chris@0 43 %filename = 'Systematic_Cadence-C-Major_Meinard_portato.wav';
Chris@0 44 %filename = 'Systematic_Cadence-C-Major_Meinard_staccato.wav';
Chris@0 45 %filename = 'Systematic_Scale-C-Major_Meinard_fast.wav';
Chris@0 46 %filename = 'Systematic_Scale-C-Major_Meinard_middle.wav';
Chris@0 47 filename = 'Systematic_Chord-C-Major_Eight-Instruments.wav';
Chris@0 48
Chris@0 49
Chris@0 50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chris@0 51 % Loads pitch features (f_pitch) and computes CENS features (f_CENS)
Chris@0 52 %
Chris@0 53 % Note: feature filename is specified by WAV filename
Chris@0 54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chris@0 55
Chris@0 56 win_len = 4410;
Chris@0 57 filename_pitch = strcat(filename(1:end-4),'_pitch_',num2str(win_len));
Chris@0 58 load(strcat(directory,filename_pitch)); % load f_pitch and sideinfo;
Chris@0 59
Chris@0 60 parameter.winLenSmooth = 21;
Chris@0 61 parameter.downsampSmooth = 5;
Chris@0 62 parameter.featureRate = sideinfo.pitch.featureRate;
Chris@0 63 [f_CENS,sideinfo] = pitch_to_CENS(f_pitch,parameter,sideinfo);
Chris@0 64
Chris@0 65
Chris@0 66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chris@0 67 % Visualization of chromagrams (f_CENS,f_chroma)
Chris@0 68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chris@0 69
Chris@0 70 parameter.featureRate = sideinfo.CENS.featureRate;
Chris@0 71 parameter.xlabel = 'Time [Seconds]';
Chris@0 72 parameter.title = sprintf('CENS %d %d chromagram',parameter.winLenSmooth,parameter.downsampSmooth);
Chris@0 73 visualizeChroma(f_CENS,parameter);
Chris@0 74
Chris@0 75