source: src/effects/timestretch.h @ c41637b

feature/cnnfeature/crepefeature/timestretchfix/ffmpeg5
Last change on this file since c41637b was c41637b, checked in by Paul Brossier <piem@piem.org>, 5 years ago

src/effects/timestretch.h: add time stretching object, rubberband implementation

  • Property mode set to 100644
File size: 4.5 KB
Line 
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_TIMESTRETCH_H
22#define AUBIO_TIMESTRETCH_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/** \file
29
30  time stretching object
31
32  ::aubio_timestretch_t can be used to open a source file, read samples from
33  it, time-stretch them, and write out the modified samples.
34
35  The time-stretching factor can be changed at any time using
36  aubio_timestretch_set_stretch().
37
38  A transposition can also be applied and changed at any time with
39  aubio_timestretch_set_transpose().
40
41  \example effects/test-timestretch.c
42
43*/
44
45/** time stretching object */
46typedef struct _aubio_timestretch_t aubio_timestretch_t;
47
48/** execute time stretching on an input signal frame
49
50  \param o time stretching object as returned by new_aubio_timestretch()
51  \param out timestretched output of size [hop_size]
52  \param read number of frames actually wrote out
53
54*/
55void aubio_timestretch_do (aubio_timestretch_t * o, fvec_t * out, uint_t * read);
56
57/** deletion of the time stretching object
58
59  \param o time stretching object as returned by new_aubio_timestretch()
60
61*/
62void del_aubio_timestretch (aubio_timestretch_t * o);
63
64/** creation of the time stretching object
65
66  \param uri path to create the source from
67  \param method time stretching algorithm ("default")
68  \param stretch initial time stretching factor
69  \param hop_size block size at which the frames should be produced
70  \param samplerate sampling rate of the signal
71
72  \return newly created ::aubio_timestretch_t
73
74*/
75aubio_timestretch_t *new_aubio_timestretch (const char_t * uri,
76    const char_t * method, smpl_t stretch, uint_t hop_size, uint_t samplerate);
77
78/** get the latency of the time stretching object, in samples
79
80  \param o time stretching object as returned by ::new_aubio_timestretch()
81
82  \return latency of the time stretching object in samples
83
84*/
85uint_t aubio_timestretch_get_latency (aubio_timestretch_t * o);
86
87/** set the stretching ratio of the time stretching object
88
89  \param o time stretching object as returned by new_aubio_timestretch()
90  \param stretch new time stretching ratio of the time stretching object
91  (should be in the range [0.025; 10.])
92
93  \return 0 if successfull, non-zero otherwise
94
95*/
96uint_t aubio_timestretch_set_stretch (aubio_timestretch_t * o, smpl_t stretch);
97
98/** get the transposition of the time stretching object, in semitones
99
100  \param o time stretching object as returned by ::new_aubio_timestretch()
101
102  \return time stretching ratio of the time stretching object, in the range
103  [0.025; 10.]
104
105*/
106smpl_t aubio_timestretch_get_stretch (aubio_timestretch_t * o);
107
108/** set the pitch scale of the time stretching object
109
110  \param o time stretching object as returned by new_aubio_timestretch()
111  \param pitchscale new pitch scale of the time stretching object
112
113  \return 0 if successfull, non-zero otherwise
114
115*/
116uint_t aubio_timestretch_set_pitchscale (aubio_timestretch_t * o, smpl_t pitchscale);
117
118/** get the pitchscale of the time stretching object
119
120  \param o time stretching object as returned by ::new_aubio_timestretch()
121
122  \return pitchscale of the time stretching object
123
124*/
125smpl_t aubio_timestretch_get_pitchscale (aubio_timestretch_t * o);
126
127/** set the transposition of the time stretching object, in semitones
128
129  \param o time stretching object as returned by new_aubio_timestretch()
130  \param transpose new pitch transposition of the time stretching object, expressed
131  in semitones (should be in the range [-24;+24])
132
133  \return 0 if successfull, non-zero otherwise
134
135*/
136uint_t aubio_timestretch_set_transpose (aubio_timestretch_t * o, smpl_t transpose);
137
138/** get the transposition of the time stretching object, in semitones
139
140  \param o time stretching object as returned by ::new_aubio_timestretch()
141
142  \return transposition of the time stretching object, in semitones
143
144*/
145smpl_t aubio_timestretch_get_transpose (aubio_timestretch_t * o);
146
147#ifdef __cplusplus
148}
149#endif
150
151#endif /* AUBIO_TIMESTRETCH_H */
Note: See TracBrowser for help on using the repository browser.