Sound Open Firmware
Loading...
Searching...
No Matches
kwd_nn_config.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright 2021 NXP
4 *
5 * Author: Mihai Despotovici <mihai.despotovici@nxp.com>
6 */
7
8#ifndef __KWD_NN_CONFIG_H__
9#define __KWD_NN_CONFIG_H__
10
11/* RAW AUDIO DATA CONFIGURATION */
12#define KWD_NN_MS_TO_SAMPLES(samplerate, time) ((samplerate) * (time) / 1000)
13#define KWD_NN_SIZE_FROM_STRIDE_SIZE(stride, size, no_windows) \
14 (((no_windows) - 1) * (stride) + (size))
15
16#define KWD_NN_CONFIG_SAMPLERATE 16000
17#define KWD_NN_CONFIG_NO_CHANNELS 1
18
19#define KWD_NN_CONFIG_WINDOW_STRIDE KWD_NN_MS_TO_SAMPLES(KWD_NN_CONFIG_SAMPLERATE, 20)
20#define KWD_NN_CONFIG_WINDOW_SIZE KWD_NN_MS_TO_SAMPLES(KWD_NN_CONFIG_SAMPLERATE, 30)
21#define KWD_NN_CONFIG_NO_WINDOWS 49
22
23#define KWD_NN_CONFIG_RAW_SIZE (KWD_NN_CONFIG_NO_CHANNELS * \
24 KWD_NN_SIZE_FROM_STRIDE_SIZE( \
25 KWD_NN_CONFIG_WINDOW_STRIDE, \
26 KWD_NN_CONFIG_WINDOW_SIZE, \
27 KWD_NN_CONFIG_NO_WINDOWS))
28
29/* PREPROCESSED DATA CONFIGURATION */
30#define KWD_NN_CONFIG_PREPROCESSED_HEIGHT KWD_NN_CONFIG_NO_WINDOWS
31#define KWD_NN_CONFIG_SPECTROGRAM_SIZE 256
32#define KWD_NN_CONFIG_PREPROCESSED_AVGPOOL_WIDTH 6
33#define KWD_NN_CONFIG_PREPROCESSED_WIDTH 43
34#define KWD_NN_CONFIG_PREPROCESSED_SIZE (KWD_NN_CONFIG_PREPROCESSED_HEIGHT * \
35 KWD_NN_CONFIG_PREPROCESSED_WIDTH)
36
37/* NN can report one of the following 4 answers
38 * after applying inference: YES, NO, UNKNOWN or
39 * SILENCE. The function computes confidence
40 * value for each possible answer
41 */
42#define KWD_NN_CONFIDENCES_SIZE 4
43
44/* if confidence of the NN result is lower than
45 * this threshold, the probability to be a
46 * false-positive is high
47 */
48#define KWD_NN_MIN_ACCEPTABLE_CONFIDENCE 128
49
50#endif /* __KWD_NN_CONFIG_H__ */