Merge branch 'master' into awhitening
[aubio.git] / src / pitch / pitchschmitt.h
1 /*
2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
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
22
23    Pitch detection using a Schmitt trigger
24
25    This pitch extraction method implements a Schmitt trigger to estimate the
26    period of a signal.
27
28    This file was derived from the tuneit project, written by Mario Lang to
29    detect the fundamental frequency of a sound.
30
31    See http://delysid.org/tuneit.html
32
33    \example pitch/test-pitchschmitt.c
34
35 */
36
37 #ifndef AUBIO_PITCHSCHMITT_H
38 #define AUBIO_PITCHSCHMITT_H
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /** pitch detection object */
45 typedef struct _aubio_pitchschmitt_t aubio_pitchschmitt_t;
46
47 /** execute pitch detection on an input buffer
48
49   \param p pitch detection object as returned by new_aubio_pitchschmitt
50   \param samples_in input signal vector (length as specified at creation time)
51   \param cands_out pitch period estimates, in samples
52
53 */
54 void aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, const fvec_t * samples_in,
55     fvec_t * cands_out);
56
57 /** creation of the pitch detection object
58
59   \param buf_size size of the input buffer to analyse
60
61 */
62 aubio_pitchschmitt_t *new_aubio_pitchschmitt (uint_t buf_size);
63
64 /** deletion of the pitch detection object
65
66   \param p pitch detection object as returned by new_aubio_pitchschmitt
67
68 */
69 void del_aubio_pitchschmitt (aubio_pitchschmitt_t * p);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif /* AUBIO_PITCHSCHMITT_H */