source: src/synth/wavetable.h @ 4b7a740

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 4b7a740 was 8750bbd, checked in by Paul Brossier <piem@piem.org>, 10 years ago

src/synth/wavetable.h: improve documentation

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*
2  Copyright (C) 2003-2013 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_SYNTH_WAVETABLE_H
22#define _AUBIO_SYNTH_WAVETABLE_H
23
24/** \file
25
26  Load and play sound files.
27
28  This file loads a sample and gets ready to play it.
29
30  The `_do` function adds the new samples to the input, and write the result as
31  the output.
32
33  \example synth/test-wavetable.c
34
35*/
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/** wavetable object */
42typedef struct _aubio_wavetable_t aubio_wavetable_t;
43
44/** create new wavetable object
45
46  \param samplerate the sampling rate of the new wavetable
47
48  \return the newly created ::aubio_wavetable_t
49
50*/
51aubio_wavetable_t * new_aubio_wavetable(uint_t samplerate, uint_t hop_size);
52
53/** load source in wavetable
54
55  \param o wavetable, created by ::new_aubio_wavetable
56  \param uri the uri of the source to load
57
58  \return 0 if successful, non-zero otherwise
59
60*/
61uint_t aubio_wavetable_load( aubio_wavetable_t * o, char_t * uri );
62
63/** process wavetable function
64
65  \param o wavetable, created by ::new_aubio_wavetable
66  \param input input of the wavetable, to be added to the output
67  \param output output of the wavetable
68
69This function adds the new samples from the playing sample to the output.
70
71If `input` is not NULL and different from `output`, then the samples from `input`
72are added to the output.
73
74*/
75void aubio_wavetable_do ( aubio_wavetable_t * o, fvec_t * input, fvec_t * output);
76
77/** process wavetable function, multiple channels
78
79  \param o wavetable, created by ::new_aubio_wavetable
80  \param input input of the wavetable, to be added to the output
81  \param output output of the wavetable
82
83This function adds the new samples from the playing sample to the output.
84
85If `input` is not NULL and different from `output`, then the samples from `input`
86are added to the output.
87
88*/
89void aubio_wavetable_do_multi ( aubio_wavetable_t * o, fmat_t * input, fmat_t * output);
90
91/** get current playing state
92
93  \param o wavetable, created by ::new_aubio_wavetable
94
95  \return 0 if not playing, 1 if playing
96
97*/
98uint_t aubio_wavetable_get_playing ( aubio_wavetable_t * o );
99
100/** set current playing state
101
102  \param o wavetable, created by ::new_aubio_wavetable
103  \param playing 0 for not playing, 1 for playing
104
105  \return 0 if successful, 1 otherwise
106
107*/
108uint_t aubio_wavetable_set_playing ( aubio_wavetable_t * o, uint_t playing );
109
110/** play sample from start
111
112  \param o wavetable, created by ::new_aubio_wavetable
113
114  \return 0 if successful, 1 otherwise
115
116*/
117uint_t aubio_wavetable_play ( aubio_wavetable_t * o );
118
119/** stop sample
120
121  \param o wavetable, created by ::new_aubio_wavetable
122
123  \return 0 if successful, 1 otherwise
124
125*/
126uint_t aubio_wavetable_stop ( aubio_wavetable_t * o );
127
128/** set wavetable frequency
129
130  \param o wavetable, created by ::new_aubio_wavetable
131  \param freq new frequency value for the wavetable
132
133  \return 0 if successful, 1 otherwise
134
135*/
136uint_t aubio_wavetable_set_freq ( aubio_wavetable_t * o, smpl_t freq );
137
138/** get wavetable frequency
139
140  \param o wavetable, created by ::new_aubio_wavetable
141
142  \return current frequency, in Hz
143
144*/
145smpl_t aubio_wavetable_get_freq ( aubio_wavetable_t * o);
146
147/** set wavetable amplitude
148
149  \param o wavetable, created by ::new_aubio_wavetable
150  \param amp new amplitude value for the wavetable
151
152  \return 0 if successful, 1 otherwise
153
154*/
155uint_t aubio_wavetable_set_amp ( aubio_wavetable_t * o, smpl_t amp );
156
157/** get wavetable amplitude
158
159  \param o wavetable, created by ::new_aubio_wavetable
160
161  \return current amplitude
162
163*/
164smpl_t aubio_wavetable_get_amp ( aubio_wavetable_t * o);
165
166/** destroy ::aubio_wavetable_t object
167
168  \param o wavetable, created by ::new_aubio_wavetable
169
170*/
171void del_aubio_wavetable( aubio_wavetable_t * o );
172
173#ifdef __cplusplus
174}
175#endif
176
177#endif /* _AUBIO_SYNTH_WAVETABLE_H */
Note: See TracBrowser for help on using the repository browser.