CMSIS-DSP: MFCC F32
MFCC F32 implementation MFCC F32 tests MFCC F32 in Python wrapper Python wrapper structure updated to support submodule like cmsisdsp.mfcc and cmsisdsp.fixedpoint PythonWrapper tests updated to use the new fixedpoint cmsisdsp.mfcc is used to generate the mel filter, dct and window coefficients.pull/19/head
parent
9f36d99a0b
commit
3d264cfabb
@ -0,0 +1,2 @@
|
||||
from internal import *
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
import numpy as np
|
||||
|
||||
def frequencyToMelSpace(freq):
|
||||
return 1127.0 * np.log(1.0 + freq / 700.0)
|
||||
|
||||
def melSpaceToFrequency(mels):
|
||||
return 700.0 * (np.exp(mels / 1127.0) - 1.0)
|
||||
|
||||
def melFilterMatrix(fmin, fmax, numOfMelFilters,fs,FFTSize):
|
||||
|
||||
filters = np.zeros((numOfMelFilters,int(FFTSize/2+1)))
|
||||
zeros = np.zeros(int(FFTSize // 2 ))
|
||||
|
||||
|
||||
fmin_mel = frequencyToMelSpace(fmin)
|
||||
fmax_mel = frequencyToMelSpace(fmax)
|
||||
mels = np.linspace(fmin_mel, fmax_mel, num=numOfMelFilters+2)
|
||||
|
||||
|
||||
linearfreqs = np.linspace( 0, fs/2.0, int(FFTSize // 2 + 1) )
|
||||
spectrogrammels = frequencyToMelSpace(linearfreqs)[1:]
|
||||
|
||||
|
||||
filtPos=[]
|
||||
filtLen=[]
|
||||
totalLen = 0
|
||||
packedFilters = []
|
||||
for n in range(numOfMelFilters):
|
||||
|
||||
|
||||
upper = (spectrogrammels - mels[n])/(mels[n+1]-mels[n])
|
||||
lower = (mels[n+2] - spectrogrammels)/(mels[n+2]-mels[n+1])
|
||||
|
||||
|
||||
filters[n, :] = np.hstack([0,np.maximum(zeros,np.minimum(upper,lower))])
|
||||
nb = 0
|
||||
startFound = False
|
||||
for sample in filters[n, :]:
|
||||
if not startFound and sample != 0.0:
|
||||
startFound = True
|
||||
startPos = nb
|
||||
|
||||
if startFound and sample == 0.0:
|
||||
endPos = nb - 1
|
||||
break
|
||||
nb = nb + 1
|
||||
filtLen.append(endPos - startPos+1)
|
||||
totalLen += endPos - startPos + 1
|
||||
filtPos.append(startPos)
|
||||
packedFilters += list(filters[n, startPos:endPos+1])
|
||||
|
||||
return filtLen,filtPos,totalLen,packedFilters,filters
|
||||
|
||||
|
||||
def dctMatrix(numOfDctOutputs, numOfMelFilters):
|
||||
|
||||
result = np.zeros((numOfDctOutputs,numOfMelFilters))
|
||||
s=(np.linspace(1,numOfMelFilters,numOfMelFilters) - 0.5)/numOfMelFilters
|
||||
|
||||
for i in range(0, numOfDctOutputs):
|
||||
result[i,:]=np.cos(i * np.pi*s) * np.sqrt(2.0/numOfMelFilters)
|
||||
|
||||
return result.reshape(numOfDctOutputs*numOfMelFilters)
|
||||
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
import cmsisdsp as dsp
|
||||
import numpy as np
|
||||
import cmsisdsp.fixedpoint as f
|
||||
import cmsisdsp.mfcc as mfcc
|
||||
import scipy.signal as sig
|
||||
|
||||
debug=np.array([ 0.65507051 ,-0.94647589 ,0.00627239 ,0.14151286 ,-0.10863318 ,-0.36370327
|
||||
,0.05777126 ,-0.11915792 ,0.50183546 ,-0.31461335 ,0.66440771 ,0.05389963
|
||||
,0.39690544 ,0.25424852 ,-0.17045277 ,0.09649268 ,0.87357385 ,-0.44666372
|
||||
,-0.02637822 ,-0.10055151 ,-0.14610252 ,-0.05981251 ,-0.02999124 ,0.60923213
|
||||
,0.10530095 ,0.35684248 ,0.21845946 ,0.47845017 ,-0.60206979 ,0.25186908
|
||||
,-0.27410056 ,-0.07080467 ,-0.05109539 ,-0.2666572 ,0.25483105 ,-0.86459185
|
||||
,0.07733397 ,-0.58535444 ,0.06230904 ,-0.04161475 ,-0.17467296 ,0.77721125
|
||||
,-0.01728161 ,-0.32141218 ,0.36674466 ,-0.17932843 ,0.78486115 ,0.12469579
|
||||
,-0.94796877 ,0.05536031 ,0.32627676 ,0.46628512 ,-0.02585836 ,-0.51439834
|
||||
,0.21387904 ,0.16319442 ,-0.01020818 ,-0.77161183 ,0.07754634 ,-0.24970455
|
||||
,0.2368003 ,0.35167963 ,0.14620137 ,-0.02415204 ,0.91086167 ,-0.02434647
|
||||
,-0.3968239 ,-0.04703925 ,-0.43905103 ,-0.34834965 ,0.33728158 ,0.15138992
|
||||
,-0.43218885 ,0.26619718 ,0.07177906 ,0.33393581 ,-0.50306915 ,-0.63101084
|
||||
,-0.08128395 ,-0.06569788 ,0.84232797 ,-0.32436751 ,0.02528537 ,-0.3498329
|
||||
,0.41859931 ,0.07794887 ,0.4571989 ,0.24290963 ,0.08437417 ,-0.01371585
|
||||
,-0.00103008 ,0.83978697 ,-0.29001237 ,0.14438743 ,0.11943318 ,-0.25576402
|
||||
,0.25151083 ,0.07886626 ,0.11565781 ,-0.01582203 ,0.1310246 ,-0.5553611
|
||||
,-0.37950665 ,0.44179691 ,0.08460877 ,0.30646419 ,0.48927934 ,-0.21240309
|
||||
,0.36844264 ,0.49686615 ,-0.81617664 ,0.52221472 ,-0.05188992 ,-0.03929655
|
||||
,-0.47674501 ,-0.54506781 ,0.30711148 ,0.10049337 ,-0.47549213 ,0.59106713
|
||||
,-0.62276051 ,-0.35182917 ,0.14612027 ,0.56142168 ,-0.01053732 ,0.35782179
|
||||
,-0.27220781 ,-0.03672346 ,-0.11282222 ,0.3364912 ,-0.22352515 ,-0.04245287
|
||||
,0.56968605 ,-0.14023724 ,-0.82982905 ,0.00860008 ,0.37920345 ,-0.53749318
|
||||
,-0.12761215 ,0.08567603 ,0.47020765 ,-0.28794812 ,-0.33888971 ,0.01850441
|
||||
,0.66848233 ,-0.26532759 ,-0.20777571 ,-0.68342729 ,-0.41498696 ,0.00593224
|
||||
,0.02229368 ,0.75596329 ,0.29447568 ,-0.1106449 ,0.24181939 ,0.05807497
|
||||
,-0.14343857 ,0.304988 ,0.00689148 ,-0.06264758 ,0.25864714 ,-0.22252155
|
||||
,0.28621689 ,0.17031599 ,-0.34694027 ,-0.01625718 ,0.39834181 ,0.01259659
|
||||
,-0.28022716 ,-0.02506168 ,-0.10276881 ,0.31733924 ,0.02787068 ,-0.09824124
|
||||
,0.45147797 ,0.14451518 ,0.17996395 ,-0.70594978 ,-0.92943177 ,0.13649282
|
||||
,-0.5938426 ,0.50289928 ,0.19635269 ,0.16811504 ,0.05803999 ,0.0037204
|
||||
,0.13847419 ,0.30568038 ,0.3700732 ,0.21257548 ,-0.31151753 ,-0.28836886
|
||||
,0.68743932 ,-0.11084429 ,-0.4673766 ,0.16637754 ,-0.38992572 ,0.16505578
|
||||
,-0.07499844 ,0.04226538 ,-0.11042177 ,0.0704542 ,-0.632819 ,-0.54898472
|
||||
,0.26498649 ,-0.59380386 ,0.93387213 ,0.06526726 ,-0.23223558 ,0.07941394
|
||||
,0.14325166 ,0.26914661 ,0.00925575 ,-0.34282161 ,-0.51418231 ,-0.12011075
|
||||
,-0.26676314 ,-0.09999028 ,0.03027513 ,0.22846503 ,-0.08930338 ,-0.1867156
|
||||
,0.66297846 ,0.32220769 ,-0.06015469 ,0.04034043 ,0.09595597 ,-1.
|
||||
,-0.42933352 ,0.25069376 ,-0.26030918 ,-0.28511861 ,-0.19931228 ,0.24408572
|
||||
,-0.3231952 ,0.45688981 ,-0.07354078 ,0.25669449 ,-0.44202722 ,0.11928406
|
||||
,-0.32826109 ,0.52660984 ,0.03067858 ,0.11095242 ,0.19933679 ,0.03042371
|
||||
,-0.34768682 ,0.09108447 ,0.61234556 ,0.1854931 ,0.19680502 ,0.27617564
|
||||
,0.33381827 ,-0.47358967 ,0.28714328 ,-0.27495982])
|
||||
|
||||
ref = [ 1.6844872e+01, -3.8865981e+00, -3.4971607e-01, -4.1598725e-01,
|
||||
-1.9625235e-01, -1.5887988e-01, -7.7221274e-02, 2.0610046e-01,
|
||||
1.3069814e-01, 1.1363924e-02, 4.9844027e-02, -5.6932509e-02,
|
||||
-1.6958869e-01]
|
||||
|
||||
|
||||
mfccf32=dsp.arm_mfcc_instance_f32()
|
||||
|
||||
sample_rate = 16000
|
||||
FFTSize = 256
|
||||
numOfDctOutputs = 13
|
||||
|
||||
freq_min = 64
|
||||
freq_high = sample_rate / 2
|
||||
numOfMelFilters = 20
|
||||
|
||||
window = sig.hamming(FFTSize, sym=False)
|
||||
|
||||
filtLen,filtPos,totalLen,packedFilters,_ = mfcc.melFilterMatrix(freq_min, freq_high, numOfMelFilters,sample_rate,FFTSize)
|
||||
|
||||
|
||||
dctMatrixFilters = mfcc.dctMatrix(numOfDctOutputs, numOfMelFilters)
|
||||
|
||||
|
||||
|
||||
|
||||
status=dsp.arm_mfcc_init_f32(mfccf32,256,20,13,dctMatrixFilters,
|
||||
filtPos,filtLen,packedFilters,window)
|
||||
print(status)
|
||||
|
||||
tmp=np.zeros(FFTSize + 2)
|
||||
|
||||
res=dsp.arm_mfcc_f32(mfccf32,debug,tmp)
|
||||
|
||||
print(res)
|
||||
|
||||
print(ref)
|
||||
|
||||
print(mfccf32.fftLen())
|
||||
print(mfccf32.nbMelFilters())
|
||||
print(mfccf32.nbDctOutputs())
|
||||
@ -0,0 +1,67 @@
|
||||
###########################################
|
||||
# Project: CMSIS DSP Library
|
||||
# Title: GenMFCCDataForCPP.py
|
||||
# Description: Generation of MFCC arrays for the MFCC function
|
||||
#
|
||||
# $Date: 07 September 2021
|
||||
# $Revision: V1.10.0
|
||||
#
|
||||
# Target Processor: Cortex-M and Cortex-A cores
|
||||
# -------------------------------------------------------------------- */
|
||||
#
|
||||
# Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
# not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
############################################
|
||||
|
||||
#########################
|
||||
#
|
||||
# This script is generating arrays required by the MFCC implementation:
|
||||
# DCT coefficients and Mel filters
|
||||
# Those arrays must be used with the arm_mfcc_init functions
|
||||
# The configuration is done through a yaml file describing the values for the
|
||||
# MFCC and the type
|
||||
#
|
||||
import argparse
|
||||
import yaml
|
||||
import mfccdata
|
||||
import os.path
|
||||
|
||||
parser = argparse.ArgumentParser(description='Generate MFCC Data for CPP')
|
||||
|
||||
|
||||
parser.add_argument('-n', nargs='?',type = str, default="mfccdata", help="mfcc file name")
|
||||
parser.add_argument('-d', nargs='?',type = str, default="Testing/Source/Tests", help="mfcc c file directory")
|
||||
parser.add_argument('-i', nargs='?',type = str, default="Testing/Include/Tests", help="mfcc h file directory")
|
||||
parser.add_argument('others', nargs=argparse.REMAINDER)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
|
||||
if args.n and args.d and args.others:
|
||||
cpath=os.path.join(args.d,args.n + ".c")
|
||||
hpath=os.path.join(args.i,args.n + ".h")
|
||||
|
||||
with open(args.others[0],"r") as f:
|
||||
configs=yaml.safe_load(f)
|
||||
mfccdata.prepareDctconfig(configs["dct"])
|
||||
mfccdata.prepareMelconfig(configs["melfilter"])
|
||||
mfccdata.prepareWindowConfig(configs["window"])
|
||||
with open(hpath,"w") as h:
|
||||
mfccdata.genMfccHeader(h,configs,args.n)
|
||||
with open(cpath,"w") as c:
|
||||
mfccdata.genMfccInit(c,configs,args.n)
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
dct:
|
||||
config1:
|
||||
melFilters: 20
|
||||
dctOutputs: 13
|
||||
type: "f32"
|
||||
|
||||
melfilter:
|
||||
config1:
|
||||
fftlength: 1024
|
||||
fmin: 64
|
||||
fmax: 8000
|
||||
samplingRate : 16000
|
||||
melFilters: 20
|
||||
type: "f32"
|
||||
|
||||
config2:
|
||||
fftlength: 512
|
||||
fmin: 64
|
||||
fmax: 8000
|
||||
samplingRate : 16000
|
||||
melFilters: 20
|
||||
type: "f32"
|
||||
|
||||
config3 :
|
||||
fftlength: 256
|
||||
fmin: 64
|
||||
fmax: 8000
|
||||
samplingRate : 16000
|
||||
melFilters: 20
|
||||
type: "f32"
|
||||
|
||||
window:
|
||||
config1:
|
||||
fftlength: 1024
|
||||
type: "f32"
|
||||
win: "hamming"
|
||||
|
||||
config2:
|
||||
fftlength: 512
|
||||
type: "f32"
|
||||
win: "hamming"
|
||||
|
||||
config3:
|
||||
fftlength: 256
|
||||
type: "f32"
|
||||
win: "hamming"
|
||||
@ -0,0 +1,231 @@
|
||||
###########################################
|
||||
# Project: CMSIS DSP Library
|
||||
# Title: mfccdata.py
|
||||
# Description: Generation of MFCC arays for the MFCC C init function
|
||||
#
|
||||
# $Date: 07 September 2021
|
||||
# $Revision: V1.10.0
|
||||
#
|
||||
# Target Processor: Cortex-M and Cortex-A cores
|
||||
# -------------------------------------------------------------------- */
|
||||
#
|
||||
# Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
# not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
############################################
|
||||
import numpy as np
|
||||
from jinja2 import Environment, PackageLoader, select_autoescape,FileSystemLoader
|
||||
import os.path
|
||||
import struct
|
||||
import scipy.signal as sig
|
||||
|
||||
def to_q31(v):
|
||||
r = int(round(v * 2**31))
|
||||
if (r > 0x07FFFFFFF):
|
||||
r = 0x07FFFFFFF
|
||||
if (r < -0x080000000):
|
||||
r = -0x080000000
|
||||
return ("0x%s" % format(struct.unpack('<I', struct.pack('<i', r))[0],'08X'))
|
||||
|
||||
def to_q15(v):
|
||||
r = int(round(v * 2**15))
|
||||
if (r > 0x07FFF):
|
||||
r = 0x07FFF
|
||||
if (r < -0x08000):
|
||||
r = -0x08000
|
||||
return ("0x%s" % format(struct.unpack('<H', struct.pack('<h', r))[0],'04X'))
|
||||
|
||||
def to_f16(v):
|
||||
return("(float16_t)%f" % struct.unpack('<e',struct.pack('<e',v)))
|
||||
|
||||
def to_f32(v):
|
||||
return("%ff" % struct.unpack('<f',struct.pack('<f',v)))
|
||||
|
||||
class ConvertArray:
|
||||
def __init__(self,theType):
|
||||
self._cvt = lambda x : x
|
||||
if theType=="f32":
|
||||
self._cvt = to_f32
|
||||
if theType=="f16":
|
||||
self._cvt = to_f16
|
||||
if theType=="q31":
|
||||
self._cvt = to_q31
|
||||
if theType=="q15":
|
||||
self._cvt = to_q15
|
||||
|
||||
def getArrayContent(self,samples):
|
||||
nb = 0
|
||||
res=""
|
||||
res += "{\n"
|
||||
for sample in samples:
|
||||
res += str(self._cvt(sample))
|
||||
res += ","
|
||||
nb = nb + 1
|
||||
if nb == 10:
|
||||
res += "\n"
|
||||
nb = 0
|
||||
res += "}"
|
||||
return(res)
|
||||
|
||||
|
||||
|
||||
def frequencyToMelSpace(freq):
|
||||
return 1127.0 * np.log(1.0 + freq / 700.0)
|
||||
|
||||
def melSpaceToFrequency(mels):
|
||||
return 700.0 * (np.exp(mels / 1127.0) - 1.0)
|
||||
|
||||
def melFilterMatrix(fmin, fmax, numOfMelFilters,fs,FFTSize):
|
||||
|
||||
filters = np.zeros((numOfMelFilters,int(FFTSize/2+1)))
|
||||
zeros = np.zeros(int(FFTSize // 2 ))
|
||||
|
||||
|
||||
fmin_mel = frequencyToMelSpace(fmin)
|
||||
fmax_mel = frequencyToMelSpace(fmax)
|
||||
mels = np.linspace(fmin_mel, fmax_mel, num=numOfMelFilters+2)
|
||||
|
||||
|
||||
linearfreqs = np.linspace( 0, fs/2.0, int(FFTSize // 2 + 1) )
|
||||
spectrogrammels = frequencyToMelSpace(linearfreqs)[1:]
|
||||
|
||||
|
||||
filtPos=[]
|
||||
filtLen=[]
|
||||
totalLen = 0
|
||||
packedFilters = []
|
||||
for n in range(numOfMelFilters):
|
||||
|
||||
|
||||
upper = (spectrogrammels - mels[n])/(mels[n+1]-mels[n])
|
||||
lower = (mels[n+2] - spectrogrammels)/(mels[n+2]-mels[n+1])
|
||||
|
||||
|
||||
filters[n, :] = np.hstack([0,np.maximum(zeros,np.minimum(upper,lower))])
|
||||
nb = 0
|
||||
startFound = False
|
||||
for sample in filters[n, :]:
|
||||
if not startFound and sample != 0.0:
|
||||
startFound = True
|
||||
startPos = nb
|
||||
|
||||
if startFound and sample == 0.0:
|
||||
endPos = nb - 1
|
||||
break
|
||||
nb = nb + 1
|
||||
filtLen.append(endPos - startPos+1)
|
||||
totalLen += endPos - startPos + 1
|
||||
filtPos.append(startPos)
|
||||
packedFilters += list(filters[n, startPos:endPos+1])
|
||||
|
||||
return filtLen,filtPos,totalLen,packedFilters,filters
|
||||
|
||||
|
||||
def dctMatrix(numOfDctOutputs, numOfMelFilters):
|
||||
|
||||
result = np.zeros((numOfDctOutputs,numOfMelFilters))
|
||||
s=(np.linspace(1,numOfMelFilters,numOfMelFilters) - 0.5)/numOfMelFilters
|
||||
|
||||
for i in range(0, numOfDctOutputs):
|
||||
result[i,:]=np.cos(i * np.pi*s) * np.sqrt(2.0/numOfMelFilters)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def ctype(s):
|
||||
if s == "f64":
|
||||
return("float64_t")
|
||||
if s == "f32":
|
||||
return("float32_t")
|
||||
if s == "f16":
|
||||
return("float16_t")
|
||||
if s == "q31":
|
||||
return("q31_t")
|
||||
if s == "q15":
|
||||
return("q15_t")
|
||||
|
||||
def typeext(s):
|
||||
if s == "f64":
|
||||
return("_f64")
|
||||
if s == "f32":
|
||||
return("_f32")
|
||||
if s == "f16":
|
||||
return("_f16")
|
||||
if s == "q31":
|
||||
return("_q31")
|
||||
if s == "q15":
|
||||
return("_q15")
|
||||
|
||||
def prepareWindowConfig(configs):
|
||||
# sig.hamming(FFTSize, sym=False)
|
||||
for config in configs:
|
||||
c=configs[config]
|
||||
if c["win"] == "hamming":
|
||||
win = sig.hamming(c["fftlength"], sym=False)
|
||||
if c["win"] == "hanning":
|
||||
win = sig.hann(c["fftlength"], sym=False)
|
||||
|
||||
cvt=ConvertArray(c["type"])
|
||||
c["ctype"]=ctype(c["type"])
|
||||
c["ext"]=typeext(c["type"])
|
||||
|
||||
c["winSamples"] = cvt.getArrayContent(win)
|
||||
|
||||
def prepareMelconfig(configs):
|
||||
for config in configs:
|
||||
c=configs[config]
|
||||
|
||||
cvt=ConvertArray(c["type"])
|
||||
cvtInt=ConvertArray(None)
|
||||
c["ctype"]=ctype(c["type"])
|
||||
c["ext"]=typeext(c["type"])
|
||||
|
||||
filtLen,filtPos,totalLen,packedFilters,filters = melFilterMatrix(c["fmin"], c["fmax"], c["melFilters"],c["samplingRate"],c["fftlength"])
|
||||
|
||||
c["filtLenArray"]=cvtInt.getArrayContent(filtLen)
|
||||
c["filtPosArray"]=cvtInt.getArrayContent(filtPos)
|
||||
c["totalLen"]=totalLen
|
||||
c["filters"]=cvt.getArrayContent(packedFilters)
|
||||
|
||||
def prepareDctconfig(configs):
|
||||
for config in configs:
|
||||
c=configs[config]
|
||||
|
||||
cvt=ConvertArray(c["type"])
|
||||
c["ctype"]=ctype(c["type"])
|
||||
c["ext"]=typeext(c["type"])
|
||||
c["dctMatrixLength"]=c["dctOutputs"] * c["melFilters"]
|
||||
|
||||
dctMat = dctMatrix(c["dctOutputs"],c["melFilters"])
|
||||
dctMat=dctMat.reshape(c["dctMatrixLength"])
|
||||
c["dctMatrix"]=cvt.getArrayContent(dctMat)
|
||||
|
||||
#print(configs)
|
||||
|
||||
env = Environment(
|
||||
loader=PackageLoader("mfccdata","mfcctemplates"),
|
||||
autoescape=select_autoescape(),
|
||||
trim_blocks=True
|
||||
)
|
||||
|
||||
ctemplate = env.get_template("mfccdata.c")
|
||||
htemplate = env.get_template("mfccdata.h")
|
||||
|
||||
|
||||
def genMfccHeader(f,configs,filename):
|
||||
print(htemplate.render(configs=configs,filename=filename),file=f)
|
||||
|
||||
def genMfccInit(f,configs,filename):
|
||||
print(ctemplate.render(configs=configs,filename=filename),file=f)
|
||||
@ -0,0 +1,23 @@
|
||||
#include "{{filename}}.h"
|
||||
|
||||
{% for config in configs["dct"] %}
|
||||
const {{configs["dct"][config]["ctype"]}} mfcc_dct_coefs_{{config}}[NB_MFCC_DCT_COEFS_{{config.upper()}}]={{configs["dct"][config]["dctMatrix"]}};
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% for config in configs["window"] %}
|
||||
const {{configs["window"][config]["ctype"]}} mfcc_window_coefs_{{config}}[NB_MFCC_WIN_COEFS_{{config.upper()}}]={{configs["window"][config]["winSamples"]}};
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% for config in configs["melfilter"] %}
|
||||
const uint32_t mfcc_filter_pos_{{config}}[NB_MFCC_NB_FILTER_{{config.upper()}}]={{configs["melfilter"][config]["filtPosArray"]}};
|
||||
const uint32_t mfcc_filter_len_{{config}}[NB_MFCC_NB_FILTER_{{config.upper()}}]={{configs["melfilter"][config]["filtLenArray"]}};
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for config in configs["melfilter"] %}
|
||||
const {{configs["melfilter"][config]["ctype"]}} mfcc_filter_coefs_{{config}}[NB_MFCC_FILTER_COEFS_{{config.upper()}}]={{configs["melfilter"][config]["filters"]}};
|
||||
|
||||
{% endfor %}
|
||||
@ -0,0 +1,62 @@
|
||||
#ifndef _MFCC_DATA_H_
|
||||
#define _MFCC_DATA_H_
|
||||
|
||||
#include "arm_math_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/*****
|
||||
|
||||
DCT COEFFICIENTS FOR THE MFCC
|
||||
|
||||
*****/
|
||||
|
||||
{% for config in configs["dct"] %}
|
||||
#define NB_MFCC_DCT_COEFS_{{config.upper()}} {{configs["dct"][config]['dctMatrixLength']}}
|
||||
extern const {{configs["dct"][config]["ctype"]}} mfcc_dct_coefs_{{config}}[NB_MFCC_DCT_COEFS_{{config.upper()}}];
|
||||
|
||||
{% endfor %}
|
||||
|
||||
/*****
|
||||
|
||||
WINDOW COEFFICIENTS
|
||||
|
||||
*****/
|
||||
|
||||
{% for config in configs["window"] %}
|
||||
#define NB_MFCC_WIN_COEFS_{{config.upper()}} {{configs["window"][config]['fftlength']}}
|
||||
extern const {{configs["window"][config]["ctype"]}} mfcc_window_coefs_{{config}}[NB_MFCC_WIN_COEFS_{{config.upper()}}];
|
||||
|
||||
{% endfor %}
|
||||
|
||||
/*****
|
||||
|
||||
MEL FILTER COEFFICIENTS FOR THE MFCC
|
||||
|
||||
*****/
|
||||
|
||||
{% for config in configs["melfilter"] %}
|
||||
#define NB_MFCC_NB_FILTER_{{config.upper()}} {{configs["melfilter"][config]['melFilters']}}
|
||||
extern const uint32_t mfcc_filter_pos_{{config}}[NB_MFCC_NB_FILTER_{{config.upper()}}];
|
||||
extern const uint32_t mfcc_filter_len_{{config}}[NB_MFCC_NB_FILTER_{{config.upper()}}];
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
{% for config in configs["melfilter"] %}
|
||||
#define NB_MFCC_FILTER_COEFS_{{config.upper()}} {{configs["melfilter"][config]['totalLen']}}
|
||||
extern const {{configs["melfilter"][config]["ctype"]}} mfcc_filter_coefs_{{config}}[NB_MFCC_FILTER_COEFS_{{config.upper()}}];
|
||||
|
||||
{% endfor %}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,159 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_mfcc_f32.c
|
||||
* Description: MFCC function for the f32 version
|
||||
*
|
||||
* $Date: 07 September 2021
|
||||
* $Revision: V1.10.0
|
||||
*
|
||||
* Target Processor: Cortex-M and Cortex-A cores
|
||||
* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "dsp/transform_functions.h"
|
||||
#include "dsp/statistics_functions.h"
|
||||
#include "dsp/basic_math_functions.h"
|
||||
#include "dsp/complex_math_functions.h"
|
||||
#include "dsp/fast_math_functions.h"
|
||||
#include "dsp/matrix_functions.h"
|
||||
|
||||
/**
|
||||
@ingroup groupTransforms
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
@defgroup MFCC MFCC
|
||||
|
||||
MFCC Transform
|
||||
|
||||
There are separate functions for floating-point, Q15, and Q31 data types.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@addtogroup MFCC
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief MFCC F32
|
||||
@param[in] S points to the mfcc instance structure
|
||||
@param[in] pSrc points to the input samples
|
||||
@param[out] pDst points to the output MFCC values
|
||||
@param[inout] pTmp points to a temporary buffer of complex
|
||||
|
||||
@return none
|
||||
|
||||
@par Description
|
||||
The number of input samples if the FFT length used
|
||||
when initializing the instance data structure.
|
||||
|
||||
The temporary buffer has a 2*fft length size when MFCC
|
||||
is implemented with CFFT.
|
||||
It has length FFT Length + 2 when implemented with RFFT
|
||||
(default implementation).
|
||||
|
||||
The source buffer is modified by this function.
|
||||
|
||||
*/
|
||||
void arm_mfcc_f32(
|
||||
arm_mfcc_instance_f32 * S,
|
||||
float32_t *pSrc,
|
||||
float32_t *pDst,
|
||||
float32_t *pTmp
|
||||
)
|
||||
{
|
||||
float32_t maxValue;
|
||||
uint32_t index;
|
||||
uint32_t i;
|
||||
float32_t result;
|
||||
const float32_t *coefs=S->filterCoefs;
|
||||
arm_matrix_instance_f32 pDctMat;
|
||||
|
||||
/* Normalize */
|
||||
arm_absmax_f32(pSrc,S->fftLen,&maxValue,&index);
|
||||
|
||||
arm_scale_f32(pSrc,1.0f/maxValue,pSrc,S->fftLen);
|
||||
|
||||
/* Multiply by window */
|
||||
arm_mult_f32(pSrc,S->windowCoefs,pSrc,S->fftLen);
|
||||
|
||||
/* Compute spectrum magnitude
|
||||
*/
|
||||
#if defined(ARM_MFCC_CFFT_BASED)
|
||||
/* some HW accelerator for CMSIS-DSP used in some boards
|
||||
are only providing acceleration for CFFT.
|
||||
With ARM_MFCC_CFFT_BASED enabled, CFFT is used and the MFCC
|
||||
will be accelerated on those boards.
|
||||
|
||||
The default is to use RFFT
|
||||
*/
|
||||
/* Convert from real to complex */
|
||||
for(i=0; i < S->fftLen ; i++)
|
||||
{
|
||||
pTmp[2*i] = pSrc[i];
|
||||
pTmp[2*i+1] = 0.0f;
|
||||
}
|
||||
arm_cfft_f32(&(S->cfft),pTmp,0,1);
|
||||
#else
|
||||
/* Default RFFT based implementation */
|
||||
arm_rfft_fast_f32(&(S->rfft),pSrc,pTmp,0);
|
||||
/* Unpack real values */
|
||||
pTmp[S->fftLen]=pTmp[1];
|
||||
pTmp[S->fftLen+1]=0.0f;
|
||||
pTmp[1]=0.0f;
|
||||
#endif
|
||||
arm_cmplx_mag_f32(pTmp,pSrc,S->fftLen);
|
||||
|
||||
/* Apply MEL filters */
|
||||
for(i=0; i<S->nbMelFilters; i++)
|
||||
{
|
||||
arm_dot_prod_f32(pSrc+S->filterPos[i],
|
||||
coefs,
|
||||
S->filterLengths[i],
|
||||
&result);
|
||||
|
||||
coefs += S->filterLengths[i];
|
||||
|
||||
pTmp[i] = result;
|
||||
|
||||
}
|
||||
|
||||
/* Compute the log */
|
||||
arm_offset_f32(pTmp,1.0e-6f,pTmp,S->nbMelFilters);
|
||||
arm_vlog_f32(pTmp,pTmp,S->nbMelFilters);
|
||||
|
||||
/* Multiply with the DCT matrix */
|
||||
|
||||
pDctMat.numRows=S->nbDctOutputs;
|
||||
pDctMat.numCols=S->nbMelFilters;
|
||||
pDctMat.pData=(float32_t*)S->dctCoefs;
|
||||
|
||||
arm_mat_vec_mult_f32(&pDctMat, pTmp, pDst);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@} end of MFCC group
|
||||
*/
|
||||
@ -0,0 +1,107 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_mfcc_init_f32.c
|
||||
* Description: MFCC initialization function for the f32 version
|
||||
*
|
||||
* $Date: 07 September 2021
|
||||
* $Revision: V1.10.0
|
||||
*
|
||||
* Target Processor: Cortex-M and Cortex-A cores
|
||||
* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ingroup groupTransforms
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
@addtogroup MFCC
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
#include "dsp/transform_functions.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@brief Initialization of the MFCC F32 instance structure
|
||||
@param[out] S points to the mfcc instance structure
|
||||
@param[in] fftLen fft length
|
||||
@param[in] nbMelFilters number of Mel filters
|
||||
@param[in] nbDctOutputs number of Dct outputs
|
||||
@param[in] dctCoefs points to an array of DCT coefficients
|
||||
@param[in] filterPos points of the array of filter positions
|
||||
@param[in] filterLengths points to the array of filter lengths
|
||||
@param[in] filterCoefs points to the array of filter coefficients
|
||||
@param[in] windowCoefs points to the array of window coefficients
|
||||
|
||||
@return error status
|
||||
|
||||
@par Description
|
||||
The matrix of Mel filter coefficients is sparse.
|
||||
Most of the coefficients are zero.
|
||||
To avoid multiplying the spectrogram by those zeros, the
|
||||
filter is applied only to a given position in the spectrogram
|
||||
and on a given number of FFT bins (the filter length).
|
||||
It is the reason for the arrays filterPos and filterLengths.
|
||||
|
||||
window coefficients can describe (for instance) a Hamming window.
|
||||
The array has the same size as the FFT length.
|
||||
|
||||
The folder Scripts is containing a Python script which can be used
|
||||
to generate the filter, dct and window arrays.
|
||||
*/
|
||||
|
||||
arm_status arm_mfcc_init_f32(
|
||||
arm_mfcc_instance_f32 * S,
|
||||
uint32_t fftLen,
|
||||
uint32_t nbMelFilters,
|
||||
uint32_t nbDctOutputs,
|
||||
const float32_t *dctCoefs,
|
||||
const uint32_t *filterPos,
|
||||
const uint32_t *filterLengths,
|
||||
const float32_t *filterCoefs,
|
||||
const float32_t *windowCoefs
|
||||
)
|
||||
{
|
||||
arm_status status;
|
||||
|
||||
S->fftLen=fftLen;
|
||||
S->nbMelFilters=nbMelFilters;
|
||||
S->nbDctOutputs=nbDctOutputs;
|
||||
S->dctCoefs=dctCoefs;
|
||||
S->filterPos=filterPos;
|
||||
S->filterLengths=filterLengths;
|
||||
S->filterCoefs=filterCoefs;
|
||||
S->windowCoefs=windowCoefs;
|
||||
|
||||
#if defined(ARM_MFCC_CFFT_BASED)
|
||||
status=arm_cfft_init_f32(&(S->cfft),fftLen);
|
||||
#else
|
||||
status=arm_rfft_fast_init_f32(&(S->rfft),fftLen);
|
||||
#endif
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
/**
|
||||
@} end of MFCC group
|
||||
*/
|
||||
@ -0,0 +1,28 @@
|
||||
#include "Test.h"
|
||||
#include "Pattern.h"
|
||||
|
||||
#include "dsp/transform_functions.h"
|
||||
|
||||
class MFCCF32:public Client::Suite
|
||||
{
|
||||
public:
|
||||
MFCCF32(Testing::testID_t id);
|
||||
virtual void setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr);
|
||||
virtual void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
|
||||
private:
|
||||
#include "MFCCF32_decl.h"
|
||||
|
||||
Client::Pattern<float32_t> input1;
|
||||
Client::Pattern<float32_t> input2;
|
||||
Client::LocalPattern<float32_t> output;
|
||||
Client::LocalPattern<float32_t> tmp;
|
||||
Client::LocalPattern<float32_t> tmpin;
|
||||
|
||||
// Reference patterns are not loaded when we are in dump mode
|
||||
Client::RefPattern<float32_t> ref;
|
||||
|
||||
arm_mfcc_instance_f32 mfcc;
|
||||
|
||||
uint32_t fftLen;
|
||||
|
||||
};
|
||||
@ -0,0 +1,74 @@
|
||||
#ifndef _MFCC_DATA_H_
|
||||
#define _MFCC_DATA_H_
|
||||
|
||||
#include "arm_math_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/*****
|
||||
|
||||
DCT COEFFICIENTS FOR THE MFCC
|
||||
|
||||
*****/
|
||||
|
||||
#define NB_MFCC_DCT_COEFS_CONFIG1 260
|
||||
extern const float32_t mfcc_dct_coefs_config1[NB_MFCC_DCT_COEFS_CONFIG1];
|
||||
|
||||
|
||||
/*****
|
||||
|
||||
WINDOW COEFFICIENTS
|
||||
|
||||
*****/
|
||||
|
||||
#define NB_MFCC_WIN_COEFS_CONFIG1 1024
|
||||
extern const float32_t mfcc_window_coefs_config1[NB_MFCC_WIN_COEFS_CONFIG1];
|
||||
|
||||
#define NB_MFCC_WIN_COEFS_CONFIG2 512
|
||||
extern const float32_t mfcc_window_coefs_config2[NB_MFCC_WIN_COEFS_CONFIG2];
|
||||
|
||||
#define NB_MFCC_WIN_COEFS_CONFIG3 256
|
||||
extern const float32_t mfcc_window_coefs_config3[NB_MFCC_WIN_COEFS_CONFIG3];
|
||||
|
||||
|
||||
/*****
|
||||
|
||||
MEL FILTER COEFFICIENTS FOR THE MFCC
|
||||
|
||||
*****/
|
||||
|
||||
#define NB_MFCC_NB_FILTER_CONFIG1 20
|
||||
extern const uint32_t mfcc_filter_pos_config1[NB_MFCC_NB_FILTER_CONFIG1];
|
||||
extern const uint32_t mfcc_filter_len_config1[NB_MFCC_NB_FILTER_CONFIG1];
|
||||
|
||||
#define NB_MFCC_NB_FILTER_CONFIG2 20
|
||||
extern const uint32_t mfcc_filter_pos_config2[NB_MFCC_NB_FILTER_CONFIG2];
|
||||
extern const uint32_t mfcc_filter_len_config2[NB_MFCC_NB_FILTER_CONFIG2];
|
||||
|
||||
#define NB_MFCC_NB_FILTER_CONFIG3 20
|
||||
extern const uint32_t mfcc_filter_pos_config3[NB_MFCC_NB_FILTER_CONFIG3];
|
||||
extern const uint32_t mfcc_filter_len_config3[NB_MFCC_NB_FILTER_CONFIG3];
|
||||
|
||||
|
||||
|
||||
|
||||
#define NB_MFCC_FILTER_COEFS_CONFIG1 948
|
||||
extern const float32_t mfcc_filter_coefs_config1[NB_MFCC_FILTER_COEFS_CONFIG1];
|
||||
|
||||
#define NB_MFCC_FILTER_COEFS_CONFIG2 473
|
||||
extern const float32_t mfcc_filter_coefs_config2[NB_MFCC_FILTER_COEFS_CONFIG2];
|
||||
|
||||
#define NB_MFCC_FILTER_COEFS_CONFIG3 236
|
||||
extern const float32_t mfcc_filter_coefs_config3[NB_MFCC_FILTER_COEFS_CONFIG3];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,244 @@
|
||||
###########################################
|
||||
# Project: CMSIS DSP Library
|
||||
# Title: MFCC.py
|
||||
# Description: Test pattern generation for MFCC
|
||||
#
|
||||
# $Date: 02 September 2021
|
||||
# $Revision: V1.10.0
|
||||
#
|
||||
# Target Processor: Cortex-M and Cortex-A cores
|
||||
# -------------------------------------------------------------------- */
|
||||
#
|
||||
# Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
# not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
############################################
|
||||
import os.path
|
||||
import numpy as np
|
||||
import itertools
|
||||
import Tools
|
||||
import scipy
|
||||
import scipy.signal as sig
|
||||
import scipy.fftpack
|
||||
|
||||
|
||||
################################
|
||||
#
|
||||
# Gives the same results as the tensorflow lite
|
||||
# MFCC if hamming window is used
|
||||
# (TF stft) is using hanning by default
|
||||
#
|
||||
|
||||
DEBUG = False
|
||||
|
||||
def frequencyToMelSpace(freq):
|
||||
return 1127.0 * np.log(1.0 + freq / 700.0)
|
||||
|
||||
def melSpaceToFrequency(mels):
|
||||
return 700.0 * (np.exp(mels / 1127.0) - 1.0)
|
||||
|
||||
def melFilterMatrix(fmin, fmax, numOfMelFilters,fs,FFTSize):
|
||||
|
||||
filters = np.zeros((numOfMelFilters,int(FFTSize/2+1)))
|
||||
zeros = np.zeros(int(FFTSize // 2 ))
|
||||
|
||||
|
||||
fmin_mel = frequencyToMelSpace(fmin)
|
||||
fmax_mel = frequencyToMelSpace(fmax)
|
||||
mels = np.linspace(fmin_mel, fmax_mel, num=numOfMelFilters+2)
|
||||
|
||||
|
||||
linearfreqs = np.linspace( 0, fs/2.0, int(FFTSize // 2 + 1) )
|
||||
spectrogrammels = frequencyToMelSpace(linearfreqs)[1:]
|
||||
|
||||
|
||||
for n in range(numOfMelFilters):
|
||||
|
||||
|
||||
upper = (spectrogrammels - mels[n])/(mels[n+1]-mels[n])
|
||||
lower = (mels[n+2] - spectrogrammels)/(mels[n+2]-mels[n+1])
|
||||
|
||||
|
||||
filters[n, :] = np.hstack([0,np.maximum(zeros,np.minimum(upper,lower))])
|
||||
|
||||
return filters
|
||||
|
||||
|
||||
def dctMatrix(numOfDctOutputs, numOfMelFilters):
|
||||
|
||||
result = np.zeros((numOfDctOutputs,numOfMelFilters))
|
||||
s=(np.linspace(1,numOfMelFilters,numOfMelFilters) - 0.5)/numOfMelFilters
|
||||
|
||||
for i in range(0, numOfDctOutputs):
|
||||
result[i,:]=np.cos(i * np.pi*s) * np.sqrt(2.0/numOfMelFilters)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
||||
class MFCCConfig:
|
||||
def __init__(self,freq_min,freq_high,numOfMelFilters,numOfDctOutputs,FFTSize,sample_rate):
|
||||
self._freq_min=freq_min
|
||||
self._freq_high=freq_high
|
||||
self._numOfMelFilters = numOfMelFilters
|
||||
self._FFTSize=FFTSize
|
||||
self._sample_rate=sample_rate
|
||||
#self._window = sig.hann(FFTSize, sym=True)
|
||||
self._window = sig.hamming(FFTSize, sym=False)
|
||||
#print(self._window)
|
||||
self._numOfDctOutputs=numOfDctOutputs
|
||||
|
||||
self._filters = melFilterMatrix(freq_min, freq_high, numOfMelFilters,sample_rate,FFTSize)
|
||||
|
||||
|
||||
self._dctMatrixFilters = dctMatrix(numOfDctOutputs, numOfMelFilters)
|
||||
|
||||
def mfcc(self,audio):
|
||||
m = np.amax(np.abs(audio))
|
||||
if m != 0:
|
||||
s = 1.0 / m
|
||||
else:
|
||||
s = 1.0
|
||||
audio = audio * s
|
||||
|
||||
audioWin = audio * self._window
|
||||
|
||||
if DEBUG:
|
||||
print(audioWin)
|
||||
|
||||
audioFFT = scipy.fftpack.fft(audioWin)
|
||||
if DEBUG:
|
||||
print(audioFFT)
|
||||
|
||||
audioPower = np.abs(audioFFT)
|
||||
if DEBUG:
|
||||
print(audioPower)
|
||||
|
||||
filterLimit = int(1 + self._FFTSize // 2)
|
||||
audioPower=audioPower[:filterLimit]
|
||||
|
||||
audioFiltered = np.dot(self._filters,audioPower)
|
||||
if DEBUG:
|
||||
print(audioFiltered)
|
||||
|
||||
audioLog = np.log(audioFiltered + 1e-6)
|
||||
|
||||
cepstral_coefficents = np.dot(self._dctMatrixFilters, audioLog)
|
||||
|
||||
return(cepstral_coefficents)
|
||||
|
||||
|
||||
debug=np.array([ 0.65507051 ,-0.94647589 ,0.00627239 ,0.14151286 ,-0.10863318 ,-0.36370327
|
||||
,0.05777126 ,-0.11915792 ,0.50183546 ,-0.31461335 ,0.66440771 ,0.05389963
|
||||
,0.39690544 ,0.25424852 ,-0.17045277 ,0.09649268 ,0.87357385 ,-0.44666372
|
||||
,-0.02637822 ,-0.10055151 ,-0.14610252 ,-0.05981251 ,-0.02999124 ,0.60923213
|
||||
,0.10530095 ,0.35684248 ,0.21845946 ,0.47845017 ,-0.60206979 ,0.25186908
|
||||
,-0.27410056 ,-0.07080467 ,-0.05109539 ,-0.2666572 ,0.25483105 ,-0.86459185
|
||||
,0.07733397 ,-0.58535444 ,0.06230904 ,-0.04161475 ,-0.17467296 ,0.77721125
|
||||
,-0.01728161 ,-0.32141218 ,0.36674466 ,-0.17932843 ,0.78486115 ,0.12469579
|
||||
,-0.94796877 ,0.05536031 ,0.32627676 ,0.46628512 ,-0.02585836 ,-0.51439834
|
||||
,0.21387904 ,0.16319442 ,-0.01020818 ,-0.77161183 ,0.07754634 ,-0.24970455
|
||||
,0.2368003 ,0.35167963 ,0.14620137 ,-0.02415204 ,0.91086167 ,-0.02434647
|
||||
,-0.3968239 ,-0.04703925 ,-0.43905103 ,-0.34834965 ,0.33728158 ,0.15138992
|
||||
,-0.43218885 ,0.26619718 ,0.07177906 ,0.33393581 ,-0.50306915 ,-0.63101084
|
||||
,-0.08128395 ,-0.06569788 ,0.84232797 ,-0.32436751 ,0.02528537 ,-0.3498329
|
||||
,0.41859931 ,0.07794887 ,0.4571989 ,0.24290963 ,0.08437417 ,-0.01371585
|
||||
,-0.00103008 ,0.83978697 ,-0.29001237 ,0.14438743 ,0.11943318 ,-0.25576402
|
||||
,0.25151083 ,0.07886626 ,0.11565781 ,-0.01582203 ,0.1310246 ,-0.5553611
|
||||
,-0.37950665 ,0.44179691 ,0.08460877 ,0.30646419 ,0.48927934 ,-0.21240309
|
||||
,0.36844264 ,0.49686615 ,-0.81617664 ,0.52221472 ,-0.05188992 ,-0.03929655
|
||||
,-0.47674501 ,-0.54506781 ,0.30711148 ,0.10049337 ,-0.47549213 ,0.59106713
|
||||
,-0.62276051 ,-0.35182917 ,0.14612027 ,0.56142168 ,-0.01053732 ,0.35782179
|
||||
,-0.27220781 ,-0.03672346 ,-0.11282222 ,0.3364912 ,-0.22352515 ,-0.04245287
|
||||
,0.56968605 ,-0.14023724 ,-0.82982905 ,0.00860008 ,0.37920345 ,-0.53749318
|
||||
,-0.12761215 ,0.08567603 ,0.47020765 ,-0.28794812 ,-0.33888971 ,0.01850441
|
||||
,0.66848233 ,-0.26532759 ,-0.20777571 ,-0.68342729 ,-0.41498696 ,0.00593224
|
||||
,0.02229368 ,0.75596329 ,0.29447568 ,-0.1106449 ,0.24181939 ,0.05807497
|
||||
,-0.14343857 ,0.304988 ,0.00689148 ,-0.06264758 ,0.25864714 ,-0.22252155
|
||||
,0.28621689 ,0.17031599 ,-0.34694027 ,-0.01625718 ,0.39834181 ,0.01259659
|
||||
,-0.28022716 ,-0.02506168 ,-0.10276881 ,0.31733924 ,0.02787068 ,-0.09824124
|
||||
,0.45147797 ,0.14451518 ,0.17996395 ,-0.70594978 ,-0.92943177 ,0.13649282
|
||||
,-0.5938426 ,0.50289928 ,0.19635269 ,0.16811504 ,0.05803999 ,0.0037204
|
||||
,0.13847419 ,0.30568038 ,0.3700732 ,0.21257548 ,-0.31151753 ,-0.28836886
|
||||
,0.68743932 ,-0.11084429 ,-0.4673766 ,0.16637754 ,-0.38992572 ,0.16505578
|
||||
,-0.07499844 ,0.04226538 ,-0.11042177 ,0.0704542 ,-0.632819 ,-0.54898472
|
||||
,0.26498649 ,-0.59380386 ,0.93387213 ,0.06526726 ,-0.23223558 ,0.07941394
|
||||
,0.14325166 ,0.26914661 ,0.00925575 ,-0.34282161 ,-0.51418231 ,-0.12011075
|
||||
,-0.26676314 ,-0.09999028 ,0.03027513 ,0.22846503 ,-0.08930338 ,-0.1867156
|
||||
,0.66297846 ,0.32220769 ,-0.06015469 ,0.04034043 ,0.09595597 ,-1.
|
||||
,-0.42933352 ,0.25069376 ,-0.26030918 ,-0.28511861 ,-0.19931228 ,0.24408572
|
||||
,-0.3231952 ,0.45688981 ,-0.07354078 ,0.25669449 ,-0.44202722 ,0.11928406
|
||||
,-0.32826109 ,0.52660984 ,0.03067858 ,0.11095242 ,0.19933679 ,0.03042371
|
||||
,-0.34768682 ,0.09108447 ,0.61234556 ,0.1854931 ,0.19680502 ,0.27617564
|
||||
,0.33381827 ,-0.47358967 ,0.28714328 ,-0.27495982])
|
||||
|
||||
def writeTests(config,format):
|
||||
NBSAMPLES=[256,512,1024]
|
||||
if DEBUG:
|
||||
NBSAMPLES=[256]
|
||||
|
||||
|
||||
sample_rate = 16000
|
||||
FFTSize = 256
|
||||
numOfDctOutputs = 13
|
||||
|
||||
freq_min = 64
|
||||
freq_high = sample_rate / 2
|
||||
numOfMelFilters = 20
|
||||
|
||||
for nb in NBSAMPLES:
|
||||
inputs=[]
|
||||
outputs=[]
|
||||
inlengths=[]
|
||||
outlengths=[]
|
||||
|
||||
audio=np.random.randn(nb)
|
||||
audio = Tools.normalize(audio)
|
||||
if DEBUG:
|
||||
audio=debug
|
||||
inputs += list(audio)
|
||||
FFTSize=nb
|
||||
mfccConfig=MFCCConfig(freq_min,freq_high,numOfMelFilters,numOfDctOutputs,FFTSize,sample_rate)
|
||||
ref=mfccConfig.mfcc(audio)
|
||||
#print(audio)
|
||||
if DEBUG:
|
||||
print(ref)
|
||||
outputs+=list(ref)
|
||||
inlengths+=[nb]
|
||||
outlengths+=[numOfDctOutputs]
|
||||
|
||||
config.writeInput(1, inputs,"MFCCInput_%d_" % nb)
|
||||
config.writeReference(1, outputs,"MFCCRef_%d_" % nb)
|
||||
|
||||
|
||||
|
||||
def generatePatterns():
|
||||
PATTERNDIR = os.path.join("Patterns","DSP","Transform","MFCC")
|
||||
PARAMDIR = os.path.join("Parameters","DSP","Transform","MFCC")
|
||||
|
||||
configf32=Tools.Config(PATTERNDIR,PARAMDIR,"f32")
|
||||
#configf16=Tools.Config(PATTERNDIR,PARAMDIR,"f16")
|
||||
#configq31=Tools.Config(PATTERNDIR,PARAMDIR,"q31")
|
||||
#configq15=Tools.Config(PATTERNDIR,PARAMDIR,"q15")
|
||||
#configq7=Tools.Config(PATTERNDIR,PARAMDIR,"q7")
|
||||
|
||||
configf32.setOverwrite(False)
|
||||
|
||||
|
||||
|
||||
writeTests(configf32,0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
generatePatterns()
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,514 @@
|
||||
W
|
||||
256
|
||||
// 0.089738
|
||||
0x3db7c865
|
||||
// 0.067259
|
||||
0x3d89bf0e
|
||||
// 0.154389
|
||||
0x3e1e1836
|
||||
// -0.083019
|
||||
0xbdaa05a4
|
||||
// -0.087256
|
||||
0xbdb2b334
|
||||
// -0.621283
|
||||
0xbf1f0c6a
|
||||
// 0.331273
|
||||
0x3ea99cac
|
||||
// 0.783341
|
||||
0x3f488910
|
||||
// 0.092650
|
||||
0x3dbdbf72
|
||||
// 0.075105
|
||||
0x3d99d0d7
|
||||
// -0.096163
|
||||
0xbdc4f113
|
||||
// -0.108939
|
||||
0xbddf1b32
|
||||
// -0.232866
|
||||
0xbe6e7455
|
||||
// 0.328005
|
||||
0x3ea7f043
|
||||
// 0.310901
|
||||
0x3e9f2e62
|
||||
// -0.039975
|
||||
0xbd23bc4d
|
||||
// -0.296302
|
||||
0xbe97b4e9
|
||||
// 0.357151
|
||||
0x3eb6dc87
|
||||
// 0.421522
|
||||
0x3ed7d1b6
|
||||
// -0.570618
|
||||
0xbf121408
|
||||
// 0.385768
|
||||
0x3ec5836a
|
||||
// 0.262206
|
||||
0x3e863fcf
|
||||
// 0.100940
|
||||
0x3dceb991
|
||||
// 0.251663
|
||||
0x3e80d9f9
|
||||
// -0.069520
|
||||
0xbd8e60af
|
||||
// -0.174688
|
||||
0xbe32e153
|
||||
// 0.079187
|
||||
0x3da22cc5
|
||||
// -0.430499
|
||||
0xbedc6a68
|
||||
// 0.242275
|
||||
0x3e7816f2
|
||||
// 0.758464
|
||||
0x3f422ab1
|
||||
// 0.121298
|
||||
0x3df86b1d
|
||||
// -0.283242
|
||||
0xbe91050b
|
||||
// -0.664019
|
||||
0xbf29fd2d
|
||||
// 0.260954
|
||||
0x3e859bc8
|
||||
// -0.110971
|
||||
0xbde344d5
|
||||
// -0.359717
|
||||
0xbeb82cd8
|
||||
// 0.362777
|
||||
0x3eb9bdd8
|
||||
// 0.240596
|
||||
0x3e765ebe
|
||||
// -0.168707
|
||||
0xbe2cc17b
|
||||
// 0.096354
|
||||
0x3dc55542
|
||||
// 0.360356
|
||||
0x3eb880a2
|
||||
// 0.273952
|
||||
0x3e8c4375
|
||||
// -0.813507
|
||||
0xbf5041f7
|
||||
// 0.202244
|
||||
0x3e4f1927
|
||||
// 0.654824
|
||||
0x3f27a285
|
||||
// -0.027679
|
||||
0xbce2c006
|
||||
// 0.570388
|
||||
0x3f1204ee
|
||||
// -0.281811
|
||||
0xbe904995
|
||||
// 0.439898
|
||||
0x3ee13a47
|
||||
// 0.034354
|
||||
0x3d0cb734
|
||||
// -0.404687
|
||||
0xbecf3331
|
||||
// 0.018210
|
||||
0x3c952d78
|
||||
// 0.173341
|
||||
0x3e318064
|
||||
// 0.096519
|
||||
0x3dc5ac00
|
||||
// 0.025961
|
||||
0x3cd4ac02
|
||||
// 0.086384
|
||||
0x3db0ea03
|
||||
// 0.467037
|
||||
0x3eef1f82
|
||||
// -0.061900
|
||||
0xbd7d8b10
|
||||
// -0.091634
|
||||
0xbdbbaa5e
|
||||
// -0.054937
|
||||
0xbd6105ec
|
||||
// 0.402989
|
||||
0x3ece548b
|
||||
// 0.104294
|
||||
0x3dd59832
|
||||
// -0.010941
|
||||
0xbc3342e7
|
||||
// -0.277462
|
||||
0xbe8e0f89
|
||||
// 0.317816
|
||||
0x3ea2b8b9
|
||||
// -0.091144
|
||||
0xbdbaa9c0
|
||||
// 0.409791
|
||||
0x3ed1d02a
|
||||
// -0.042292
|
||||
0xbd2d3acc
|
||||
// 0.075197
|
||||
0x3d9a00f3
|
||||
// -0.101919
|
||||
0xbdd0babb
|
||||
// 0.305818
|
||||
0x3e9c941f
|
||||
// 0.305115
|
||||
0x3e9c3801
|
||||
// 0.225793
|
||||
0x3e673627
|
||||
// -0.819021
|
||||
0xbf51ab5e
|
||||
// 0.099640
|
||||
0x3dcc1035
|
||||
// -0.359991
|
||||
0xbeb850b6
|
||||
// -0.123400
|
||||
0xbdfcb8eb
|
||||
// -0.027310
|
||||
0xbcdfb89a
|
||||
// -0.223871
|
||||
0xbe653e7c
|
||||
// 0.455622
|
||||
0x3ee94741
|
||||
// 0.246788
|
||||
0x3e7cb611
|
||||
// -0.068658
|
||||
0xbd8c9c7e
|
||||
// 0.010263
|
||||
0x3c28274d
|
||||
// 1.000000
|
||||
0x3f800000
|
||||
// 0.480968
|
||||
0x3ef6417f
|
||||
// -0.015245
|
||||
0xbc79c733
|
||||
// 0.013451
|
||||
0x3c5c5fc5
|
||||
// -0.413680
|
||||
0xbed3cdd6
|
||||
// -0.451646
|
||||
0xbee73e30
|
||||
// -0.311718
|
||||
0xbe9f9984
|
||||
// -0.325950
|
||||
0xbea6e2e5
|
||||
// -0.385646
|
||||
0xbec57374
|
||||
// -0.045221
|
||||
0xbd39399c
|
||||
// 0.110227
|
||||
0x3de1be72
|
||||
// -0.035305
|
||||
0xbd109c7c
|
||||
// 0.004051
|
||||
0x3b84bc8c
|
||||
// -0.331952
|
||||
0xbea9f5ad
|
||||
// 0.164119
|
||||
0x3e280ec3
|
||||
// 0.146625
|
||||
0x3e1624f8
|
||||
// 0.036189
|
||||
0x3d143aa4
|
||||
// -0.099008
|
||||
0xbdcac4c8
|
||||
// -0.563731
|
||||
0xbf1050aa
|
||||
// 0.964170
|
||||
0x3f76d3d2
|
||||
// 0.428630
|
||||
0x3edb7570
|
||||
// -0.265563
|
||||
0xbe87f7e5
|
||||
// 0.443260
|
||||
0x3ee2f308
|
||||
// -0.627063
|
||||
0xbf20872f
|
||||
// -0.592591
|
||||
0xbf17b410
|
||||
// 0.094141
|
||||
0x3dc0cd02
|
||||
// -0.093867
|
||||
0xbdc03d38
|
||||
// -0.522123
|
||||
0xbf05a9dd
|
||||
// -0.035453
|
||||
0xbd1136f8
|
||||
// -0.031508
|
||||
0xbd010e53
|
||||
// 0.072731
|
||||
0x3d94f436
|
||||
// -0.112147
|
||||
0xbde5ad66
|
||||
// -0.440226
|
||||
0xbee1655a
|
||||
// -0.106819
|
||||
0xbddac410
|
||||
// -0.362694
|
||||
0xbeb9b308
|
||||
// 0.018079
|
||||
0x3c941a6a
|
||||
// -0.170406
|
||||
0xbe2e7ef9
|
||||
// 0.622399
|
||||
0x3f1f5591
|
||||
// 0.119503
|
||||
0x3df4bddc
|
||||
// 0.008095
|
||||
0x3c04a25b
|
||||
// -0.032518
|
||||
0xbd053165
|
||||
// 0.021576
|
||||
0x3cb0bf6b
|
||||
// -0.317126
|
||||
0xbea25e57
|
||||
// -0.387595
|
||||
0xbec672cc
|
||||
// 0.098323
|
||||
0x3dc95d5d
|
||||
// -0.333914
|
||||
0xbeaaf6c5
|
||||
// -0.104521
|
||||
0xbdd60f35
|
||||
// -0.087055
|
||||
0xbdb24a01
|
||||
// -0.254765
|
||||
0xbe82708f
|
||||
// -0.445842
|
||||
0xbee44567
|
||||
// -0.429256
|
||||
0xbedbc765
|
||||
// 0.540044
|
||||
0x3f0a405a
|
||||
// 0.177131
|
||||
0x3e3561f1
|
||||
// 0.268467
|
||||
0x3e897490
|
||||
// 0.429066
|
||||
0x3edbae7e
|
||||
// -0.197797
|
||||
0xbe4a8b41
|
||||
// -0.241472
|
||||
0xbe774469
|
||||
// 0.323202
|
||||
0x3ea57aac
|
||||
// -0.235000
|
||||
0xbe70a3ba
|
||||
// 0.609865
|
||||
0x3f1c2018
|
||||
// 0.602386
|
||||
0x3f1a35fa
|
||||
// 0.019534
|
||||
0x3ca00609
|
||||
// -0.196338
|
||||
0xbe490cc9
|
||||
// 0.096247
|
||||
0x3dc51cec
|
||||
// 0.155905
|
||||
0x3e1fa572
|
||||
// -0.530173
|
||||
0xbf07b96e
|
||||
// -0.625972
|
||||
0xbf203fb4
|
||||
// -0.132952
|
||||
0xbe082484
|
||||
// 0.500561
|
||||
0x3f0024c8
|
||||
// -0.191938
|
||||
0xbe448b75
|
||||
// -0.396835
|
||||
0xbecb2de5
|
||||
// 0.599835
|
||||
0x3f198ed0
|
||||
// -0.117457
|
||||
0xbdf08d21
|
||||
// 0.582546
|
||||
0x3f1521bc
|
||||
// 0.226422
|
||||
0x3e67db35
|
||||
// -0.223980
|
||||
0xbe655b05
|
||||
// -0.103188
|
||||
0xbdd35454
|
||||
// -0.040533
|
||||
0xbd26061f
|
||||
// 0.086565
|
||||
0x3db14927
|
||||
// 0.151441
|
||||
0x3e1b1359
|
||||
// 0.173882
|
||||
0x3e320e25
|
||||
// -0.148597
|
||||
0xbe1829de
|
||||
// -0.408066
|
||||
0xbed0edf9
|
||||
// 0.257180
|
||||
0x3e83ad09
|
||||
// 0.046722
|
||||
0x3d3f5fb7
|
||||
// -0.279765
|
||||
0xbe8f3d56
|
||||
// -0.513039
|
||||
0xbf035683
|
||||
// 0.232855
|
||||
0x3e6e7184
|
||||
// 0.724141
|
||||
0x3f396155
|
||||
// 0.156407
|
||||
0x3e202949
|
||||
// 0.477019
|
||||
0x3ef43bd1
|
||||
// 0.782124
|
||||
0x3f483950
|
||||
// 0.141778
|
||||
0x3e112e5d
|
||||
// -0.465177
|
||||
0xbeee2bb4
|
||||
// -0.168128
|
||||
0xbe2c29c1
|
||||
// 0.528298
|
||||
0x3f073e8e
|
||||
// -0.411862
|
||||
0xbed2dfa2
|
||||
// 0.319303
|
||||
0x3ea37b9f
|
||||
// 0.297564
|
||||
0x3e985a55
|
||||
// -0.263947
|
||||
0xbe8723ff
|
||||
// -0.185831
|
||||
0xbe3e4a75
|
||||
// 0.372901
|
||||
0x3ebeece2
|
||||
// 0.325011
|
||||
0x3ea667cd
|
||||
// -0.211544
|
||||
0xbe589f02
|
||||
// -0.054309
|
||||
0xbd5e72fb
|
||||
// -0.003084
|
||||
0xbb4a15b9
|
||||
// -0.024571
|
||||
0xbcc94a0c
|
||||
// 0.016627
|
||||
0x3c883561
|
||||
// -0.081301
|
||||
0xbda680f8
|
||||
// 0.472227
|
||||
0x3ef1c7c9
|
||||
// 0.586417
|
||||
0x3f161f74
|
||||
// -0.214688
|
||||
0xbe5bd74c
|
||||
// 0.133952
|
||||
0x3e092aaf
|
||||
// -0.465443
|
||||
0xbeee4e96
|
||||
// -0.173991
|
||||
0xbe322a9f
|
||||
// 0.043391
|
||||
0x3d31baf2
|
||||
// 0.199079
|
||||
0x3e4bdb3f
|
||||
// -0.720737
|
||||
0xbf38823b
|
||||
// 0.692669
|
||||
0x3f3152c0
|
||||
// -0.146139
|
||||
0xbe15a580
|
||||
// -0.089478
|
||||
0xbdb74076
|
||||
// 0.441291
|
||||
0x3ee1f0d5
|
||||
// 0.078354
|
||||
0x3da077e1
|
||||
// 0.375427
|
||||
0x3ec037ea
|
||||
// -0.033212
|
||||
0xbd080925
|
||||
// -0.107130
|
||||
0xbddb66c5
|
||||
// 0.048466
|
||||
0x3d468475
|
||||
// 0.118295
|
||||
0x3df244da
|
||||
// -0.062158
|
||||
0xbd7e9954
|
||||
// 0.044569
|
||||
0x3d368e61
|
||||
// -0.197895
|
||||
0xbe4aa514
|
||||
// 0.288538
|
||||
0x3e93bb48
|
||||
// -0.607111
|
||||
0xbf1b6b9d
|
||||
// 0.271215
|
||||
0x3e8adcaa
|
||||
// -0.528523
|
||||
0xbf074d44
|
||||
// -0.407540
|
||||
0xbed0a910
|
||||
// -0.010570
|
||||
0xbc2d2d1e
|
||||
// -0.475852
|
||||
0xbef3a2e2
|
||||
// 0.117884
|
||||
0x3df16cfc
|
||||
// -0.325560
|
||||
0xbea6afcc
|
||||
// -0.341994
|
||||
0xbeaf19df
|
||||
// -0.603439
|
||||
0xbf1a7af4
|
||||
// 0.252634
|
||||
0x3e815945
|
||||
// -0.161713
|
||||
0xbe259804
|
||||
// -0.173283
|
||||
0xbe317100
|
||||
// 0.259118
|
||||
0x3e84ab15
|
||||
// -0.349186
|
||||
0xbeb2c87c
|
||||
// 0.444531
|
||||
0x3ee399a1
|
||||
// 0.130996
|
||||
0x3e0623b0
|
||||
// -0.449434
|
||||
0xbee61c40
|
||||
// -0.437433
|
||||
0xbedff738
|
||||
// 0.379204
|
||||
0x3ec22702
|
||||
// 0.301281
|
||||
0x3e9a4181
|
||||
// 0.170051
|
||||
0x3e2e21d1
|
||||
// -0.235498
|
||||
0xbe71265b
|
||||
// -0.022892
|
||||
0xbcbb878b
|
||||
// 0.463847
|
||||
0x3eed7d4e
|
||||
// 0.308328
|
||||
0x3e9ddd20
|
||||
// 0.375992
|
||||
0x3ec08210
|
||||
// -0.305638
|
||||
0xbe9c7c97
|
||||
// -0.199858
|
||||
0xbe4ca776
|
||||
// 0.041511
|
||||
0x3d2a0759
|
||||
// -0.212038
|
||||
0xbe59208c
|
||||
// 0.002997
|
||||
0x3b446c1c
|
||||
// -0.454472
|
||||
0xbee8b097
|
||||
// -0.187657
|
||||
0xbe402913
|
||||
// 0.204091
|
||||
0x3e50fd37
|
||||
// 0.332860
|
||||
0x3eaa6ca7
|
||||
// -0.086138
|
||||
0xbdb06936
|
||||
// 0.000109
|
||||
0x38e3bf6c
|
||||
// -0.202735
|
||||
0xbe4f99db
|
||||
// 0.089400
|
||||
0x3db71796
|
||||
// 0.005566
|
||||
0x3bb66229
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
W
|
||||
13
|
||||
// 29.476383
|
||||
0x41ebcfa2
|
||||
// -2.793829
|
||||
0xc032ce18
|
||||
// -0.138950
|
||||
0xbe0e48f1
|
||||
// -0.255028
|
||||
0xbe8292fe
|
||||
// -0.086083
|
||||
0xbdb04c7c
|
||||
// 0.079019
|
||||
0x3da1d4bc
|
||||
// 0.053065
|
||||
0x3d595af3
|
||||
// -0.194468
|
||||
0xbe4722bc
|
||||
// -0.113326
|
||||
0xbde81743
|
||||
// 0.161914
|
||||
0x3e25ccba
|
||||
// -0.074321
|
||||
0xbd983584
|
||||
// -0.266463
|
||||
0xbe886dd2
|
||||
// 0.096700
|
||||
0x3dc60ad7
|
||||
@ -0,0 +1,28 @@
|
||||
W
|
||||
13
|
||||
// 16.614560
|
||||
0x4184ea9e
|
||||
// -3.430914
|
||||
0xc05b9419
|
||||
// -0.449975
|
||||
0xbee6631a
|
||||
// -0.719270
|
||||
0xbf382216
|
||||
// -0.009456
|
||||
0xbc1aee40
|
||||
// 0.375393
|
||||
0x3ec03390
|
||||
// 0.091797
|
||||
0x3dbc0008
|
||||
// 0.571371
|
||||
0x3f124566
|
||||
// 0.544033
|
||||
0x3f0b45b8
|
||||
// 0.122636
|
||||
0x3dfb2858
|
||||
// -0.240764
|
||||
0xbe768ac1
|
||||
// -0.119661
|
||||
0xbdf510f6
|
||||
// 0.306596
|
||||
0x3e9cfa2f
|
||||
@ -0,0 +1,28 @@
|
||||
W
|
||||
13
|
||||
// 23.285167
|
||||
0x41ba4806
|
||||
// -3.167810
|
||||
0xc04abd66
|
||||
// -0.068430
|
||||
0xbd8c24da
|
||||
// -0.381059
|
||||
0xbec31a39
|
||||
// -0.164060
|
||||
0xbe27ff4d
|
||||
// -0.571221
|
||||
0xbf123b87
|
||||
// -0.156919
|
||||
0xbe20af4f
|
||||
// 0.145660
|
||||
0x3e1527e4
|
||||
// 0.060968
|
||||
0x3d79b9dc
|
||||
// 0.157476
|
||||
0x3e21414e
|
||||
// 0.226390
|
||||
0x3e67d2b2
|
||||
// 0.023298
|
||||
0x3cbedb77
|
||||
// 0.141592
|
||||
0x3e10fd8c
|
||||
@ -0,0 +1,109 @@
|
||||
#include "MFCCF32.h"
|
||||
#include <stdio.h>
|
||||
#include "Error.h"
|
||||
|
||||
#include "mfccdata.h"
|
||||
|
||||
#define SNR_THRESHOLD 120
|
||||
|
||||
/*
|
||||
|
||||
Reference patterns are generated with
|
||||
a double precision computation.
|
||||
|
||||
*/
|
||||
#define REL_ERROR (9.2e-5)
|
||||
|
||||
|
||||
|
||||
void MFCCF32::test_mfcc_f32()
|
||||
{
|
||||
const float32_t *inp1=input1.ptr();
|
||||
float32_t *tmpinp=tmpin.ptr();
|
||||
float32_t *outp=output.ptr();
|
||||
float32_t *tmpp=tmp.ptr();
|
||||
|
||||
|
||||
memcpy((void*)tmpinp,(void*)inp1,sizeof(float32_t)*this->fftLen);
|
||||
arm_mfcc_f32(&mfcc,tmpinp,outp,tmpp);
|
||||
|
||||
ASSERT_EMPTY_TAIL(output);
|
||||
|
||||
ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD);
|
||||
|
||||
ASSERT_REL_ERROR(output,ref,REL_ERROR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MFCCF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
|
||||
{
|
||||
|
||||
(void)params;
|
||||
|
||||
Testing::nbSamples_t nb=MAX_NB_SAMPLES;
|
||||
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case MFCCF32::TEST_MFCC_F32_1:
|
||||
{
|
||||
nb = 256;
|
||||
this->fftLen = nb;
|
||||
ref.reload(MFCCF32::REF_MFCC_256_F32_ID,mgr,nb);
|
||||
input1.reload(MFCCF32::INPUTS_MFCC_256_F32_ID,mgr,nb);
|
||||
arm_mfcc_init_f32(&mfcc,
|
||||
nb,20,13,mfcc_dct_coefs_config1,
|
||||
mfcc_filter_pos_config3,mfcc_filter_len_config3,
|
||||
mfcc_filter_coefs_config3,
|
||||
mfcc_window_coefs_config3);
|
||||
tmp.create(2*nb,MFCCF32::TMP_MFCC_F32_ID,mgr);
|
||||
tmpin.create(nb,MFCCF32::TMPIN_MFCC_F32_ID,mgr);
|
||||
}
|
||||
break;
|
||||
|
||||
case MFCCF32::TEST_MFCC_F32_2:
|
||||
{
|
||||
nb = 512;
|
||||
this->fftLen = nb;
|
||||
ref.reload(MFCCF32::REF_MFCC_512_F32_ID,mgr,nb);
|
||||
input1.reload(MFCCF32::INPUTS_MFCC_512_F32_ID,mgr,nb);
|
||||
arm_mfcc_init_f32(&mfcc,
|
||||
nb,20,13,mfcc_dct_coefs_config1,
|
||||
mfcc_filter_pos_config2,mfcc_filter_len_config2,
|
||||
mfcc_filter_coefs_config2,
|
||||
mfcc_window_coefs_config2);
|
||||
tmp.create(2*nb,MFCCF32::TMP_MFCC_F32_ID,mgr);
|
||||
tmpin.create(nb,MFCCF32::TMPIN_MFCC_F32_ID,mgr);
|
||||
}
|
||||
break;
|
||||
case MFCCF32::TEST_MFCC_F32_3:
|
||||
{
|
||||
nb = 1024;
|
||||
this->fftLen = nb;
|
||||
ref.reload(MFCCF32::REF_MFCC_1024_F32_ID,mgr,nb);
|
||||
input1.reload(MFCCF32::INPUTS_MFCC_1024_F32_ID,mgr,nb);
|
||||
arm_mfcc_init_f32(&mfcc,
|
||||
nb,20,13,mfcc_dct_coefs_config1,
|
||||
mfcc_filter_pos_config1,mfcc_filter_len_config1,
|
||||
mfcc_filter_coefs_config1,
|
||||
mfcc_window_coefs_config1);
|
||||
tmp.create(2*nb,MFCCF32::TMP_MFCC_F32_ID,mgr);
|
||||
tmpin.create(nb,MFCCF32::TMPIN_MFCC_F32_ID,mgr);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
output.create(ref.nbSamples(),MFCCF32::OUTPUT_MFCC_F32_ID,mgr);
|
||||
|
||||
}
|
||||
|
||||
void MFCCF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
|
||||
{
|
||||
(void)id;
|
||||
(void)mgr;
|
||||
//output.dump(mgr);
|
||||
}
|
||||
@ -0,0 +1,423 @@
|
||||
#include "mfccdata.h"
|
||||
|
||||
const float32_t mfcc_dct_coefs_config1[NB_MFCC_DCT_COEFS_CONFIG1]={
|
||||
0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,
|
||||
0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,0.316228f,
|
||||
0.315253f,0.307490f,0.292156f,0.269628f,0.240461f,0.205374f,0.165229f,0.121015f,0.073822f,0.024811f,
|
||||
-0.024811f,-0.073822f,-0.121015f,-0.165229f,-0.205374f,-0.240461f,-0.269628f,-0.292156f,-0.307490f,-0.315253f,
|
||||
0.312334f,0.281761f,0.223607f,0.143564f,0.049469f,-0.049469f,-0.143564f,-0.223607f,-0.281761f,-0.312334f,
|
||||
-0.312334f,-0.281761f,-0.223607f,-0.143564f,-0.049469f,0.049469f,0.143564f,0.223607f,0.281761f,0.312334f,
|
||||
0.307490f,0.240461f,0.121015f,-0.024811f,-0.165229f,-0.269628f,-0.315253f,-0.292156f,-0.205374f,-0.073822f,
|
||||
0.073822f,0.205374f,0.292156f,0.315253f,0.269628f,0.165229f,0.024811f,-0.121015f,-0.240461f,-0.307490f,
|
||||
0.300750f,0.185874f,0.000000f,-0.185874f,-0.300750f,-0.300750f,-0.185874f,-0.000000f,0.185874f,0.300750f,
|
||||
0.300750f,0.185874f,0.000000f,-0.185874f,-0.300750f,-0.300750f,-0.185874f,-0.000000f,0.185874f,0.300750f,
|
||||
0.292156f,0.121015f,-0.121015f,-0.292156f,-0.292156f,-0.121015f,0.121015f,0.292156f,0.292156f,0.121015f,
|
||||
-0.121015f,-0.292156f,-0.292156f,-0.121015f,0.121015f,0.292156f,0.292156f,0.121015f,-0.121015f,-0.292156f,
|
||||
0.281761f,0.049469f,-0.223607f,-0.312334f,-0.143564f,0.143564f,0.312334f,0.223607f,-0.049469f,-0.281761f,
|
||||
-0.281761f,-0.049469f,0.223607f,0.312334f,0.143564f,-0.143564f,-0.312334f,-0.223607f,0.049469f,0.281761f,
|
||||
0.269628f,-0.024811f,-0.292156f,-0.240461f,0.073822f,0.307490f,0.205374f,-0.121015f,-0.315253f,-0.165229f,
|
||||
0.165229f,0.315253f,0.121015f,-0.205374f,-0.307490f,-0.073822f,0.240461f,0.292156f,0.024811f,-0.269628f,
|
||||
0.255834f,-0.097720f,-0.316228f,-0.097720f,0.255834f,0.255834f,-0.097720f,-0.316228f,-0.097720f,0.255834f,
|
||||
0.255834f,-0.097720f,-0.316228f,-0.097720f,0.255834f,0.255834f,-0.097720f,-0.316228f,-0.097720f,0.255834f,
|
||||
0.240461f,-0.165229f,-0.292156f,0.073822f,0.315253f,0.024811f,-0.307490f,-0.121015f,0.269628f,0.205374f,
|
||||
-0.205374f,-0.269628f,0.121015f,0.307490f,-0.024811f,-0.315253f,-0.073822f,0.292156f,0.165229f,-0.240461f,
|
||||
0.223607f,-0.223607f,-0.223607f,0.223607f,0.223607f,-0.223607f,-0.223607f,0.223607f,0.223607f,-0.223607f,
|
||||
-0.223607f,0.223607f,0.223607f,-0.223607f,-0.223607f,0.223607f,0.223607f,-0.223607f,-0.223607f,0.223607f,
|
||||
0.205374f,-0.269628f,-0.121015f,0.307490f,0.024811f,-0.315253f,0.073822f,0.292156f,-0.165229f,-0.240461f,
|
||||
0.240461f,0.165229f,-0.292156f,-0.073822f,0.315253f,-0.024811f,-0.307490f,0.121015f,0.269628f,-0.205374f,
|
||||
0.185874f,-0.300750f,-0.000000f,0.300750f,-0.185874f,-0.185874f,0.300750f,0.000000f,-0.300750f,0.185874f,
|
||||
0.185874f,-0.300750f,-0.000000f,0.300750f,-0.185874f,-0.185874f,0.300750f,-0.000000f,-0.300750f,0.185874f,
|
||||
};
|
||||
|
||||
|
||||
const float32_t mfcc_window_coefs_config1[NB_MFCC_WIN_COEFS_CONFIG1]={
|
||||
0.080000f,0.080009f,0.080035f,0.080078f,0.080139f,0.080216f,0.080312f,0.080424f,0.080554f,0.080701f,
|
||||
0.080866f,0.081047f,0.081246f,0.081463f,0.081696f,0.081947f,0.082215f,0.082500f,0.082803f,0.083123f,
|
||||
0.083459f,0.083814f,0.084185f,0.084573f,0.084979f,0.085402f,0.085841f,0.086298f,0.086772f,0.087263f,
|
||||
0.087771f,0.088297f,0.088839f,0.089398f,0.089974f,0.090567f,0.091177f,0.091804f,0.092448f,0.093108f,
|
||||
0.093786f,0.094480f,0.095191f,0.095919f,0.096663f,0.097424f,0.098202f,0.098996f,0.099807f,0.100635f,
|
||||
0.101479f,0.102340f,0.103217f,0.104111f,0.105021f,0.105947f,0.106890f,0.107849f,0.108824f,0.109816f,
|
||||
0.110823f,0.111847f,0.112887f,0.113943f,0.115015f,0.116104f,0.117208f,0.118328f,0.119464f,0.120615f,
|
||||
0.121783f,0.122966f,0.124165f,0.125380f,0.126610f,0.127856f,0.129117f,0.130394f,0.131686f,0.132993f,
|
||||
0.134316f,0.135654f,0.137008f,0.138376f,0.139760f,0.141159f,0.142572f,0.144001f,0.145445f,0.146903f,
|
||||
0.148377f,0.149865f,0.151367f,0.152885f,0.154417f,0.155963f,0.157524f,0.159099f,0.160689f,0.162293f,
|
||||
0.163911f,0.165543f,0.167190f,0.168850f,0.170525f,0.172213f,0.173915f,0.175631f,0.177361f,0.179104f,
|
||||
0.180861f,0.182631f,0.184415f,0.186212f,0.188023f,0.189847f,0.191684f,0.193534f,0.195397f,0.197273f,
|
||||
0.199162f,0.201064f,0.202979f,0.204906f,0.206846f,0.208799f,0.210764f,0.212741f,0.214731f,0.216733f,
|
||||
0.218747f,0.220773f,0.222811f,0.224862f,0.226924f,0.228997f,0.231083f,0.233180f,0.235289f,0.237409f,
|
||||
0.239540f,0.241683f,0.243837f,0.246003f,0.248179f,0.250366f,0.252565f,0.254774f,0.256993f,0.259224f,
|
||||
0.261465f,0.263716f,0.265978f,0.268251f,0.270533f,0.272826f,0.275128f,0.277441f,0.279763f,0.282096f,
|
||||
0.284438f,0.286789f,0.289151f,0.291521f,0.293901f,0.296290f,0.298689f,0.301096f,0.303513f,0.305938f,
|
||||
0.308372f,0.310815f,0.313267f,0.315727f,0.318195f,0.320672f,0.323157f,0.325651f,0.328152f,0.330662f,
|
||||
0.333179f,0.335704f,0.338237f,0.340777f,0.343325f,0.345880f,0.348442f,0.351012f,0.353589f,0.356173f,
|
||||
0.358764f,0.361361f,0.363966f,0.366577f,0.369194f,0.371818f,0.374448f,0.377085f,0.379727f,0.382376f,
|
||||
0.385031f,0.387691f,0.390357f,0.393029f,0.395706f,0.398389f,0.401077f,0.403771f,0.406469f,0.409173f,
|
||||
0.411881f,0.414594f,0.417312f,0.420035f,0.422762f,0.425493f,0.428229f,0.430969f,0.433713f,0.436461f,
|
||||
0.439213f,0.441969f,0.444729f,0.447492f,0.450258f,0.453028f,0.455802f,0.458578f,0.461358f,0.464140f,
|
||||
0.466925f,0.469713f,0.472504f,0.475297f,0.478093f,0.480891f,0.483691f,0.486493f,0.489298f,0.492104f,
|
||||
0.494912f,0.497722f,0.500533f,0.503346f,0.506160f,0.508976f,0.511792f,0.514610f,0.517429f,0.520248f,
|
||||
0.523069f,0.525890f,0.528711f,0.531533f,0.534355f,0.537178f,0.540000f,0.542822f,0.545645f,0.548467f,
|
||||
0.551289f,0.554110f,0.556931f,0.559752f,0.562571f,0.565390f,0.568208f,0.571024f,0.573840f,0.576654f,
|
||||
0.579467f,0.582278f,0.585088f,0.587896f,0.590702f,0.593507f,0.596309f,0.599109f,0.601907f,0.604703f,
|
||||
0.607496f,0.610287f,0.613075f,0.615860f,0.618642f,0.621422f,0.624198f,0.626972f,0.629742f,0.632508f,
|
||||
0.635271f,0.638031f,0.640787f,0.643539f,0.646287f,0.649031f,0.651771f,0.654507f,0.657238f,0.659965f,
|
||||
0.662688f,0.665406f,0.668119f,0.670827f,0.673531f,0.676229f,0.678923f,0.681611f,0.684294f,0.686971f,
|
||||
0.689643f,0.692309f,0.694969f,0.697624f,0.700273f,0.702915f,0.705552f,0.708182f,0.710806f,0.713423f,
|
||||
0.716034f,0.718639f,0.721236f,0.723827f,0.726411f,0.728988f,0.731558f,0.734120f,0.736675f,0.739223f,
|
||||
0.741763f,0.744296f,0.746821f,0.749338f,0.751848f,0.754349f,0.756842f,0.759328f,0.761805f,0.764273f,
|
||||
0.766733f,0.769185f,0.771628f,0.774062f,0.776487f,0.778904f,0.781311f,0.783710f,0.786099f,0.788479f,
|
||||
0.790850f,0.793211f,0.795562f,0.797904f,0.800237f,0.802559f,0.804872f,0.807174f,0.809467f,0.811749f,
|
||||
0.814022f,0.816284f,0.818535f,0.820776f,0.823007f,0.825226f,0.827435f,0.829634f,0.831821f,0.833997f,
|
||||
0.836163f,0.838317f,0.840460f,0.842591f,0.844711f,0.846820f,0.848917f,0.851003f,0.853076f,0.855138f,
|
||||
0.857189f,0.859227f,0.861253f,0.863267f,0.865269f,0.867259f,0.869236f,0.871201f,0.873154f,0.875094f,
|
||||
0.877021f,0.878936f,0.880838f,0.882727f,0.884603f,0.886466f,0.888316f,0.890153f,0.891977f,0.893788f,
|
||||
0.895585f,0.897369f,0.899139f,0.900896f,0.902639f,0.904369f,0.906085f,0.907787f,0.909475f,0.911150f,
|
||||
0.912810f,0.914457f,0.916089f,0.917707f,0.919311f,0.920901f,0.922476f,0.924037f,0.925583f,0.927115f,
|
||||
0.928633f,0.930135f,0.931623f,0.933097f,0.934555f,0.935999f,0.937428f,0.938841f,0.940240f,0.941624f,
|
||||
0.942992f,0.944346f,0.945684f,0.947007f,0.948314f,0.949606f,0.950883f,0.952145f,0.953390f,0.954620f,
|
||||
0.955835f,0.957034f,0.958217f,0.959385f,0.960536f,0.961672f,0.962792f,0.963896f,0.964985f,0.966057f,
|
||||
0.967113f,0.968153f,0.969177f,0.970184f,0.971176f,0.972151f,0.973110f,0.974053f,0.974979f,0.975889f,
|
||||
0.976783f,0.977660f,0.978521f,0.979365f,0.980193f,0.981004f,0.981798f,0.982576f,0.983337f,0.984081f,
|
||||
0.984809f,0.985520f,0.986214f,0.986892f,0.987552f,0.988196f,0.988823f,0.989433f,0.990026f,0.990602f,
|
||||
0.991161f,0.991703f,0.992229f,0.992737f,0.993228f,0.993702f,0.994159f,0.994599f,0.995021f,0.995427f,
|
||||
0.995815f,0.996186f,0.996541f,0.996877f,0.997197f,0.997500f,0.997785f,0.998053f,0.998304f,0.998537f,
|
||||
0.998754f,0.998953f,0.999134f,0.999299f,0.999446f,0.999576f,0.999688f,0.999784f,0.999861f,0.999922f,
|
||||
0.999965f,0.999991f,1.000000f,0.999991f,0.999965f,0.999922f,0.999861f,0.999784f,0.999688f,0.999576f,
|
||||
0.999446f,0.999299f,0.999134f,0.998953f,0.998754f,0.998537f,0.998304f,0.998053f,0.997785f,0.997500f,
|
||||
0.997197f,0.996877f,0.996541f,0.996186f,0.995815f,0.995427f,0.995021f,0.994599f,0.994159f,0.993702f,
|
||||
0.993228f,0.992737f,0.992229f,0.991703f,0.991161f,0.990602f,0.990026f,0.989433f,0.988823f,0.988196f,
|
||||
0.987552f,0.986892f,0.986214f,0.985520f,0.984809f,0.984081f,0.983337f,0.982576f,0.981798f,0.981004f,
|
||||
0.980193f,0.979365f,0.978521f,0.977660f,0.976783f,0.975889f,0.974979f,0.974053f,0.973110f,0.972151f,
|
||||
0.971176f,0.970184f,0.969177f,0.968153f,0.967113f,0.966057f,0.964985f,0.963896f,0.962792f,0.961672f,
|
||||
0.960536f,0.959385f,0.958217f,0.957034f,0.955835f,0.954620f,0.953390f,0.952145f,0.950883f,0.949606f,
|
||||
0.948314f,0.947007f,0.945684f,0.944346f,0.942992f,0.941624f,0.940240f,0.938841f,0.937428f,0.935999f,
|
||||
0.934555f,0.933097f,0.931623f,0.930135f,0.928633f,0.927115f,0.925583f,0.924037f,0.922476f,0.920901f,
|
||||
0.919311f,0.917707f,0.916089f,0.914457f,0.912810f,0.911150f,0.909475f,0.907787f,0.906085f,0.904369f,
|
||||
0.902639f,0.900896f,0.899139f,0.897369f,0.895585f,0.893788f,0.891977f,0.890153f,0.888316f,0.886466f,
|
||||
0.884603f,0.882727f,0.880838f,0.878936f,0.877021f,0.875094f,0.873154f,0.871201f,0.869236f,0.867259f,
|
||||
0.865269f,0.863267f,0.861253f,0.859227f,0.857189f,0.855138f,0.853076f,0.851003f,0.848917f,0.846820f,
|
||||
0.844711f,0.842591f,0.840460f,0.838317f,0.836163f,0.833997f,0.831821f,0.829634f,0.827435f,0.825226f,
|
||||
0.823007f,0.820776f,0.818535f,0.816284f,0.814022f,0.811749f,0.809467f,0.807174f,0.804872f,0.802559f,
|
||||
0.800237f,0.797904f,0.795562f,0.793211f,0.790850f,0.788479f,0.786099f,0.783710f,0.781311f,0.778904f,
|
||||
0.776487f,0.774062f,0.771628f,0.769185f,0.766733f,0.764273f,0.761805f,0.759328f,0.756842f,0.754349f,
|
||||
0.751848f,0.749338f,0.746821f,0.744296f,0.741763f,0.739223f,0.736675f,0.734120f,0.731558f,0.728988f,
|
||||
0.726411f,0.723827f,0.721236f,0.718639f,0.716034f,0.713423f,0.710806f,0.708182f,0.705552f,0.702915f,
|
||||
0.700273f,0.697624f,0.694969f,0.692309f,0.689643f,0.686971f,0.684294f,0.681611f,0.678923f,0.676229f,
|
||||
0.673531f,0.670827f,0.668119f,0.665406f,0.662688f,0.659965f,0.657238f,0.654507f,0.651771f,0.649031f,
|
||||
0.646287f,0.643539f,0.640787f,0.638031f,0.635271f,0.632508f,0.629742f,0.626972f,0.624198f,0.621422f,
|
||||
0.618642f,0.615860f,0.613075f,0.610287f,0.607496f,0.604703f,0.601907f,0.599109f,0.596309f,0.593507f,
|
||||
0.590702f,0.587896f,0.585088f,0.582278f,0.579467f,0.576654f,0.573840f,0.571024f,0.568208f,0.565390f,
|
||||
0.562571f,0.559752f,0.556931f,0.554110f,0.551289f,0.548467f,0.545645f,0.542822f,0.540000f,0.537178f,
|
||||
0.534355f,0.531533f,0.528711f,0.525890f,0.523069f,0.520248f,0.517429f,0.514610f,0.511792f,0.508976f,
|
||||
0.506160f,0.503346f,0.500533f,0.497722f,0.494912f,0.492104f,0.489298f,0.486493f,0.483691f,0.480891f,
|
||||
0.478093f,0.475297f,0.472504f,0.469713f,0.466925f,0.464140f,0.461358f,0.458578f,0.455802f,0.453028f,
|
||||
0.450258f,0.447492f,0.444729f,0.441969f,0.439213f,0.436461f,0.433713f,0.430969f,0.428229f,0.425493f,
|
||||
0.422762f,0.420035f,0.417312f,0.414594f,0.411881f,0.409173f,0.406469f,0.403771f,0.401077f,0.398389f,
|
||||
0.395706f,0.393029f,0.390357f,0.387691f,0.385031f,0.382376f,0.379727f,0.377085f,0.374448f,0.371818f,
|
||||
0.369194f,0.366577f,0.363966f,0.361361f,0.358764f,0.356173f,0.353589f,0.351012f,0.348442f,0.345880f,
|
||||
0.343325f,0.340777f,0.338237f,0.335704f,0.333179f,0.330662f,0.328152f,0.325651f,0.323157f,0.320672f,
|
||||
0.318195f,0.315727f,0.313267f,0.310815f,0.308372f,0.305938f,0.303513f,0.301096f,0.298689f,0.296290f,
|
||||
0.293901f,0.291521f,0.289151f,0.286789f,0.284438f,0.282096f,0.279763f,0.277441f,0.275128f,0.272826f,
|
||||
0.270533f,0.268251f,0.265978f,0.263716f,0.261465f,0.259224f,0.256993f,0.254774f,0.252565f,0.250366f,
|
||||
0.248179f,0.246003f,0.243837f,0.241683f,0.239540f,0.237409f,0.235289f,0.233180f,0.231083f,0.228997f,
|
||||
0.226924f,0.224862f,0.222811f,0.220773f,0.218747f,0.216733f,0.214731f,0.212741f,0.210764f,0.208799f,
|
||||
0.206846f,0.204906f,0.202979f,0.201064f,0.199162f,0.197273f,0.195397f,0.193534f,0.191684f,0.189847f,
|
||||
0.188023f,0.186212f,0.184415f,0.182631f,0.180861f,0.179104f,0.177361f,0.175631f,0.173915f,0.172213f,
|
||||
0.170525f,0.168850f,0.167190f,0.165543f,0.163911f,0.162293f,0.160689f,0.159099f,0.157524f,0.155963f,
|
||||
0.154417f,0.152885f,0.151367f,0.149865f,0.148377f,0.146903f,0.145445f,0.144001f,0.142572f,0.141159f,
|
||||
0.139760f,0.138376f,0.137008f,0.135654f,0.134316f,0.132993f,0.131686f,0.130394f,0.129117f,0.127856f,
|
||||
0.126610f,0.125380f,0.124165f,0.122966f,0.121783f,0.120615f,0.119464f,0.118328f,0.117208f,0.116104f,
|
||||
0.115015f,0.113943f,0.112887f,0.111847f,0.110823f,0.109816f,0.108824f,0.107849f,0.106890f,0.105947f,
|
||||
0.105021f,0.104111f,0.103217f,0.102340f,0.101479f,0.100635f,0.099807f,0.098996f,0.098202f,0.097424f,
|
||||
0.096663f,0.095919f,0.095191f,0.094480f,0.093786f,0.093108f,0.092448f,0.091804f,0.091177f,0.090567f,
|
||||
0.089974f,0.089398f,0.088839f,0.088297f,0.087771f,0.087263f,0.086772f,0.086298f,0.085841f,0.085402f,
|
||||
0.084979f,0.084573f,0.084185f,0.083814f,0.083459f,0.083123f,0.082803f,0.082500f,0.082215f,0.081947f,
|
||||
0.081696f,0.081463f,0.081246f,0.081047f,0.080866f,0.080701f,0.080554f,0.080424f,0.080312f,0.080216f,
|
||||
0.080139f,0.080078f,0.080035f,0.080009f,};
|
||||
|
||||
const float32_t mfcc_window_coefs_config2[NB_MFCC_WIN_COEFS_CONFIG2]={
|
||||
0.080000f,0.080035f,0.080139f,0.080312f,0.080554f,0.080866f,0.081246f,0.081696f,0.082215f,0.082803f,
|
||||
0.083459f,0.084185f,0.084979f,0.085841f,0.086772f,0.087771f,0.088839f,0.089974f,0.091177f,0.092448f,
|
||||
0.093786f,0.095191f,0.096663f,0.098202f,0.099807f,0.101479f,0.103217f,0.105021f,0.106890f,0.108824f,
|
||||
0.110823f,0.112887f,0.115015f,0.117208f,0.119464f,0.121783f,0.124165f,0.126610f,0.129117f,0.131686f,
|
||||
0.134316f,0.137008f,0.139760f,0.142572f,0.145445f,0.148377f,0.151367f,0.154417f,0.157524f,0.160689f,
|
||||
0.163911f,0.167190f,0.170525f,0.173915f,0.177361f,0.180861f,0.184415f,0.188023f,0.191684f,0.195397f,
|
||||
0.199162f,0.202979f,0.206846f,0.210764f,0.214731f,0.218747f,0.222811f,0.226924f,0.231083f,0.235289f,
|
||||
0.239540f,0.243837f,0.248179f,0.252565f,0.256993f,0.261465f,0.265978f,0.270533f,0.275128f,0.279763f,
|
||||
0.284438f,0.289151f,0.293901f,0.298689f,0.303513f,0.308372f,0.313267f,0.318195f,0.323157f,0.328152f,
|
||||
0.333179f,0.338237f,0.343325f,0.348442f,0.353589f,0.358764f,0.363966f,0.369194f,0.374448f,0.379727f,
|
||||
0.385031f,0.390357f,0.395706f,0.401077f,0.406469f,0.411881f,0.417312f,0.422762f,0.428229f,0.433713f,
|
||||
0.439213f,0.444729f,0.450258f,0.455802f,0.461358f,0.466925f,0.472504f,0.478093f,0.483691f,0.489298f,
|
||||
0.494912f,0.500533f,0.506160f,0.511792f,0.517429f,0.523069f,0.528711f,0.534355f,0.540000f,0.545645f,
|
||||
0.551289f,0.556931f,0.562571f,0.568208f,0.573840f,0.579467f,0.585088f,0.590702f,0.596309f,0.601907f,
|
||||
0.607496f,0.613075f,0.618642f,0.624198f,0.629742f,0.635271f,0.640787f,0.646287f,0.651771f,0.657238f,
|
||||
0.662688f,0.668119f,0.673531f,0.678923f,0.684294f,0.689643f,0.694969f,0.700273f,0.705552f,0.710806f,
|
||||
0.716034f,0.721236f,0.726411f,0.731558f,0.736675f,0.741763f,0.746821f,0.751848f,0.756842f,0.761805f,
|
||||
0.766733f,0.771628f,0.776487f,0.781311f,0.786099f,0.790850f,0.795562f,0.800237f,0.804872f,0.809467f,
|
||||
0.814022f,0.818535f,0.823007f,0.827435f,0.831821f,0.836163f,0.840460f,0.844711f,0.848917f,0.853076f,
|
||||
0.857189f,0.861253f,0.865269f,0.869236f,0.873154f,0.877021f,0.880838f,0.884603f,0.888316f,0.891977f,
|
||||
0.895585f,0.899139f,0.902639f,0.906085f,0.909475f,0.912810f,0.916089f,0.919311f,0.922476f,0.925583f,
|
||||
0.928633f,0.931623f,0.934555f,0.937428f,0.940240f,0.942992f,0.945684f,0.948314f,0.950883f,0.953390f,
|
||||
0.955835f,0.958217f,0.960536f,0.962792f,0.964985f,0.967113f,0.969177f,0.971176f,0.973110f,0.974979f,
|
||||
0.976783f,0.978521f,0.980193f,0.981798f,0.983337f,0.984809f,0.986214f,0.987552f,0.988823f,0.990026f,
|
||||
0.991161f,0.992229f,0.993228f,0.994159f,0.995021f,0.995815f,0.996541f,0.997197f,0.997785f,0.998304f,
|
||||
0.998754f,0.999134f,0.999446f,0.999688f,0.999861f,0.999965f,1.000000f,0.999965f,0.999861f,0.999688f,
|
||||
0.999446f,0.999134f,0.998754f,0.998304f,0.997785f,0.997197f,0.996541f,0.995815f,0.995021f,0.994159f,
|
||||
0.993228f,0.992229f,0.991161f,0.990026f,0.988823f,0.987552f,0.986214f,0.984809f,0.983337f,0.981798f,
|
||||
0.980193f,0.978521f,0.976783f,0.974979f,0.973110f,0.971176f,0.969177f,0.967113f,0.964985f,0.962792f,
|
||||
0.960536f,0.958217f,0.955835f,0.953390f,0.950883f,0.948314f,0.945684f,0.942992f,0.940240f,0.937428f,
|
||||
0.934555f,0.931623f,0.928633f,0.925583f,0.922476f,0.919311f,0.916089f,0.912810f,0.909475f,0.906085f,
|
||||
0.902639f,0.899139f,0.895585f,0.891977f,0.888316f,0.884603f,0.880838f,0.877021f,0.873154f,0.869236f,
|
||||
0.865269f,0.861253f,0.857189f,0.853076f,0.848917f,0.844711f,0.840460f,0.836163f,0.831821f,0.827435f,
|
||||
0.823007f,0.818535f,0.814022f,0.809467f,0.804872f,0.800237f,0.795562f,0.790850f,0.786099f,0.781311f,
|
||||
0.776487f,0.771628f,0.766733f,0.761805f,0.756842f,0.751848f,0.746821f,0.741763f,0.736675f,0.731558f,
|
||||
0.726411f,0.721236f,0.716034f,0.710806f,0.705552f,0.700273f,0.694969f,0.689643f,0.684294f,0.678923f,
|
||||
0.673531f,0.668119f,0.662688f,0.657238f,0.651771f,0.646287f,0.640787f,0.635271f,0.629742f,0.624198f,
|
||||
0.618642f,0.613075f,0.607496f,0.601907f,0.596309f,0.590702f,0.585088f,0.579467f,0.573840f,0.568208f,
|
||||
0.562571f,0.556931f,0.551289f,0.545645f,0.540000f,0.534355f,0.528711f,0.523069f,0.517429f,0.511792f,
|
||||
0.506160f,0.500533f,0.494912f,0.489298f,0.483691f,0.478093f,0.472504f,0.466925f,0.461358f,0.455802f,
|
||||
0.450258f,0.444729f,0.439213f,0.433713f,0.428229f,0.422762f,0.417312f,0.411881f,0.406469f,0.401077f,
|
||||
0.395706f,0.390357f,0.385031f,0.379727f,0.374448f,0.369194f,0.363966f,0.358764f,0.353589f,0.348442f,
|
||||
0.343325f,0.338237f,0.333179f,0.328152f,0.323157f,0.318195f,0.313267f,0.308372f,0.303513f,0.298689f,
|
||||
0.293901f,0.289151f,0.284438f,0.279763f,0.275128f,0.270533f,0.265978f,0.261465f,0.256993f,0.252565f,
|
||||
0.248179f,0.243837f,0.239540f,0.235289f,0.231083f,0.226924f,0.222811f,0.218747f,0.214731f,0.210764f,
|
||||
0.206846f,0.202979f,0.199162f,0.195397f,0.191684f,0.188023f,0.184415f,0.180861f,0.177361f,0.173915f,
|
||||
0.170525f,0.167190f,0.163911f,0.160689f,0.157524f,0.154417f,0.151367f,0.148377f,0.145445f,0.142572f,
|
||||
0.139760f,0.137008f,0.134316f,0.131686f,0.129117f,0.126610f,0.124165f,0.121783f,0.119464f,0.117208f,
|
||||
0.115015f,0.112887f,0.110823f,0.108824f,0.106890f,0.105021f,0.103217f,0.101479f,0.099807f,0.098202f,
|
||||
0.096663f,0.095191f,0.093786f,0.092448f,0.091177f,0.089974f,0.088839f,0.087771f,0.086772f,0.085841f,
|
||||
0.084979f,0.084185f,0.083459f,0.082803f,0.082215f,0.081696f,0.081246f,0.080866f,0.080554f,0.080312f,
|
||||
0.080139f,0.080035f,};
|
||||
|
||||
const float32_t mfcc_window_coefs_config3[NB_MFCC_WIN_COEFS_CONFIG3]={
|
||||
0.080000f,0.080139f,0.080554f,0.081246f,0.082215f,0.083459f,0.084979f,0.086772f,0.088839f,0.091177f,
|
||||
0.093786f,0.096663f,0.099807f,0.103217f,0.106890f,0.110823f,0.115015f,0.119464f,0.124165f,0.129117f,
|
||||
0.134316f,0.139760f,0.145445f,0.151367f,0.157524f,0.163911f,0.170525f,0.177361f,0.184415f,0.191684f,
|
||||
0.199162f,0.206846f,0.214731f,0.222811f,0.231083f,0.239540f,0.248179f,0.256993f,0.265978f,0.275128f,
|
||||
0.284438f,0.293901f,0.303513f,0.313267f,0.323157f,0.333179f,0.343325f,0.353589f,0.363966f,0.374448f,
|
||||
0.385031f,0.395706f,0.406469f,0.417312f,0.428229f,0.439213f,0.450258f,0.461358f,0.472504f,0.483691f,
|
||||
0.494912f,0.506160f,0.517429f,0.528711f,0.540000f,0.551289f,0.562571f,0.573840f,0.585088f,0.596309f,
|
||||
0.607496f,0.618642f,0.629742f,0.640787f,0.651771f,0.662688f,0.673531f,0.684294f,0.694969f,0.705552f,
|
||||
0.716034f,0.726411f,0.736675f,0.746821f,0.756842f,0.766733f,0.776487f,0.786099f,0.795562f,0.804872f,
|
||||
0.814022f,0.823007f,0.831821f,0.840460f,0.848917f,0.857189f,0.865269f,0.873154f,0.880838f,0.888316f,
|
||||
0.895585f,0.902639f,0.909475f,0.916089f,0.922476f,0.928633f,0.934555f,0.940240f,0.945684f,0.950883f,
|
||||
0.955835f,0.960536f,0.964985f,0.969177f,0.973110f,0.976783f,0.980193f,0.983337f,0.986214f,0.988823f,
|
||||
0.991161f,0.993228f,0.995021f,0.996541f,0.997785f,0.998754f,0.999446f,0.999861f,1.000000f,0.999861f,
|
||||
0.999446f,0.998754f,0.997785f,0.996541f,0.995021f,0.993228f,0.991161f,0.988823f,0.986214f,0.983337f,
|
||||
0.980193f,0.976783f,0.973110f,0.969177f,0.964985f,0.960536f,0.955835f,0.950883f,0.945684f,0.940240f,
|
||||
0.934555f,0.928633f,0.922476f,0.916089f,0.909475f,0.902639f,0.895585f,0.888316f,0.880838f,0.873154f,
|
||||
0.865269f,0.857189f,0.848917f,0.840460f,0.831821f,0.823007f,0.814022f,0.804872f,0.795562f,0.786099f,
|
||||
0.776487f,0.766733f,0.756842f,0.746821f,0.736675f,0.726411f,0.716034f,0.705552f,0.694969f,0.684294f,
|
||||
0.673531f,0.662688f,0.651771f,0.640787f,0.629742f,0.618642f,0.607496f,0.596309f,0.585088f,0.573840f,
|
||||
0.562571f,0.551289f,0.540000f,0.528711f,0.517429f,0.506160f,0.494912f,0.483691f,0.472504f,0.461358f,
|
||||
0.450258f,0.439213f,0.428229f,0.417312f,0.406469f,0.395706f,0.385031f,0.374448f,0.363966f,0.353589f,
|
||||
0.343325f,0.333179f,0.323157f,0.313267f,0.303513f,0.293901f,0.284438f,0.275128f,0.265978f,0.256993f,
|
||||
0.248179f,0.239540f,0.231083f,0.222811f,0.214731f,0.206846f,0.199162f,0.191684f,0.184415f,0.177361f,
|
||||
0.170525f,0.163911f,0.157524f,0.151367f,0.145445f,0.139760f,0.134316f,0.129117f,0.124165f,0.119464f,
|
||||
0.115015f,0.110823f,0.106890f,0.103217f,0.099807f,0.096663f,0.093786f,0.091177f,0.088839f,0.086772f,
|
||||
0.084979f,0.083459f,0.082215f,0.081246f,0.080554f,0.080139f,};
|
||||
|
||||
|
||||
const uint32_t mfcc_filter_pos_config1[NB_MFCC_NB_FILTER_CONFIG1]={
|
||||
5,11,17,25,33,43,54,66,79,94,
|
||||
111,131,152,176,203,234,268,306,349,397,
|
||||
};
|
||||
const uint32_t mfcc_filter_len_config1[NB_MFCC_NB_FILTER_CONFIG1]={
|
||||
12,14,16,18,21,23,25,28,32,37,
|
||||
41,45,51,58,65,72,81,91,103,115,
|
||||
};
|
||||
|
||||
const uint32_t mfcc_filter_pos_config2[NB_MFCC_NB_FILTER_CONFIG2]={
|
||||
3,6,9,13,17,22,27,33,40,47,
|
||||
56,66,76,88,102,117,134,153,175,199,
|
||||
};
|
||||
const uint32_t mfcc_filter_len_config2[NB_MFCC_NB_FILTER_CONFIG2]={
|
||||
6,7,8,9,10,11,13,14,16,19,
|
||||
20,22,26,29,32,36,41,46,51,57,
|
||||
};
|
||||
|
||||
const uint32_t mfcc_filter_pos_config3[NB_MFCC_NB_FILTER_CONFIG3]={
|
||||
2,3,5,7,9,11,14,17,20,24,
|
||||
28,33,38,44,51,59,67,77,88,100,
|
||||
};
|
||||
const uint32_t mfcc_filter_len_config3[NB_MFCC_NB_FILTER_CONFIG3]={
|
||||
3,4,4,4,5,6,6,7,8,9,
|
||||
10,11,13,15,16,18,21,23,25,28,
|
||||
};
|
||||
|
||||
|
||||
|
||||
const float32_t mfcc_filter_coefs_config1[NB_MFCC_FILTER_COEFS_CONFIG1]={
|
||||
0.158152f,0.329789f,0.498080f,0.663153f,0.825129f,0.984122f,0.859761f,0.706417f,0.555749f,0.407665f,
|
||||
0.262079f,0.118907f,0.140239f,0.293583f,0.444251f,0.592335f,0.737921f,0.881093f,0.978071f,0.839496f,
|
||||
0.703110f,0.568845f,0.436636f,0.306422f,0.178142f,0.051741f,0.021929f,0.160504f,0.296890f,0.431155f,
|
||||
0.563364f,0.693578f,0.821858f,0.948259f,0.927164f,0.804358f,0.683276f,0.563868f,0.446089f,0.329895f,
|
||||
0.215245f,0.102097f,0.072836f,0.195642f,0.316724f,0.436132f,0.553911f,0.670105f,0.784755f,0.897903f,
|
||||
0.990413f,0.880155f,0.771288f,0.663777f,0.557588f,0.452689f,0.349050f,0.246640f,0.145430f,0.045394f,
|
||||
0.009587f,0.119845f,0.228712f,0.336223f,0.442412f,0.547311f,0.650950f,0.753360f,0.854570f,0.954606f,
|
||||
0.946503f,0.848733f,0.752057f,0.656452f,0.561894f,0.468360f,0.375829f,0.284280f,0.193690f,0.104042f,
|
||||
0.015315f,0.053497f,0.151267f,0.247943f,0.343548f,0.438106f,0.531640f,0.624171f,0.715720f,0.806310f,
|
||||
0.895958f,0.984685f,0.927491f,0.840551f,0.754478f,0.669255f,0.584864f,0.501291f,0.418519f,0.336533f,
|
||||
0.255318f,0.174861f,0.095146f,0.016160f,0.072509f,0.159449f,0.245522f,0.330745f,0.415136f,0.498709f,
|
||||
0.581481f,0.663467f,0.744682f,0.825139f,0.904854f,0.983840f,0.937891f,0.860325f,0.783449f,0.707252f,
|
||||
0.631722f,0.556847f,0.482615f,0.409017f,0.336040f,0.263676f,0.191913f,0.120741f,0.050152f,0.062109f,
|
||||
0.139675f,0.216551f,0.292748f,0.368278f,0.443153f,0.517385f,0.590983f,0.663960f,0.736324f,0.808087f,
|
||||
0.879259f,0.949848f,0.980135f,0.910681f,0.841781f,0.773427f,0.705610f,0.638322f,0.571554f,0.505298f,
|
||||
0.439548f,0.374294f,0.309529f,0.245247f,0.181440f,0.118101f,0.055223f,0.019865f,0.089319f,0.158219f,
|
||||
0.226573f,0.294390f,0.361678f,0.428446f,0.494702f,0.560452f,0.625706f,0.690471f,0.754753f,0.818560f,
|
||||
0.881899f,0.944777f,0.992800f,0.930826f,0.869293f,0.808195f,0.747527f,0.687282f,0.627454f,0.568039f,
|
||||
0.509029f,0.450420f,0.392207f,0.334383f,0.276944f,0.219885f,0.163200f,0.106885f,0.050935f,0.007200f,
|
||||
0.069174f,0.130707f,0.191805f,0.252473f,0.312718f,0.372546f,0.431961f,0.490971f,0.549580f,0.607793f,
|
||||
0.665617f,0.723056f,0.780115f,0.836800f,0.893115f,0.949065f,0.995345f,0.940111f,0.885228f,0.830692f,
|
||||
0.776498f,0.722642f,0.669120f,0.615928f,0.563062f,0.510517f,0.458290f,0.406378f,0.354775f,0.303479f,
|
||||
0.252487f,0.201793f,0.151396f,0.101291f,0.051475f,0.001945f,0.004655f,0.059889f,0.114772f,0.169308f,
|
||||
0.223502f,0.277358f,0.330880f,0.384072f,0.436938f,0.489483f,0.541710f,0.593622f,0.645225f,0.696521f,
|
||||
0.747513f,0.798207f,0.848604f,0.898709f,0.948525f,0.998055f,0.952698f,0.903729f,0.855038f,0.806619f,
|
||||
0.758470f,0.710588f,0.662971f,0.615614f,0.568516f,0.521674f,0.475084f,0.428744f,0.382652f,0.336804f,
|
||||
0.291199f,0.245834f,0.200705f,0.155811f,0.111150f,0.066718f,0.022514f,0.047302f,0.096271f,0.144962f,
|
||||
0.193381f,0.241530f,0.289412f,0.337029f,0.384386f,0.431484f,0.478326f,0.524916f,0.571256f,0.617348f,
|
||||
0.663196f,0.708801f,0.754166f,0.799295f,0.844189f,0.888850f,0.933282f,0.977486f,0.978535f,0.934779f,
|
||||
0.891243f,0.847926f,0.804826f,0.761939f,0.719265f,0.676800f,0.634543f,0.592492f,0.550645f,0.508999f,
|
||||
0.467554f,0.426307f,0.385255f,0.344399f,0.303734f,0.263260f,0.222975f,0.182877f,0.142965f,0.103236f,
|
||||
0.063689f,0.024323f,0.021465f,0.065221f,0.108757f,0.152074f,0.195174f,0.238061f,0.280735f,0.323200f,
|
||||
0.365457f,0.407508f,0.449355f,0.491001f,0.532446f,0.573693f,0.614745f,0.655601f,0.696266f,0.736740f,
|
||||
0.777025f,0.817123f,0.857035f,0.896764f,0.936311f,0.975677f,0.985135f,0.946124f,0.907289f,0.868628f,
|
||||
0.830139f,0.791821f,0.753672f,0.715691f,0.677876f,0.640227f,0.602740f,0.565416f,0.528253f,0.491249f,
|
||||
0.454402f,0.417713f,0.381178f,0.344798f,0.308570f,0.272494f,0.236568f,0.200790f,0.165161f,0.129678f,
|
||||
0.094340f,0.059146f,0.024095f,0.014865f,0.053876f,0.092711f,0.131372f,0.169861f,0.208179f,0.246328f,
|
||||
0.284309f,0.322124f,0.359773f,0.397260f,0.434584f,0.471747f,0.508751f,0.545597f,0.582287f,0.618822f,
|
||||
0.655202f,0.691430f,0.727506f,0.763432f,0.799210f,0.834839f,0.870322f,0.905660f,0.940854f,0.975905f,
|
||||
0.989185f,0.954417f,0.919787f,0.885297f,0.850943f,0.816725f,0.782643f,0.748695f,0.714879f,0.681196f,
|
||||
0.647643f,0.614221f,0.580927f,0.547761f,0.514722f,0.481809f,0.449021f,0.416357f,0.383817f,0.351398f,
|
||||
0.319101f,0.286924f,0.254866f,0.222928f,0.191107f,0.159402f,0.127814f,0.096341f,0.064982f,0.033737f,
|
||||
0.002604f,0.010815f,0.045583f,0.080213f,0.114703f,0.149057f,0.183275f,0.217357f,0.251305f,0.285121f,
|
||||
0.318804f,0.352357f,0.385779f,0.419073f,0.452239f,0.485278f,0.518191f,0.550979f,0.583643f,0.616183f,
|
||||
0.648602f,0.680899f,0.713076f,0.745134f,0.777072f,0.808893f,0.840598f,0.872186f,0.903659f,0.935018f,
|
||||
0.966263f,0.997396f,0.971584f,0.940674f,0.909875f,0.879185f,0.848604f,0.818130f,0.787764f,0.757505f,
|
||||
0.727351f,0.697302f,0.667357f,0.637516f,0.607777f,0.578141f,0.548606f,0.519172f,0.489838f,0.460603f,
|
||||
0.431467f,0.402428f,0.373487f,0.344643f,0.315895f,0.287242f,0.258684f,0.230221f,0.201850f,0.173573f,
|
||||
0.145388f,0.117295f,0.089293f,0.061381f,0.033559f,0.005827f,0.028416f,0.059326f,0.090125f,0.120815f,
|
||||
0.151396f,0.181870f,0.212236f,0.242495f,0.272649f,0.302698f,0.332643f,0.362484f,0.392223f,0.421859f,
|
||||
0.451394f,0.480828f,0.510162f,0.539397f,0.568533f,0.597572f,0.626513f,0.655357f,0.684105f,0.712758f,
|
||||
0.741315f,0.769779f,0.798150f,0.826427f,0.854612f,0.882705f,0.910707f,0.938619f,0.966441f,0.994173f,
|
||||
0.978184f,0.950628f,0.923161f,0.895780f,0.868486f,0.841279f,0.814156f,0.787119f,0.760166f,0.733296f,
|
||||
0.706511f,0.679808f,0.653187f,0.626648f,0.600191f,0.573814f,0.547518f,0.521302f,0.495165f,0.469106f,
|
||||
0.443127f,0.417225f,0.391401f,0.365653f,0.339983f,0.314388f,0.288869f,0.263425f,0.238056f,0.212762f,
|
||||
0.187541f,0.162394f,0.137319f,0.112318f,0.087388f,0.062531f,0.037744f,0.013029f,0.021816f,0.049372f,
|
||||
0.076839f,0.104220f,0.131514f,0.158721f,0.185844f,0.212881f,0.239834f,0.266704f,0.293489f,0.320192f,
|
||||
0.346813f,0.373352f,0.399809f,0.426186f,0.452482f,0.478698f,0.504835f,0.530894f,0.556873f,0.582775f,
|
||||
0.608599f,0.634347f,0.660017f,0.685612f,0.711131f,0.736575f,0.761944f,0.787238f,0.812459f,0.837606f,
|
||||
0.862681f,0.887682f,0.912612f,0.937469f,0.962256f,0.986971f,0.988384f,0.963810f,0.939305f,0.914869f,
|
||||
0.890503f,0.866205f,0.841975f,0.817813f,0.793719f,0.769691f,0.745730f,0.721836f,0.698008f,0.674245f,
|
||||
0.650547f,0.626914f,0.603346f,0.579842f,0.556401f,0.533025f,0.509711f,0.486460f,0.463272f,0.440145f,
|
||||
0.417081f,0.394078f,0.371136f,0.348254f,0.325434f,0.302673f,0.279973f,0.257332f,0.234750f,0.212227f,
|
||||
0.189762f,0.167356f,0.145008f,0.122718f,0.100485f,0.078309f,0.056190f,0.034127f,0.012121f,0.011616f,
|
||||
0.036190f,0.060695f,0.085131f,0.109497f,0.133795f,0.158025f,0.182187f,0.206281f,0.230309f,0.254270f,
|
||||
0.278164f,0.301992f,0.325755f,0.349453f,0.373086f,0.396654f,0.420158f,0.443599f,0.466975f,0.490289f,
|
||||
0.513540f,0.536728f,0.559855f,0.582919f,0.605922f,0.628864f,0.651745f,0.674566f,0.697327f,0.720027f,
|
||||
0.742669f,0.765250f,0.787773f,0.810238f,0.832644f,0.854992f,0.877282f,0.899515f,0.921691f,0.943810f,
|
||||
0.965873f,0.987879f,0.990171f,0.968276f,0.946437f,0.924653f,0.902923f,0.881249f,0.859628f,0.838062f,
|
||||
0.816549f,0.795090f,0.773684f,0.752330f,0.731030f,0.709782f,0.688586f,0.667442f,0.646350f,0.625309f,
|
||||
0.604320f,0.583381f,0.562493f,0.541655f,0.520867f,0.500130f,0.479442f,0.458803f,0.438214f,0.417674f,
|
||||
0.397182f,0.376740f,0.356345f,0.335998f,0.315700f,0.295448f,0.275245f,0.255088f,0.234978f,0.214916f,
|
||||
0.194899f,0.174929f,0.155005f,0.135127f,0.115295f,0.095508f,0.075766f,0.056069f,0.036417f,0.016810f,
|
||||
0.009829f,0.031724f,0.053563f,0.075347f,0.097077f,0.118751f,0.140372f,0.161938f,0.183451f,0.204910f,
|
||||
0.226316f,0.247670f,0.268970f,0.290218f,0.311414f,0.332558f,0.353650f,0.374691f,0.395680f,0.416619f,
|
||||
0.437507f,0.458345f,0.479133f,0.499870f,0.520558f,0.541197f,0.561786f,0.582326f,0.602817f,0.623260f,
|
||||
0.643655f,0.664002f,0.684300f,0.704552f,0.724755f,0.744912f,0.765022f,0.785084f,0.805101f,0.825071f,
|
||||
0.844995f,0.864873f,0.884705f,0.904492f,0.924234f,0.943931f,0.963583f,0.983190f,0.997247f,0.977729f,
|
||||
0.958254f,0.938824f,0.919437f,0.900093f,0.880792f,0.861535f,0.842321f,0.823149f,0.804020f,0.784933f,
|
||||
0.765888f,0.746885f,0.727923f,0.709004f,0.690125f,0.671288f,0.652492f,0.633737f,0.615022f,0.596348f,
|
||||
0.577714f,0.559120f,0.540567f,0.522053f,0.503578f,0.485144f,0.466748f,0.448391f,0.430074f,0.411795f,
|
||||
0.393555f,0.375353f,0.357190f,0.339065f,0.320977f,0.302928f,0.284916f,0.266942f,0.249005f,0.231105f,
|
||||
0.213242f,0.195416f,0.177627f,0.159875f,0.142159f,0.124479f,0.106835f,0.089227f,0.071656f,0.054119f,
|
||||
0.036619f,0.019154f,0.001724f,0.002753f,0.022271f,0.041746f,0.061176f,0.080564f,0.099907f,0.119208f,
|
||||
0.138465f,0.157679f,0.176851f,0.195980f,0.215067f,0.234112f,0.253115f,0.272077f,0.290996f,0.309875f,
|
||||
0.328712f,0.347508f,0.366263f,0.384978f,0.403652f,0.422286f,0.440880f,0.459433f,0.477947f,0.496422f,
|
||||
0.514856f,0.533252f,0.551609f,0.569926f,0.588205f,0.606445f,0.624647f,0.642810f,0.660935f,0.679023f,
|
||||
0.697072f,0.715084f,0.733058f,0.750995f,0.768895f,0.786758f,0.804583f,0.822373f,0.840125f,0.857841f,
|
||||
0.875521f,0.893165f,0.910773f,0.928344f,0.945881f,0.963381f,0.980846f,0.998276f,0.984329f,0.966969f,
|
||||
0.949644f,0.932354f,0.915098f,0.897877f,0.880689f,0.863537f,0.846418f,0.829333f,0.812281f,0.795264f,
|
||||
0.778279f,0.761329f,0.744411f,0.727526f,0.710675f,0.693856f,0.677070f,0.660317f,0.643596f,0.626907f,
|
||||
0.610251f,0.593626f,0.577034f,0.560473f,0.543944f,0.527447f,0.510981f,0.494546f,0.478143f,0.461771f,
|
||||
0.445430f,0.429119f,0.412840f,0.396591f,0.380372f,0.364184f,0.348027f,0.331899f,0.315802f,0.299734f,
|
||||
0.283697f,0.267689f,0.251710f,0.235762f,0.219842f,0.203952f,0.188091f,0.172260f,0.156457f,0.140683f,
|
||||
0.124938f,0.109221f,0.093533f,0.077874f,0.062243f,0.046640f,0.031065f,0.015519f,};
|
||||
|
||||
const float32_t mfcc_filter_coefs_config2[NB_MFCC_FILTER_COEFS_CONFIG2]={
|
||||
0.329789f,0.663153f,0.984122f,0.706417f,0.407665f,0.118907f,0.293583f,0.592335f,0.881093f,0.839496f,
|
||||
0.568845f,0.306422f,0.051741f,0.160504f,0.431155f,0.693578f,0.948259f,0.804358f,0.563868f,0.329895f,
|
||||
0.102097f,0.195642f,0.436132f,0.670105f,0.897903f,0.880155f,0.663777f,0.452689f,0.246640f,0.045394f,
|
||||
0.119845f,0.336223f,0.547311f,0.753360f,0.954606f,0.848733f,0.656452f,0.468360f,0.284280f,0.104042f,
|
||||
0.151267f,0.343548f,0.531640f,0.715720f,0.895958f,0.927491f,0.754478f,0.584864f,0.418519f,0.255318f,
|
||||
0.095146f,0.072509f,0.245522f,0.415136f,0.581481f,0.744682f,0.904854f,0.937891f,0.783449f,0.631722f,
|
||||
0.482615f,0.336040f,0.191913f,0.050152f,0.062109f,0.216551f,0.368278f,0.517385f,0.663960f,0.808087f,
|
||||
0.949848f,0.910681f,0.773427f,0.638322f,0.505298f,0.374294f,0.245247f,0.118101f,0.089319f,0.226573f,
|
||||
0.361678f,0.494702f,0.625706f,0.754753f,0.881899f,0.992800f,0.869293f,0.747527f,0.627454f,0.509029f,
|
||||
0.392207f,0.276944f,0.163200f,0.050935f,0.007200f,0.130707f,0.252473f,0.372546f,0.490971f,0.607793f,
|
||||
0.723056f,0.836800f,0.949065f,0.940111f,0.830692f,0.722642f,0.615928f,0.510517f,0.406378f,0.303479f,
|
||||
0.201793f,0.101291f,0.001945f,0.059889f,0.169308f,0.277358f,0.384072f,0.489483f,0.593622f,0.696521f,
|
||||
0.798207f,0.898709f,0.998055f,0.903729f,0.806619f,0.710588f,0.615614f,0.521674f,0.428744f,0.336804f,
|
||||
0.245834f,0.155811f,0.066718f,0.096271f,0.193381f,0.289412f,0.384386f,0.478326f,0.571256f,0.663196f,
|
||||
0.754166f,0.844189f,0.933282f,0.978535f,0.891243f,0.804826f,0.719265f,0.634543f,0.550645f,0.467554f,
|
||||
0.385255f,0.303734f,0.222975f,0.142965f,0.063689f,0.021465f,0.108757f,0.195174f,0.280735f,0.365457f,
|
||||
0.449355f,0.532446f,0.614745f,0.696266f,0.777025f,0.857035f,0.936311f,0.985135f,0.907289f,0.830139f,
|
||||
0.753672f,0.677876f,0.602740f,0.528253f,0.454402f,0.381178f,0.308570f,0.236568f,0.165161f,0.094340f,
|
||||
0.024095f,0.014865f,0.092711f,0.169861f,0.246328f,0.322124f,0.397260f,0.471747f,0.545597f,0.618822f,
|
||||
0.691430f,0.763432f,0.834839f,0.905660f,0.975905f,0.954417f,0.885297f,0.816725f,0.748695f,0.681196f,
|
||||
0.614221f,0.547761f,0.481809f,0.416357f,0.351398f,0.286924f,0.222928f,0.159402f,0.096341f,0.033737f,
|
||||
0.045583f,0.114703f,0.183275f,0.251305f,0.318804f,0.385779f,0.452239f,0.518191f,0.583643f,0.648602f,
|
||||
0.713076f,0.777072f,0.840598f,0.903659f,0.966263f,0.971584f,0.909875f,0.848604f,0.787764f,0.727351f,
|
||||
0.667357f,0.607777f,0.548606f,0.489838f,0.431467f,0.373487f,0.315895f,0.258684f,0.201850f,0.145388f,
|
||||
0.089293f,0.033559f,0.028416f,0.090125f,0.151396f,0.212236f,0.272649f,0.332643f,0.392223f,0.451394f,
|
||||
0.510162f,0.568533f,0.626513f,0.684105f,0.741315f,0.798150f,0.854612f,0.910707f,0.966441f,0.978184f,
|
||||
0.923161f,0.868486f,0.814156f,0.760166f,0.706511f,0.653187f,0.600191f,0.547518f,0.495165f,0.443127f,
|
||||
0.391401f,0.339983f,0.288869f,0.238056f,0.187541f,0.137319f,0.087388f,0.037744f,0.021816f,0.076839f,
|
||||
0.131514f,0.185844f,0.239834f,0.293489f,0.346813f,0.399809f,0.452482f,0.504835f,0.556873f,0.608599f,
|
||||
0.660017f,0.711131f,0.761944f,0.812459f,0.862681f,0.912612f,0.962256f,0.988384f,0.939305f,0.890503f,
|
||||
0.841975f,0.793719f,0.745730f,0.698008f,0.650547f,0.603346f,0.556401f,0.509711f,0.463272f,0.417081f,
|
||||
0.371136f,0.325434f,0.279973f,0.234750f,0.189762f,0.145008f,0.100485f,0.056190f,0.012121f,0.011616f,
|
||||
0.060695f,0.109497f,0.158025f,0.206281f,0.254270f,0.301992f,0.349453f,0.396654f,0.443599f,0.490289f,
|
||||
0.536728f,0.582919f,0.628864f,0.674566f,0.720027f,0.765250f,0.810238f,0.854992f,0.899515f,0.943810f,
|
||||
0.987879f,0.968276f,0.924653f,0.881249f,0.838062f,0.795090f,0.752330f,0.709782f,0.667442f,0.625309f,
|
||||
0.583381f,0.541655f,0.500130f,0.458803f,0.417674f,0.376740f,0.335998f,0.295448f,0.255088f,0.214916f,
|
||||
0.174929f,0.135127f,0.095508f,0.056069f,0.016810f,0.031724f,0.075347f,0.118751f,0.161938f,0.204910f,
|
||||
0.247670f,0.290218f,0.332558f,0.374691f,0.416619f,0.458345f,0.499870f,0.541197f,0.582326f,0.623260f,
|
||||
0.664002f,0.704552f,0.744912f,0.785084f,0.825071f,0.864873f,0.904492f,0.943931f,0.983190f,0.977729f,
|
||||
0.938824f,0.900093f,0.861535f,0.823149f,0.784933f,0.746885f,0.709004f,0.671288f,0.633737f,0.596348f,
|
||||
0.559120f,0.522053f,0.485144f,0.448391f,0.411795f,0.375353f,0.339065f,0.302928f,0.266942f,0.231105f,
|
||||
0.195416f,0.159875f,0.124479f,0.089227f,0.054119f,0.019154f,0.022271f,0.061176f,0.099907f,0.138465f,
|
||||
0.176851f,0.215067f,0.253115f,0.290996f,0.328712f,0.366263f,0.403652f,0.440880f,0.477947f,0.514856f,
|
||||
0.551609f,0.588205f,0.624647f,0.660935f,0.697072f,0.733058f,0.768895f,0.804583f,0.840125f,0.875521f,
|
||||
0.910773f,0.945881f,0.980846f,0.984329f,0.949644f,0.915098f,0.880689f,0.846418f,0.812281f,0.778279f,
|
||||
0.744411f,0.710675f,0.677070f,0.643596f,0.610251f,0.577034f,0.543944f,0.510981f,0.478143f,0.445430f,
|
||||
0.412840f,0.380372f,0.348027f,0.315802f,0.283697f,0.251710f,0.219842f,0.188091f,0.156457f,0.124938f,
|
||||
0.093533f,0.062243f,0.031065f,};
|
||||
|
||||
const float32_t mfcc_filter_coefs_config3[NB_MFCC_FILTER_COEFS_CONFIG3]={
|
||||
0.663153f,0.706417f,0.118907f,0.293583f,0.881093f,0.568845f,0.051741f,0.431155f,0.948259f,0.563868f,
|
||||
0.102097f,0.436132f,0.897903f,0.663777f,0.246640f,0.336223f,0.753360f,0.848733f,0.468360f,0.104042f,
|
||||
0.151267f,0.531640f,0.895958f,0.754478f,0.418519f,0.095146f,0.245522f,0.581481f,0.904854f,0.783449f,
|
||||
0.482615f,0.191913f,0.216551f,0.517385f,0.808087f,0.910681f,0.638322f,0.374294f,0.118101f,0.089319f,
|
||||
0.361678f,0.625706f,0.881899f,0.869293f,0.627454f,0.392207f,0.163200f,0.130707f,0.372546f,0.607793f,
|
||||
0.836800f,0.940111f,0.722642f,0.510517f,0.303479f,0.101291f,0.059889f,0.277358f,0.489483f,0.696521f,
|
||||
0.898709f,0.903729f,0.710588f,0.521674f,0.336804f,0.155811f,0.096271f,0.289412f,0.478326f,0.663196f,
|
||||
0.844189f,0.978535f,0.804826f,0.634543f,0.467554f,0.303734f,0.142965f,0.021465f,0.195174f,0.365457f,
|
||||
0.532446f,0.696266f,0.857035f,0.985135f,0.830139f,0.677876f,0.528253f,0.381178f,0.236568f,0.094340f,
|
||||
0.014865f,0.169861f,0.322124f,0.471747f,0.618822f,0.763432f,0.905660f,0.954417f,0.816725f,0.681196f,
|
||||
0.547761f,0.416357f,0.286924f,0.159402f,0.033737f,0.045583f,0.183275f,0.318804f,0.452239f,0.583643f,
|
||||
0.713076f,0.840598f,0.966263f,0.909875f,0.787764f,0.667357f,0.548606f,0.431467f,0.315895f,0.201850f,
|
||||
0.089293f,0.090125f,0.212236f,0.332643f,0.451394f,0.568533f,0.684105f,0.798150f,0.910707f,0.978184f,
|
||||
0.868486f,0.760166f,0.653187f,0.547518f,0.443127f,0.339983f,0.238056f,0.137319f,0.037744f,0.021816f,
|
||||
0.131514f,0.239834f,0.346813f,0.452482f,0.556873f,0.660017f,0.761944f,0.862681f,0.962256f,0.939305f,
|
||||
0.841975f,0.745730f,0.650547f,0.556401f,0.463272f,0.371136f,0.279973f,0.189762f,0.100485f,0.012121f,
|
||||
0.060695f,0.158025f,0.254270f,0.349453f,0.443599f,0.536728f,0.628864f,0.720027f,0.810238f,0.899515f,
|
||||
0.987879f,0.924653f,0.838062f,0.752330f,0.667442f,0.583381f,0.500130f,0.417674f,0.335998f,0.255088f,
|
||||
0.174929f,0.095508f,0.016810f,0.075347f,0.161938f,0.247670f,0.332558f,0.416619f,0.499870f,0.582326f,
|
||||
0.664002f,0.744912f,0.825071f,0.904492f,0.983190f,0.938824f,0.861535f,0.784933f,0.709004f,0.633737f,
|
||||
0.559120f,0.485144f,0.411795f,0.339065f,0.266942f,0.195416f,0.124479f,0.054119f,0.061176f,0.138465f,
|
||||
0.215067f,0.290996f,0.366263f,0.440880f,0.514856f,0.588205f,0.660935f,0.733058f,0.804583f,0.875521f,
|
||||
0.945881f,0.984329f,0.915098f,0.846418f,0.778279f,0.710675f,0.643596f,0.577034f,0.510981f,0.445430f,
|
||||
0.380372f,0.315802f,0.251710f,0.188091f,0.124938f,0.062243f,};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue