alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | /* |
Richard Burton | f32a86a | 2022-11-15 11:46:11 +0000 | [diff] [blame^] | 2 | * SPDX-FileCopyrightText: Copyright 2021 Arm Limited and/or its affiliates <open-source-office@arm.com> |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
Kshitij Sisodia | 76a1580 | 2021-12-24 11:05:11 +0000 | [diff] [blame] | 17 | #ifndef KWS_MICRONET_MFCC_HPP |
| 18 | #define KWS_MICRONET_MFCC_HPP |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 19 | |
| 20 | #include "Mfcc.hpp" |
| 21 | |
| 22 | namespace arm { |
| 23 | namespace app { |
| 24 | namespace audio { |
| 25 | |
Kshitij Sisodia | 76a1580 | 2021-12-24 11:05:11 +0000 | [diff] [blame] | 26 | /* Class to provide MicroNet specific MFCC calculation requirements. */ |
| 27 | class MicroNetKwsMFCC : public MFCC { |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 28 | |
| 29 | public: |
| 30 | static constexpr uint32_t ms_defaultSamplingFreq = 16000; |
| 31 | static constexpr uint32_t ms_defaultNumFbankBins = 40; |
| 32 | static constexpr uint32_t ms_defaultMelLoFreq = 20; |
| 33 | static constexpr uint32_t ms_defaultMelHiFreq = 4000; |
| 34 | static constexpr bool ms_defaultUseHtkMethod = true; |
| 35 | |
Kshitij Sisodia | 76a1580 | 2021-12-24 11:05:11 +0000 | [diff] [blame] | 36 | explicit MicroNetKwsMFCC(const size_t numFeats, const size_t frameLen) |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 37 | : MFCC(MfccParams( |
| 38 | ms_defaultSamplingFreq, ms_defaultNumFbankBins, |
| 39 | ms_defaultMelLoFreq, ms_defaultMelHiFreq, |
| 40 | numFeats, frameLen, ms_defaultUseHtkMethod)) |
| 41 | {} |
Kshitij Sisodia | 76a1580 | 2021-12-24 11:05:11 +0000 | [diff] [blame] | 42 | MicroNetKwsMFCC() = delete; |
| 43 | ~MicroNetKwsMFCC() = default; |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | } /* namespace audio */ |
| 47 | } /* namespace app */ |
| 48 | } /* namespace arm */ |
| 49 | |
Kshitij Sisodia | 76a1580 | 2021-12-24 11:05:11 +0000 | [diff] [blame] | 50 | #endif /* KWS_MICRONET_MFCC_HPP */ |