source: src/spectral/filterbank.h @ 78706cd

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

[filterbank] add docs for norm and power

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[88199ce]1/*
[b235c0e]2  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
[06cae6c]3                      and Amaury Hazan <ahazan@iua.upf.edu>
4
[1c2e186]5  This file is part of aubio.
[06cae6c]6
[1c2e186]7  aubio is free software: you can redistribute it and/or modify
[06cae6c]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
[1c2e186]12  aubio is distributed in the hope that it will be useful,
[06cae6c]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
[1c2e186]18  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
[06cae6c]19
[88199ce]20*/
21
[8708556]22/** \file
23
24  Filterbank object
25
[06cae6c]26  General-purpose spectral filterbank object.
[8708556]27
[b8c0685]28  \example spectral/test-filterbank.c
29
[8708556]30*/
31
[6f42c16]32#ifndef AUBIO_FILTERBANK_H
33#define AUBIO_FILTERBANK_H
[88199ce]34
[7c6c806d]35#ifdef __cplusplus
[3b3b03e]36extern "C"
37{
[7c6c806d]38#endif
39
[b8c0685]40/** filterbank object
41
42  This object stores a matrix of spectral filter coefficients.
43
44 */
[e6c11e3]45typedef struct _aubio_filterbank_t aubio_filterbank_t;
[8708556]46
47/** create filterbank object
48
49  \param n_filters number of filters to create
[554e286]50  \param win_s size of analysis buffer (and length the FFT transform)
[8708556]51
52*/
[3b3b03e]53aubio_filterbank_t *new_aubio_filterbank (uint_t n_filters, uint_t win_s);
[8708556]54
[b276dee]55/** destroy filterbank object
56
[b0706d8]57  \param f filterbank object, as returned by new_aubio_filterbank()
[b276dee]58
59*/
[b0706d8]60void del_aubio_filterbank (aubio_filterbank_t * f);
[b276dee]61
62/** compute filterbank
63
[b0706d8]64  \param f filterbank object, as returned by new_aubio_filterbank()
65  \param in input spectrum containing an input spectrum of length `win_s`
66  \param out output vector containing the energy found in each band, `nfilt` output values
[06cae6c]67
[b276dee]68*/
[feb694b]69void aubio_filterbank_do (aubio_filterbank_t * f, const cvec_t * in, fvec_t * out);
[7c6c806d]70
[b0706d8]71/** return a pointer to the matrix object containing all filter coefficients
[06cae6c]72
[b0706d8]73  \param f filterbank object, as returned by new_aubio_filterbank()
[17961b0]74
75 */
[feb694b]76fmat_t *aubio_filterbank_get_coeffs (const aubio_filterbank_t * f);
[17961b0]77
[33916b8]78/** copy filter coefficients to the filterbank
79
[b0706d8]80  \param f filterbank object, as returned by new_aubio_filterbank()
[554e286]81  \param filters filter bank coefficients to copy from
[33916b8]82
83 */
[feb694b]84uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, const fmat_t * filters);
[33916b8]85
[6b46a4e]86/** set norm parameter
87
88  \param f filterbank object, as returned by new_aubio_filterbank()
89  \param norm `1` to norm the filters, `0` otherwise.
90
91  If set to `0`, the filters will not be normalized. If set to `1`,
92  each filter will be normalized to one. Defaults to `1`.
93
94  This function should be called *before* setting the filters with one of
95  aubio_filterbank_set_triangle_bands(), aubio_filterbank_set_mel_coeffs(),
96  aubio_filterbank_set_mel_coeffs_htk(), or
97  aubio_filterbank_set_mel_coeffs_slaney().
98
99 */
[0e30a12]100uint_t aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm);
101
[6b46a4e]102/** get norm parameter
103
104  \param f filterbank object, as returned by new_aubio_filterbank()
105  \returns `1` if norm is set, `0` otherwise. Defaults to `1`.
106
107 */
[0e30a12]108smpl_t aubio_filterbank_get_norm (aubio_filterbank_t *f);
109
[6b46a4e]110/** set power parameter
111
112  \param f filterbank object, as returned by new_aubio_filterbank()
113  \param power Raise norm of the input spectrum norm to this power before
114  computing filterbank.  Defaults to `1`.
115
116 */
[0e30a12]117uint_t aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power);
118
[6b46a4e]119/** get power parameter
120
121  \param f filterbank object, as returned by new_aubio_filterbank()
122  \return current power parameter. Defaults to `1`.
123
124 */
[0e30a12]125smpl_t aubio_filterbank_get_power (aubio_filterbank_t *f);
126
[7c6c806d]127#ifdef __cplusplus
128}
129#endif
[88199ce]130
[6f42c16]131#endif /* AUBIO_FILTERBANK_H */
Note: See TracBrowser for help on using the repository browser.