[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. |
---|
[6d4ec49] | 17 | */ |
---|
[96fb8ad] | 18 | |
---|
| 19 | #ifndef PITCHAUTOTCORR_H |
---|
| 20 | #define PITCHAUTOTCORR_H |
---|
| 21 | |
---|
| 22 | #ifdef __cplusplus |
---|
| 23 | extern "C" { |
---|
| 24 | #endif |
---|
| 25 | |
---|
[f44b111] | 26 | /** \file |
---|
| 27 | |
---|
[6d4ec49] | 28 | Generic method for pitch detection |
---|
[f44b111] | 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 { |
---|
[6d4ec49] | 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 { |
---|
[6d4ec49] | 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 |
---|
[6d4ec49] | 56 | |
---|
[f44b111] | 57 | \param p pitch detection object as returned by new_aubio_pitchdetection |
---|
[6d4ec49] | 58 | \param ibuf input signal of length hopsize |
---|
| 59 | |
---|
[f44b111] | 60 | */ |
---|
[1294862] | 61 | smpl_t aubio_pitchdetection_do (aubio_pitchdetection_t * p, fvec_t * ibuf); |
---|
[96fb8ad] | 62 | |
---|
[f44b111] | 63 | /** change yin or yinfft tolerance threshold |
---|
[6d4ec49] | 64 | |
---|
[f44b111] | 65 | default is 0.15 for yin and 0.85 for yinfft |
---|
[6d4ec49] | 66 | |
---|
[f44b111] | 67 | */ |
---|
[f8a38c5] | 68 | void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres); |
---|
[f44b111] | 69 | |
---|
| 70 | /** deletion of the pitch detection object |
---|
[6d4ec49] | 71 | |
---|
[f44b111] | 72 | \param p pitch detection object as returned by new_aubio_pitchdetection |
---|
[6d4ec49] | 73 | |
---|
[f44b111] | 74 | */ |
---|
[96fb8ad] | 75 | void del_aubio_pitchdetection(aubio_pitchdetection_t * p); |
---|
| 76 | |
---|
[f44b111] | 77 | /** creation of the pitch detection object |
---|
[6d4ec49] | 78 | |
---|
| 79 | \param bufsize size of the input buffer to analyse |
---|
| 80 | \param hopsize step size between two consecutive analysis instant |
---|
[f44b111] | 81 | \param channels number of channels to analyse |
---|
[6d4ec49] | 82 | \param samplerate sampling rate of the signal |
---|
[f44b111] | 83 | \param type set pitch detection algorithm |
---|
| 84 | \param mode set pitch units for output |
---|
[6d4ec49] | 85 | |
---|
[f44b111] | 86 | */ |
---|
[6d4ec49] | 87 | aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize, |
---|
| 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 | |
---|
[6d4ec49] | 98 | #endif /*PITCHDETECTION_H*/ |
---|