aubio  0.5.0-alpha
pitchshift.h
Go to the documentation of this file.
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 
32  ::aubio_pitchshift_t can be used to transpose a stream of blocks of frames.
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,
49  fvec_t * out);
50 
51 /** deletion of the pitch shifting object
52 
53  \param o pitch shifting object as returned by new_aubio_pitchshift()
54 
55 */
57 
58 /** creation of the pitch shifting object
59 
60  \param method set pitch shifting algorithm ("default")
61  \param transpose initial pitch transposition
62  \param hop_size step size between two consecutive analysis instant
63  \param samplerate sampling rate of the signal
64 
65  \return newly created ::aubio_pitchshift_t
66 
67 */
69  smpl_t transpose, uint_t hop_size, uint_t samplerate);
70 
71 /** get the latency of the pitch shifting object, in samples
72 
73  \param o pitch shifting object as returned by ::new_aubio_pitchshift()
74 
75  \return latency of the pitch shifting object in samples
76 
77 */
79 
80 /** set the pitch scale of the pitch shifting object
81 
82  \param o pitch shifting object as returned by new_aubio_pitchshift()
83  \param pitchscale new pitch scale of the pitch shifting object
84 
85  pitchscale is a frequency ratio. It should be in the range [0.25, 4].
86 
87  \return 0 if successful, non-zero otherwise
88 
89 */
91  smpl_t pitchscale);
92 
93 /** get the pitchscale of the pitch shifting object
94 
95  \param o pitch shifting object as returned by ::new_aubio_pitchshift()
96 
97  \return pitchscale of the pitch shifting object
98 
99 */
101 
102 /** set the transposition of the pitch shifting object, in semitones
103 
104  \param o pitch shifting object as returned by new_aubio_pitchshift()
105  \param transpose new pitch transposition of the pitch shifting object,
106  expressed in semitones (should be in the range [-24;+24])
107 
108  \return 0 if successful, non-zero otherwise
109 
110 */
112  smpl_t transpose);
113 
114 /** get the transposition of the pitch shifting object, in semitones
115 
116  \param o pitch shifting object as returned by ::new_aubio_pitchshift()
117 
118  \return transposition of the pitch shifting object, in semitones
119 
120 */
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* AUBIO_PITCHSHIFT_H */
aubio_pitchshift_t * new_aubio_pitchshift(const char_t *method, smpl_t transpose, uint_t hop_size, uint_t samplerate)
creation of the pitch shifting object
struct _aubio_pitchshift_t aubio_pitchshift_t
pitch shifting object
Definition: pitchshift.h:39
float smpl_t
short sample format (32 or 64 bits)
Definition: types.h:41
uint_t aubio_pitchshift_set_pitchscale(aubio_pitchshift_t *o, smpl_t pitchscale)
set the pitch scale of the pitch shifting object
void del_aubio_pitchshift(aubio_pitchshift_t *o)
deletion of the pitch shifting object
uint_t aubio_pitchshift_set_transpose(aubio_pitchshift_t *o, smpl_t transpose)
set the transposition of the pitch shifting object, in semitones
Buffer for real data.
Definition: fvec.h:67
smpl_t aubio_pitchshift_get_pitchscale(aubio_pitchshift_t *o)
get the pitchscale of the pitch shifting object
uint_t aubio_pitchshift_get_latency(aubio_pitchshift_t *o)
get the latency of the pitch shifting object, in samples
smpl_t aubio_pitchshift_get_transpose(aubio_pitchshift_t *o)
get the transposition of the pitch shifting object, in semitones
unsigned int uint_t
unsigned integer
Definition: types.h:60
void aubio_pitchshift_do(aubio_pitchshift_t *o, const fvec_t *in, fvec_t *out)
execute pitch shifting on an input signal frame
char char_t
character
Definition: types.h:64