d@0: /* ==================================== JUCER_BINARY_RESOURCE ==================================== d@0: d@0: This is an auto-generated file: Any edits you make may be overwritten! d@0: d@0: */ d@0: d@0: namespace BinaryData d@0: { d@0: d@0: //================== initMFCCVariables.m ================== d@0: static const unsigned char temp_binary_data_0[] = d@0: "function [mfccFilterWeights mfccDCTMatrix] = initMFCCVariables(sampleRate, FFTsize)\r\n" d@0: "\r\n" d@0: "Fs = sampleRate;\r\n" d@0: "Nfft = FFTsize;\r\n" d@0: " \r\n" d@0: "%Filter bank parameters\r\n" d@0: "lowestFrequency = 133.3333;\r\n" d@0: "linearFilters = 13;\r\n" d@0: "linearSpacing = 66.66666666;\r\n" d@0: "logFilters = 27;\r\n" d@0: "logSpacing = 1.0711703;\r\n" d@0: "cepstralCoefficients = 13;\r\n" d@0: "\r\n" d@0: "% Keep this around for later....\r\n" d@0: "totalFilters = linearFilters + logFilters;\r\n" d@0: "\r\n" d@0: "% Now figure the band edges. Interesting frequencies are spaced\r\n" d@0: "% by linearSpacing for a while, then go logarithmic. First figure0\r\n" d@0: "% all the interesting frequencies. Lower, center, and upper band\r\n" d@0: "% edges are all consecutive interesting frequencies. \r\n" d@0: "freqs = lowestFrequency + (0:linearFilters-1)*linearSpacing;\r\n" d@0: "freqs(linearFilters+1:totalFilters+2) = freqs(linearFilters) * logSpacing.^(1:logFilters+2);\r\n" d@0: "lower = freqs(1:totalFilters);\r\n" d@0: "center = freqs(2:totalFilters+1);\r\n" d@0: "upper = freqs(3:totalFilters+2);\r\n" d@0: "\r\n" d@0: "% each filter has unit weight, assuming a triangular weighting function\r\n" d@0: "mfccFilterWeights = zeros(totalFilters,Nfft/2);\r\n" d@0: "triangleHeight = 2./(upper-lower);\r\n" d@0: "fftFreqs = (0:Nfft/2-1)/(Nfft)*Fs;\r\n" d@0: "for chan=1:totalFilters\r\n" d@0: "\tmfccFilterWeights(chan,:) = (fftFreqs > lower(chan) & fftFreqs <= center(chan)).* triangleHeight(chan).*(fftFreqs-lower(chan))/(center(chan)-lower(chan)) + ...\r\n" d@0: " (fftFreqs > center(chan) & fftFreqs < upper(chan)) .* triangleHeight(chan).*(upper(chan)-fftFreqs)/(upper(chan)-center(chan));\r\n" d@0: "end\r\n" d@0: "\r\n" d@0: "% Figure out Discrete Cosine Transform. We want a matrix\r\n" d@0: "% dct(i,j) which is totalFilters x cepstralCoefficients in size.\r\n" d@0: "% The i,j component is given by cos( i * (j+0.5)/totalFilters pi )\r\n" d@0: "% where we have assumed that i and j start at 0.\r\n" d@0: "mfccDCTMatrix = 1/sqrt(totalFilters/2)*cos((0:(cepstralCoefficients-1))' * (2*(0:(totalFilters-1))+1) * pi/2/totalFilters);\r\n" d@0: "mfccDCTMatrix(1,:) = mfccDCTMatrix(1,:) * sqrt(2)/2;\r\n" d@0: "\r\n"; d@0: d@0: const char* initMFCCVariables_m = (const char*) temp_binary_data_0; d@0: d@0: d@0: const char* getNamedResource (const char*, int&) throw(); d@0: const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw() d@0: { d@0: unsigned int hash = 0; d@0: if (resourceNameUTF8 != 0) d@0: while (*resourceNameUTF8 != 0) d@0: hash = 31 * hash + (unsigned int) *resourceNameUTF8++; d@0: d@0: switch (hash) d@0: { d@0: case 0x45d89b1c: numBytes = 1883; return initMFCCVariables_m; d@0: default: break; d@0: } d@0: d@0: numBytes = 0; d@0: return 0; d@0: } d@0: d@0: const char* namedResourceList[] = d@0: { d@0: "initMFCCVariables_m" d@0: }; d@0: d@0: }