andrew@0
|
1 /*
|
andrew@0
|
2 Copyright (C) 2003 Paul Brossier
|
andrew@0
|
3
|
andrew@0
|
4 This program is free software; you can redistribute it and/or modify
|
andrew@0
|
5 it under the terms of the GNU General Public License as published by
|
andrew@0
|
6 the Free Software Foundation; either version 2 of the License, or
|
andrew@0
|
7 (at your option) any later version.
|
andrew@0
|
8
|
andrew@0
|
9 This program is distributed in the hope that it will be useful,
|
andrew@0
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
andrew@0
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
andrew@0
|
12 GNU General Public License for more details.
|
andrew@0
|
13
|
andrew@0
|
14 You should have received a copy of the GNU General Public License
|
andrew@0
|
15 along with this program; if not, write to the Free Software
|
andrew@0
|
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
andrew@0
|
17 */
|
andrew@0
|
18
|
andrew@0
|
19 #ifndef PITCHAUTOTCORR_H
|
andrew@0
|
20 #define PITCHAUTOTCORR_H
|
andrew@0
|
21
|
andrew@0
|
22 #ifdef __cplusplus
|
andrew@0
|
23 extern "C" {
|
andrew@0
|
24 #endif
|
andrew@0
|
25
|
andrew@0
|
26 /** \file
|
andrew@0
|
27
|
andrew@0
|
28 Generic method for pitch detection
|
andrew@0
|
29
|
andrew@0
|
30 This file creates the objects required for the computation of the selected
|
andrew@0
|
31 pitch detection algorithm and output the results, in midi note or Hz.
|
andrew@0
|
32
|
andrew@0
|
33 */
|
andrew@0
|
34
|
andrew@0
|
35 /** pitch detection algorithm */
|
andrew@0
|
36 typedef enum {
|
andrew@0
|
37 aubio_pitch_yin, /**< YIN algorithm */
|
andrew@0
|
38 aubio_pitch_mcomb, /**< Multi-comb filter */
|
andrew@0
|
39 aubio_pitch_schmitt, /**< Schmitt trigger */
|
andrew@0
|
40 aubio_pitch_fcomb, /**< Fast comb filter */
|
andrew@0
|
41 aubio_pitch_yinfft /**< Spectral YIN */
|
andrew@0
|
42 } aubio_pitchdetection_type;
|
andrew@0
|
43
|
andrew@0
|
44 /** pitch detection output mode */
|
andrew@0
|
45 typedef enum {
|
andrew@0
|
46 aubio_pitchm_freq, /**< Frequency (Hz) */
|
andrew@0
|
47 aubio_pitchm_midi, /**< MIDI note (0.,127) */
|
andrew@0
|
48 aubio_pitchm_cent, /**< Cent */
|
andrew@0
|
49 aubio_pitchm_bin /**< Frequency bin (0,bufsize) */
|
andrew@0
|
50 } aubio_pitchdetection_mode;
|
andrew@0
|
51
|
andrew@0
|
52 /** pitch detection object */
|
andrew@0
|
53 typedef struct _aubio_pitchdetection_t aubio_pitchdetection_t;
|
andrew@0
|
54
|
andrew@0
|
55 /** execute pitch detection on an input signal frame
|
andrew@0
|
56
|
andrew@0
|
57 \param p pitch detection object as returned by new_aubio_pitchdetection
|
andrew@0
|
58 \param ibuf input signal of length hopsize
|
andrew@0
|
59
|
andrew@0
|
60 */
|
andrew@0
|
61 smpl_t aubio_pitchdetection(aubio_pitchdetection_t * p, fvec_t * ibuf);
|
andrew@0
|
62
|
andrew@0
|
63 /** change yin or yinfft tolerance threshold
|
andrew@0
|
64
|
andrew@0
|
65 default is 0.15 for yin and 0.85 for yinfft
|
andrew@0
|
66
|
andrew@0
|
67 */
|
andrew@0
|
68 void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres);
|
andrew@0
|
69
|
andrew@0
|
70 /** deletion of the pitch detection object
|
andrew@0
|
71
|
andrew@0
|
72 \param p pitch detection object as returned by new_aubio_pitchdetection
|
andrew@0
|
73
|
andrew@0
|
74 */
|
andrew@0
|
75 void del_aubio_pitchdetection(aubio_pitchdetection_t * p);
|
andrew@0
|
76
|
andrew@0
|
77 /** creation of the pitch detection object
|
andrew@0
|
78
|
andrew@0
|
79 \param bufsize size of the input buffer to analyse
|
andrew@0
|
80 \param hopsize step size between two consecutive analysis instant
|
andrew@0
|
81 \param channels number of channels to analyse
|
andrew@0
|
82 \param samplerate sampling rate of the signal
|
andrew@0
|
83 \param type set pitch detection algorithm
|
andrew@0
|
84 \param mode set pitch units for output
|
andrew@0
|
85
|
andrew@0
|
86 */
|
andrew@0
|
87 aubio_pitchdetection_t * new_aubio_pitchdetection(ba_uint_t bufsize,
|
andrew@0
|
88 ba_uint_t hopsize,
|
andrew@0
|
89 ba_uint_t channels,
|
andrew@0
|
90 ba_uint_t samplerate,
|
andrew@0
|
91 aubio_pitchdetection_type type,
|
andrew@0
|
92 aubio_pitchdetection_mode mode);
|
andrew@0
|
93
|
andrew@0
|
94 #ifdef __cplusplus
|
andrew@0
|
95 }
|
andrew@0
|
96 #endif
|
andrew@0
|
97
|
andrew@0
|
98 #endif /*PITCHDETECTION_H*/
|