annotate JuceLibraryCode/BinaryData.cpp @ 15:585caf503ef5 tip

Tidy up for ROLI
author Geogaddi\David <d.m.ronan@qmul.ac.uk>
date Tue, 17 May 2016 18:50:19 +0100
parents 25bf17994ef1
children
rev   line source
d@0 1 /* ==================================== JUCER_BINARY_RESOURCE ====================================
d@0 2
d@0 3 This is an auto-generated file: Any edits you make may be overwritten!
d@0 4
d@0 5 */
d@0 6
d@0 7 namespace BinaryData
d@0 8 {
d@0 9
d@0 10 //================== initMFCCVariables.m ==================
d@0 11 static const unsigned char temp_binary_data_0[] =
d@0 12 "function [mfccFilterWeights mfccDCTMatrix] = initMFCCVariables(sampleRate, FFTsize)\r\n"
d@0 13 "\r\n"
d@0 14 "Fs = sampleRate;\r\n"
d@0 15 "Nfft = FFTsize;\r\n"
d@0 16 " \r\n"
d@0 17 "%Filter bank parameters\r\n"
d@0 18 "lowestFrequency = 133.3333;\r\n"
d@0 19 "linearFilters = 13;\r\n"
d@0 20 "linearSpacing = 66.66666666;\r\n"
d@0 21 "logFilters = 27;\r\n"
d@0 22 "logSpacing = 1.0711703;\r\n"
d@0 23 "cepstralCoefficients = 13;\r\n"
d@0 24 "\r\n"
d@0 25 "% Keep this around for later....\r\n"
d@0 26 "totalFilters = linearFilters + logFilters;\r\n"
d@0 27 "\r\n"
d@0 28 "% Now figure the band edges. Interesting frequencies are spaced\r\n"
d@0 29 "% by linearSpacing for a while, then go logarithmic. First figure0\r\n"
d@0 30 "% all the interesting frequencies. Lower, center, and upper band\r\n"
d@0 31 "% edges are all consecutive interesting frequencies. \r\n"
d@0 32 "freqs = lowestFrequency + (0:linearFilters-1)*linearSpacing;\r\n"
d@0 33 "freqs(linearFilters+1:totalFilters+2) = freqs(linearFilters) * logSpacing.^(1:logFilters+2);\r\n"
d@0 34 "lower = freqs(1:totalFilters);\r\n"
d@0 35 "center = freqs(2:totalFilters+1);\r\n"
d@0 36 "upper = freqs(3:totalFilters+2);\r\n"
d@0 37 "\r\n"
d@0 38 "% each filter has unit weight, assuming a triangular weighting function\r\n"
d@0 39 "mfccFilterWeights = zeros(totalFilters,Nfft/2);\r\n"
d@0 40 "triangleHeight = 2./(upper-lower);\r\n"
d@0 41 "fftFreqs = (0:Nfft/2-1)/(Nfft)*Fs;\r\n"
d@0 42 "for chan=1:totalFilters\r\n"
d@0 43 "\tmfccFilterWeights(chan,:) = (fftFreqs > lower(chan) & fftFreqs <= center(chan)).* triangleHeight(chan).*(fftFreqs-lower(chan))/(center(chan)-lower(chan)) + ...\r\n"
d@0 44 " (fftFreqs > center(chan) & fftFreqs < upper(chan)) .* triangleHeight(chan).*(upper(chan)-fftFreqs)/(upper(chan)-center(chan));\r\n"
d@0 45 "end\r\n"
d@0 46 "\r\n"
d@0 47 "% Figure out Discrete Cosine Transform. We want a matrix\r\n"
d@0 48 "% dct(i,j) which is totalFilters x cepstralCoefficients in size.\r\n"
d@0 49 "% The i,j component is given by cos( i * (j+0.5)/totalFilters pi )\r\n"
d@0 50 "% where we have assumed that i and j start at 0.\r\n"
d@0 51 "mfccDCTMatrix = 1/sqrt(totalFilters/2)*cos((0:(cepstralCoefficients-1))' * (2*(0:(totalFilters-1))+1) * pi/2/totalFilters);\r\n"
d@0 52 "mfccDCTMatrix(1,:) = mfccDCTMatrix(1,:) * sqrt(2)/2;\r\n"
d@0 53 "\r\n";
d@0 54
d@0 55 const char* initMFCCVariables_m = (const char*) temp_binary_data_0;
d@0 56
d@0 57
d@0 58 const char* getNamedResource (const char*, int&) throw();
d@0 59 const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw()
d@0 60 {
d@0 61 unsigned int hash = 0;
d@0 62 if (resourceNameUTF8 != 0)
d@0 63 while (*resourceNameUTF8 != 0)
d@0 64 hash = 31 * hash + (unsigned int) *resourceNameUTF8++;
d@0 65
d@0 66 switch (hash)
d@0 67 {
d@0 68 case 0x45d89b1c: numBytes = 1883; return initMFCCVariables_m;
d@0 69 default: break;
d@0 70 }
d@0 71
d@0 72 numBytes = 0;
d@0 73 return 0;
d@0 74 }
d@0 75
d@0 76 const char* namedResourceList[] =
d@0 77 {
d@0 78 "initMFCCVariables_m"
d@0 79 };
d@0 80
d@0 81 }