annotate chromamethods.h @ 41:d6bb9b43ac1c matthiasm-plugin

README and new parameters, not tested yet
author Matthias Mauch <mail@matthiasmauch.net>
date Fri, 22 Oct 2010 21:43:57 +0900
parents cf8898a0174c
children d398e73b46e0
rev   line source
Chris@35 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@35 2
Chris@35 3 /*
Chris@35 4 NNLS-Chroma / Chordino
Chris@35 5
Chris@35 6 Audio feature extraction plugins for chromagram and chord
Chris@35 7 estimation.
Chris@35 8
Chris@35 9 Centre for Digital Music, Queen Mary University of London.
Chris@35 10 This file copyright 2008-2010 Matthias Mauch and QMUL.
Chris@35 11
Chris@35 12 This program is free software; you can redistribute it and/or
Chris@35 13 modify it under the terms of the GNU General Public License as
Chris@35 14 published by the Free Software Foundation; either version 2 of the
Chris@35 15 License, or (at your option) any later version. See the file
Chris@35 16 COPYING included with this distribution for more information.
Chris@35 17 */
Chris@27 18
Chris@27 19 #ifndef _CHROMA_METHODS_H_
Chris@27 20 #define _CHROMA_METHODS_H_
Chris@27 21
Chris@27 22 #include <vector>
Chris@27 23 #include <string>
Chris@27 24
Chris@27 25 const int nNote = 256;
Chris@27 26
Chris@27 27 extern std::vector<float> SpecialConvolution(std::vector<float> convolvee, std::vector<float> kernel);
mail@41 28 extern void dictionaryMatrix(float* dm, float s_param);
Chris@27 29 extern std::vector<std::string> chordDictionary(std::vector<float> *mchorddict);
Chris@27 30 extern bool logFreqMatrix(int fs, int blocksize, float *outmatrix);
Chris@27 31
Chris@27 32 static const char* notenames[24] = {
Chris@27 33 "A (bass)","Bb (bass)","B (bass)","C (bass)","C# (bass)","D (bass)","Eb (bass)","E (bass)","F (bass)","F# (bass)","G (bass)","Ab (bass)",
Chris@27 34 "A","Bb","B","C","C#","D","Eb","E","F","F#","G","Ab"};
Chris@27 35
Chris@27 36 static const char* bassnames[12][12] ={
Chris@27 37 {"A","","B","C","C#","D","","E","","F#","G","G#"},
Chris@27 38 {"Bb","","C","Db","D","Eb","","F","","G","Ab","A"},
Chris@27 39 {"B","","C#","D","D#","E","","F#","","G#","A","A#"},
Chris@27 40 {"C","","D","Eb","E","F","","G","","A","Bb","B"},
Chris@27 41 {"C#","","D#","E","E#","F#","","G#","","A#","B","B#"},
Chris@27 42 {"D","","E","F","F#","G","","A","","B","C","C#"},
Chris@27 43 {"Eb","","F","Gb","G","Ab","","Bb","","C","Db","D"},
Chris@27 44 {"E","","F#","G","G#","A","","B","","C#","D","D#"},
Chris@27 45 {"F","","G","Ab","A","Bb","","C","","D","Eb","E"},
Chris@27 46 {"F#","","G#","A","A#","B","","C#","","D#","E","E#"},
Chris@27 47 {"G","","A","Bb","B","C","","D","","E","F","F#"},
Chris@27 48 {"Ab","","Bb","Cb","C","Db","","Eb","","F","Gb","G"}
Chris@27 49 };
Chris@27 50
Chris@27 51 static const float hammingwind[19] = {0.0082, 0.0110, 0.0191, 0.0316, 0.0470, 0.0633, 0.0786, 0.0911, 0.0992, 0.1020, 0.0992, 0.0911, 0.0786, 0.0633, 0.0470, 0.0316, 0.0191, 0.0110, 0.0082};
Chris@27 52 static const float basswindow[] = {0.001769, 0.015848, 0.043608, 0.084265, 0.136670, 0.199341, 0.270509, 0.348162, 0.430105, 0.514023, 0.597545, 0.678311, 0.754038, 0.822586, 0.882019, 0.930656, 0.967124, 0.990393, 0.999803, 0.995091, 0.976388, 0.944223, 0.899505, 0.843498, 0.777785, 0.704222, 0.624888, 0.542025, 0.457975, 0.375112, 0.295778, 0.222215, 0.156502, 0.100495, 0.055777, 0.023612, 0.004909, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000};
Chris@27 53 static const float treblewindow[] = {0.000350, 0.003144, 0.008717, 0.017037, 0.028058, 0.041719, 0.057942, 0.076638, 0.097701, 0.121014, 0.146447, 0.173856, 0.203090, 0.233984, 0.266366, 0.300054, 0.334860, 0.370590, 0.407044, 0.444018, 0.481304, 0.518696, 0.555982, 0.592956, 0.629410, 0.665140, 0.699946, 0.733634, 0.766016, 0.796910, 0.826144, 0.853553, 0.878986, 0.902299, 0.923362, 0.942058, 0.958281, 0.971942, 0.982963, 0.991283, 0.996856, 0.999650, 0.999650, 0.996856, 0.991283, 0.982963, 0.971942, 0.958281, 0.942058, 0.923362, 0.902299, 0.878986, 0.853553, 0.826144, 0.796910, 0.766016, 0.733634, 0.699946, 0.665140, 0.629410, 0.592956, 0.555982, 0.518696, 0.481304, 0.444018, 0.407044, 0.370590, 0.334860, 0.300054, 0.266366, 0.233984, 0.203090, 0.173856, 0.146447, 0.121014, 0.097701, 0.076638, 0.057942, 0.041719, 0.028058, 0.017037, 0.008717, 0.003144, 0.000350};
Chris@27 54
Chris@27 55 static const float sinvalue = 0.866025404;
Chris@27 56 static const float cosvalue = -0.5;
Chris@27 57
Chris@27 58 #include "nnls.h"
Chris@27 59
Chris@27 60 #endif
Chris@27 61