[80b5bbd] | 1 | /* |
---|
| 2 | Copyright (C) 2016 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 | #ifndef AUBIO_PITCHSHIFT_H |
---|
| 22 | #define AUBIO_PITCHSHIFT_H |
---|
| 23 | |
---|
| 24 | #ifdef __cplusplus |
---|
| 25 | extern "C" { |
---|
| 26 | #endif |
---|
| 27 | |
---|
| 28 | /** \file |
---|
| 29 | |
---|
| 30 | Pitch shifting object |
---|
| 31 | |
---|
[683d52f5] | 32 | ::aubio_pitchshift_t can be used to transpose a stream of blocks of frames. |
---|
[80b5bbd] | 33 | |
---|
| 34 | \example effects/test-pitchshift.c |
---|
| 35 | |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | /** pitch shifting object */ |
---|
| 39 | typedef struct _aubio_pitchshift_t aubio_pitchshift_t; |
---|
| 40 | |
---|
| 41 | /** execute pitch shifting on an input signal frame |
---|
| 42 | |
---|
| 43 | \param o pitch shifting object as returned by new_aubio_pitchshift() |
---|
| 44 | \param in input signal of size [hop_size] |
---|
| 45 | \param out output pitch candidates of size [1] |
---|
| 46 | |
---|
| 47 | */ |
---|
| 48 | void aubio_pitchshift_do (aubio_pitchshift_t * o, const fvec_t * in, fvec_t * out); |
---|
| 49 | |
---|
| 50 | /** deletion of the pitch shifting object |
---|
| 51 | |
---|
| 52 | \param o pitch shifting object as returned by new_aubio_pitchshift() |
---|
| 53 | |
---|
| 54 | */ |
---|
| 55 | void del_aubio_pitchshift (aubio_pitchshift_t * o); |
---|
| 56 | |
---|
| 57 | /** creation of the pitch shifting object |
---|
| 58 | |
---|
[732cf3a] | 59 | \param method set pitch shifting algorithm ("default") |
---|
[a9eb93e] | 60 | \param transpose initial pitch transposition |
---|
[80b5bbd] | 61 | \param hop_size step size between two consecutive analysis instant |
---|
| 62 | \param samplerate sampling rate of the signal |
---|
| 63 | |
---|
| 64 | \return newly created ::aubio_pitchshift_t |
---|
| 65 | |
---|
| 66 | */ |
---|
| 67 | aubio_pitchshift_t *new_aubio_pitchshift (const char_t * method, |
---|
[a9eb93e] | 68 | smpl_t transpose, uint_t hop_size, uint_t samplerate); |
---|
[80b5bbd] | 69 | |
---|
[2d128da] | 70 | /** get the latency of the pitch shifting object, in samples |
---|
| 71 | |
---|
| 72 | \param o pitch shifting object as returned by ::new_aubio_pitchshift() |
---|
| 73 | |
---|
| 74 | \return latency of the pitch shifting object in samples |
---|
| 75 | |
---|
| 76 | */ |
---|
| 77 | uint_t aubio_pitchshift_get_latency (aubio_pitchshift_t * o); |
---|
| 78 | |
---|
[80b5bbd] | 79 | /** set the pitch scale of the pitch shifting object |
---|
| 80 | |
---|
| 81 | \param o pitch shifting object as returned by new_aubio_pitchshift() |
---|
| 82 | \param pitchscale new pitch scale of the pitch shifting object |
---|
| 83 | |
---|
| 84 | \return 0 if successfull, non-zero otherwise |
---|
| 85 | |
---|
| 86 | */ |
---|
| 87 | uint_t aubio_pitchshift_set_pitchscale (aubio_pitchshift_t * o, smpl_t pitchscale); |
---|
| 88 | |
---|
[a6ba2ed1] | 89 | /** get the pitchscale of the pitch shifting object |
---|
[80b5bbd] | 90 | |
---|
| 91 | \param o pitch shifting object as returned by ::new_aubio_pitchshift() |
---|
| 92 | |
---|
| 93 | \return pitchscale of the pitch shifting object |
---|
| 94 | |
---|
| 95 | */ |
---|
| 96 | smpl_t aubio_pitchshift_get_pitchscale (aubio_pitchshift_t * o); |
---|
| 97 | |
---|
[a6ba2ed1] | 98 | /** set the transposition of the pitch shifting object, in semitones |
---|
[80b5bbd] | 99 | |
---|
| 100 | \param o pitch shifting object as returned by new_aubio_pitchshift() |
---|
[a6ba2ed1] | 101 | \param transpose new pitch transposition of the pitch shifting object, expressed |
---|
| 102 | in semitones (should be in the range [-24;+24]) |
---|
[80b5bbd] | 103 | |
---|
| 104 | \return 0 if successfull, non-zero otherwise |
---|
| 105 | |
---|
| 106 | */ |
---|
| 107 | uint_t aubio_pitchshift_set_transpose (aubio_pitchshift_t * o, smpl_t transpose); |
---|
| 108 | |
---|
[a6ba2ed1] | 109 | /** get the transposition of the pitch shifting object, in semitones |
---|
[80b5bbd] | 110 | |
---|
| 111 | \param o pitch shifting object as returned by ::new_aubio_pitchshift() |
---|
| 112 | |
---|
[a6ba2ed1] | 113 | \return transposition of the pitch shifting object, in semitones |
---|
[80b5bbd] | 114 | |
---|
| 115 | */ |
---|
| 116 | smpl_t aubio_pitchshift_get_transpose (aubio_pitchshift_t * o); |
---|
| 117 | |
---|
| 118 | #ifdef __cplusplus |
---|
| 119 | } |
---|
| 120 | #endif |
---|
| 121 | |
---|
| 122 | #endif /* AUBIO_PITCHSHIFT_H */ |
---|