-
Notifications
You must be signed in to change notification settings - Fork 206
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationquestionFurther information is requestedFurther information is requested
Description
Dear Maintainer,
For our current development we are trying to use the function arm_mfcc_q31 in C (and in Python) and have some questions.
- How is this function supposed to be used for more than one FFT window (assuming you have a hop length of 160) ?
We are currently using it this way, and are not sure if it's working as expected.
for (uint32_t i = 0,mfcccount = 0; (i + fftLen) <= MONO_AUDIO_NB_SAMPLES/2 && mfcccount < 100; i += HOP_LENGTH, mfcccount++) {
ARMstatus = arm_mfcc_q31(
&S,
(q31_t*)&InputMonoResampledBuffer[i],
(q31_t*)&OutputMFCC[mfcccount*nbDctOutputs],
(q31_t*)TempMFCC
);
}- Why in this file is the result of the Q31 MFCC conversion multiplied by the FFT length ?
CMSIS-DSP/PythonWrapper/examples/testmfcc.py
Line 101 in c28df48
res=self.FFTSize*Q31toF32(resQ31) - Is there any example in C or in python for outputting an array of MFCC sample using CMSIS-DSP ?
- We also saw this issue, Matching MFCC configuration with Librosa's #54 and when we tried the same audio sample (sine wave at 1 kHZ) we saw quite big difference between the output in float32 and q31, is it expected ?
window = sig.windows.hamming(FFTSize, sym=False)
filtLen,filtPos,packedFilters = mfcc.melFilterMatrix(F32,freq_min, freq_high, numOfMelFilters,sample_rate,FFTSize)
dctMatrixFilters = mfcc.dctMatrix(F32,numOfDctOutputs, numOfMelFilters)
mfccf32=dsp.arm_mfcc_instance_f32()
status=dsp.arm_mfcc_init_f32(mfccf32,FFTSize,numOfMelFilters,numOfDctOutputs,dctMatrixFilters,
filtPos,filtLen,packedFilters,window)
tmp_nb = dsp.arm_mfcc_tmp_buffer_size(dt.F32,FFTSize,1)
tmp = np.zeros(tmp_nb,dtype=np.float32)
res=dsp.arm_mfcc_f32(mfccf32,pcm[0:FFTSize],tmp)
print("CMSIS-DSP")
print(res)
t = np.linspace(0,2,num_samples)
pcm = np.array(np.sin(2*math.pi * t * 1000),dtype=np.double)
mfccq31=dsp.arm_mfcc_instance_q31()
windowQ31 = dt.convert(sig.windows.hamming(FFTSize, sym=False),Q31)
filtLen,filtPos,packedFiltersQ31 = mfcc.melFilterMatrix(Q31,
freq_min,
freq_high,
numOfMelFilters,
sample_rate,
FFTSize)
dctMatrixFiltersQ31 = mfcc.dctMatrix(Q31,numOfDctOutputs, numOfMelFilters)
status=dsp.arm_mfcc_init_q31(mfccq31,FFTSize,numOfMelFilters,numOfDctOutputs,
dctMatrixFiltersQ31,
filtPos,filtLen,packedFiltersQ31,windowQ31)
#debugQ31 = toQ31(debug)
tmp_nb = dsp.arm_mfcc_tmp_buffer_size(dt.Q31,FFTSize,1)
tmp = np.zeros(tmp_nb,dtype=np.int32)
errorStatus,resQ31=dsp.arm_mfcc_q31(mfccq31,toQ31(pcm[0:FFTSize]),tmp)
res=FFTSize*Q31toF32(resQ31)
print("CMSIS-DSP-Q31")
print(resQ31)
print(res) Best Regards,
Mohammed Ismail
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationquestionFurther information is requestedFurther information is requested