source: src/musicutils.h @ 16965d5

samplertimestretch
Last change on this file since 16965d5 was 24e9b0a, checked in by Paul Brossier <piem@piem.org>, 8 years ago

src/musicutils.h: aubio_level_detection input is a constant

  • Property mode set to 100644
File size: 4.4 KB
RevLine 
[83963b3]1/*
[0683ee2]2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
[83963b3]3
4  This file is part of aubio.
5
6  aubio is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10
11  aubio is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15
16  You should have received a copy of the GNU General Public License
17  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
18
19*/
20
21/** @file
[a17e8c9]22 *  various functions useful in audio signal processing
[83963b3]23 */
24
[6f42c16]25#ifndef AUBIO_MUSICUTILS_H
26#define AUBIO_MUSICUTILS_H
[83963b3]27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
[0683ee2]32/** create window
[e84ab04]33
34  \param window_type type of the window to create
35  \param size length of the window to create (see fvec_set_window())
[0683ee2]36
[e84ab04]37*/
38fvec_t *new_aubio_window (char_t * window_type, uint_t size);
39
40/** set elements of a vector to window coefficients
41
42  \param window exsting ::fvec_t to use
43  \param window_type type of the window to create
44
45  List of available window types: "rectangle", "hamming", "hanning",
46  "hanningz", "blackman", "blackman_harris", "gaussian", "welch", "parzen",
47  "default".
48
49  "default" is equivalent to "hanningz".
50
[83963b3]51  References:
[0683ee2]52
[83963b3]53    - <a href="http://en.wikipedia.org/wiki/Window_function">Window
54function</a> on Wikipedia
55    - Amalia de Götzen, Nicolas Bernardini, and Daniel Arfib. Traditional (?)
56implementations of a phase vocoder: the tricks of the trade. In Proceedings of
57the International Conference on Digital Audio Effects (DAFx-00), pages 37–44,
58Uni- versity of Verona, Italy, 2000.
[2e69640]59  (<a href="http://www.cs.princeton.edu/courses/archive/spr09/cos325/Bernardini.pdf">
60  pdf</a>)
[83963b3]61
[33cd81f]62 */
63uint_t fvec_set_window (fvec_t * window, char_t * window_type);
64
[83963b3]65/** compute the principal argument
66
67  This function maps the input phase to its corresponding value wrapped in the
68range \f$ [-\pi, \pi] \f$.
69
70  \param phase unwrapped phase to map to the unit circle
[0683ee2]71
[83963b3]72  \return equivalent phase wrapped to the unit circle
73
74*/
75smpl_t aubio_unwrap2pi (smpl_t phase);
76
77/** convert frequency bin to midi value */
78smpl_t aubio_bintomidi (smpl_t bin, smpl_t samplerate, smpl_t fftsize);
79
80/** convert midi value to frequency bin */
81smpl_t aubio_miditobin (smpl_t midi, smpl_t samplerate, smpl_t fftsize);
82
83/** convert frequency bin to frequency (Hz) */
84smpl_t aubio_bintofreq (smpl_t bin, smpl_t samplerate, smpl_t fftsize);
85
86/** convert frequency (Hz) to frequency bin */
87smpl_t aubio_freqtobin (smpl_t freq, smpl_t samplerate, smpl_t fftsize);
88
89/** convert frequency (Hz) to midi value (0-128) */
90smpl_t aubio_freqtomidi (smpl_t freq);
91
92/** convert midi value (0-128) to frequency (Hz) */
93smpl_t aubio_miditofreq (smpl_t midi);
94
95/** clean up cached memory at the end of program
[0683ee2]96
[83963b3]97  This function should be used at the end of programs to purge all cached
98  memory. So far it is only useful to clean FFTW's cache.
99
100*/
101void aubio_cleanup (void);
102
103/** zero-crossing rate (ZCR)
104
105  The zero-crossing rate is the number of times a signal changes sign,
106  divided by the length of this signal.
107
108  \param v vector to compute ZCR from
109
110  \return zero-crossing rate of v
111
112*/
113smpl_t aubio_zero_crossing_rate (fvec_t * v);
114
[4b891e9]115/** compute sound level on a linear scale
[5b41ef9]116
117  This gives the average of the square amplitudes.
118
[4b891e9]119  \param v vector to compute level from
[5b41ef9]120
121  \return level of v
122
123*/
[e9bd022]124smpl_t aubio_level_lin (const fvec_t * v);
[5b41ef9]125
[83963b3]126/** compute sound pressure level (SPL) in dB
127
128  This quantity is often wrongly called 'loudness'.
129
[5b41ef9]130  This gives ten times the log10 of the average of the square amplitudes.
131
[83963b3]132  \param v vector to compute dB SPL from
133
134  \return level of v in dB SPL
135
136*/
[e9bd022]137smpl_t aubio_db_spl (const fvec_t * v);
[83963b3]138
139/** check if buffer level in dB SPL is under a given threshold
[0683ee2]140
[83963b3]141  \param v vector to get level from
142  \param threshold threshold in dB SPL
143
144  \return 0 if level is under the given threshold, 1 otherwise
145
146*/
[e9bd022]147uint_t aubio_silence_detection (const fvec_t * v, smpl_t threshold);
[83963b3]148
149/** get buffer level if level >= threshold, 1. otherwise
150
151  \param v vector to get level from
152  \param threshold threshold in dB SPL
153
154  \return level in dB SPL if level >= threshold, 1. otherwise
155
156*/
[24e9b0a]157smpl_t aubio_level_detection (const fvec_t * v, smpl_t threshold);
[83963b3]158
159#ifdef __cplusplus
160}
161#endif
162
[6f42c16]163#endif /* AUBIO_MUSICUTILS_H */
Note: See TracBrowser for help on using the repository browser.