########################################### # 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(' 0x07FFF): r = 0x07FFF if (r < -0x08000): r = -0x08000 return ("0x%s" % format(struct.unpack('