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