source: src/spectral/mfcc.h @ 8affe8c

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

[mfcc] get_scale/power return smpl_t

  • Property mode set to 100644
File size: 4.3 KB
RevLine 
[88199ce]1/*
[b235c0e]2  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
[1c2e186]3                      and Amaury Hazan <ahazan@iua.upf.edu>
[88199ce]4
[1c2e186]5  This file is part of aubio.
[e03f74d]6
[1c2e186]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.
[88199ce]11
[1c2e186]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.
[88199ce]16
[1c2e186]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/>.
[88199ce]19
[73eaa2e]20*/
21
[d99d819]22/** \file
23
[aba718a]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
[dec8b9d]29  in its Auditory Toolbox, available online at the following address (see
30  file mfcc.m):
[aba718a]31
[dec8b9d]32  https://engineering.purdue.edu/~malcolm/interval/1998-010/
[d99d819]33
[8a5c8ba]34  \example spectral/test-mfcc.c
[b8c0685]35
[d99d819]36*/
37
[6f42c16]38#ifndef AUBIO_MFCC_H
39#define AUBIO_MFCC_H
[88199ce]40
[7c6c806d]41#ifdef __cplusplus
[e03f74d]42extern "C"
43{
[7c6c806d]44#endif
45
[d99d819]46/** mfcc object */
47typedef struct _aubio_mfcc_t aubio_mfcc_t;
[88199ce]48
[8708556]49/** create mfcc object
[88199ce]50
[3ac7cb0]51  \param buf_size size of analysis buffer (and length the FFT transform)
[e03f74d]52  \param samplerate audio sampling rate
[c9cebe1]53  \param n_coeffs number of desired coefficients
[d99d819]54  \param n_filters number of desired filters
[7c6c806d]55
[8708556]56*/
[3ac7cb0]57aubio_mfcc_t *new_aubio_mfcc (uint_t buf_size,
[6107f4c]58    uint_t n_filters, uint_t n_coeffs, uint_t samplerate);
[e03f74d]59
[8708556]60/** delete mfcc object
61
62  \param mf mfcc object as returned by new_aubio_mfcc
63
64*/
[e03f74d]65void del_aubio_mfcc (aubio_mfcc_t * mf);
66
[8708556]67/** mfcc object processing
68
69  \param mf mfcc object as returned by new_aubio_mfcc
[3ac7cb0]70  \param in input spectrum (buf_size long)
[e03f74d]71  \param out output mel coefficients buffer (n_coeffs long)
[8708556]72
73*/
[feb694b]74void aubio_mfcc_do (aubio_mfcc_t * mf, const cvec_t * in, fvec_t * out);
[8708556]75
[10fafc2]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 */
[517630f]85uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power);
[10fafc2]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 */
[8affe8c]95smpl_t aubio_mfcc_get_power (aubio_mfcc_t *mf);
[517630f]96
[11c899b]97/** set scaling parameter
98
99  \param mf mfcc object, as returned by new_aubio_mfcc()
100  \param scale Scaling value to apply.
101
102  Scales the output of the filterbank after taking its logarithm and before
103  computing the DCT. Defaults to `1`.
104
105*/
[10fafc2]106uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale);
[11c899b]107
108/** get scaling parameter
109
110  \param mf mfcc object, as returned by new_aubio_mfcc()
111  \return current scaling parameter. Defaults to `1`.
112
113 */
[8affe8c]114smpl_t aubio_mfcc_get_scale (aubio_mfcc_t *mf);
[10fafc2]115
116/** Mel filterbank initialization
117
118  \param mf mfcc object
119  \param fmin start frequency, in Hz
120  \param fmax end frequency, in Hz
121
122  The filterbank will be initialized with bands linearly spaced in the mel
123  scale, from `fmin` to `fmax`.
124
125  See also
126  --------
127
128  aubio_filterbank_set_mel_coeffs()
129
130*/
131uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf,
132        smpl_t fmin, smpl_t fmax);
133
134/** Mel filterbank initialization
135
136  \param mf mfcc object
137  \param fmin start frequency, in Hz
138  \param fmax end frequency, in Hz
139
140  The bank of filters will be initalized to to cover linearly spaced bands in
141  the Htk mel scale, from `fmin` to `fmax`.
142
143  See also
144  --------
145
146  aubio_filterbank_set_mel_coeffs_htk()
147
148*/
149uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf,
150        smpl_t fmin, smpl_t fmax);
151
152/** Mel filterbank initialization (Auditory Toolbox's parameters)
153
154  \param mf mfcc object
155
156  The filter coefficients are built to match exactly Malcolm Slaney's Auditory
157  Toolbox implementation. The number of filters should be 40.
158
159  This is the default filterbank when `mf` was created with `n_filters = 40`.
160
161  See also
162  --------
163
164  aubio_filterbank_set_mel_coeffs_slaney()
165
166*/
[c879811]167uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf);
[517630f]168
[7c6c806d]169#ifdef __cplusplus
170}
171#endif
[88199ce]172
[6f42c16]173#endif /* AUBIO_MFCC_H */
Note: See TracBrowser for help on using the repository browser.