source: src/spectral/mfcc.h @ d66d2ac

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since d66d2ac was 10fafc2, checked in by Paul Brossier <piem@piem.org>, 5 years ago

[mfcc] add slaney (default) and documentation

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
3                      and Amaury Hazan <ahazan@iua.upf.edu>
4
5  This file is part of aubio.
6
7  aubio is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11
12  aubio is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  GNU General Public License for more details.
16
17  You should have received a copy of the GNU General Public License
18  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22/** \file
23
24  Mel-Frequency Cepstrum Coefficients object
25
26  This object computes MFCC coefficients on an input cvec_t.
27
28  The implementation follows the specifications established by Malcolm Slaney
29  in its Auditory Toolbox, available online at the following address (see
30  file mfcc.m):
31
32  https://engineering.purdue.edu/~malcolm/interval/1998-010/
33
34  \example spectral/test-mfcc.c
35
36*/
37
38#ifndef AUBIO_MFCC_H
39#define AUBIO_MFCC_H
40
41#ifdef __cplusplus
42extern "C"
43{
44#endif
45
46/** mfcc object */
47typedef struct _aubio_mfcc_t aubio_mfcc_t;
48
49/** create mfcc object
50
51  \param buf_size size of analysis buffer (and length the FFT transform)
52  \param samplerate audio sampling rate
53  \param n_coeffs number of desired coefficients
54  \param n_filters number of desired filters
55
56*/
57aubio_mfcc_t *new_aubio_mfcc (uint_t buf_size,
58    uint_t n_filters, uint_t n_coeffs, uint_t samplerate);
59
60/** delete mfcc object
61
62  \param mf mfcc object as returned by new_aubio_mfcc
63
64*/
65void del_aubio_mfcc (aubio_mfcc_t * mf);
66
67/** mfcc object processing
68
69  \param mf mfcc object as returned by new_aubio_mfcc
70  \param in input spectrum (buf_size long)
71  \param out output mel coefficients buffer (n_coeffs long)
72
73*/
74void aubio_mfcc_do (aubio_mfcc_t * mf, const cvec_t * in, fvec_t * out);
75
76/** set power parameter
77
78  \param mf mfcc object, as returned by new_aubio_mfcc()
79  \param power Raise norm of the input spectrum norm to this power before
80  computing filterbank.  Defaults to `1`.
81
82  See aubio_filterbank_set_power().
83
84 */
85uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power);
86
87/** get power parameter
88
89  \param mf mfcc object, as returned by new_aubio_mfcc()
90  \return current power parameter. Defaults to `1`.
91
92  See aubio_filterbank_get_power().
93
94 */
95uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf);
96
97uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale);
98uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf);
99
100/** Mel filterbank initialization
101
102  \param mf mfcc object
103  \param fmin start frequency, in Hz
104  \param fmax end frequency, in Hz
105
106  The filterbank will be initialized with bands linearly spaced in the mel
107  scale, from `fmin` to `fmax`.
108
109  See also
110  --------
111
112  aubio_filterbank_set_mel_coeffs()
113
114*/
115uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf,
116        smpl_t fmin, smpl_t fmax);
117
118/** Mel filterbank initialization
119
120  \param mf mfcc object
121  \param fmin start frequency, in Hz
122  \param fmax end frequency, in Hz
123
124  The bank of filters will be initalized to to cover linearly spaced bands in
125  the Htk mel scale, from `fmin` to `fmax`.
126
127  See also
128  --------
129
130  aubio_filterbank_set_mel_coeffs_htk()
131
132*/
133uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf,
134        smpl_t fmin, smpl_t fmax);
135
136/** Mel filterbank initialization (Auditory Toolbox's parameters)
137
138  \param mf mfcc object
139  \param samplerate audio sampling rate, in Hz
140
141  The filter coefficients are built to match exactly Malcolm Slaney's Auditory
142  Toolbox implementation. The number of filters should be 40.
143
144  This is the default filterbank when `mf` was created with `n_filters = 40`.
145
146  See also
147  --------
148
149  aubio_filterbank_set_mel_coeffs_slaney()
150
151*/
152uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf, smpl_t samplerate);
153
154#ifdef __cplusplus
155}
156#endif
157
158#endif /* AUBIO_MFCC_H */
Note: See TracBrowser for help on using the repository browser.