source: src/synth/wavetable.h @ b540b22

feature/cnnfeature/crepefix/ffmpeg5
Last change on this file since b540b22 was 5a02e53, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[doc] plain todo in wavetable_load

  • Property mode set to 100644
File size: 4.5 KB
RevLine 
[dd15573]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
[6f42c16]21#ifndef AUBIO_WAVETABLE_H
22#define AUBIO_WAVETABLE_H
[dd15573]23
24/** \file
25
[2b6139e7]26  Wavetable synthesis.
[dd15573]27
[2b6139e7]28  This file creates a wavetable and plays it at different frequency.
[dd15573]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
[2b6139e7]47  \param hop_size the block size of the new wavetable
[dd15573]48
[2b6139e7]49  \return the newly created aubio_wavetable_t
[dd15573]50
51*/
52aubio_wavetable_t * new_aubio_wavetable(uint_t samplerate, uint_t hop_size);
53
[afe90ee]54/** load source in wavetable
55
[5a02e53]56  TODO: This function is not implemented yet. See new_aubio_sampler() instead.
[313eb2b]57
[afe90ee]58  \param o wavetable, created by new_aubio_wavetable()
59  \param uri the uri of the source to load
60
61  \return 0 if successful, non-zero otherwise
62
63*/
64uint_t aubio_wavetable_load( aubio_wavetable_t * o, const char_t * uri );
65
[dd15573]66/** process wavetable function
67
[2b6139e7]68  \param o wavetable, created by new_aubio_wavetable()
[dd15573]69  \param input input of the wavetable, to be added to the output
70  \param output output of the wavetable
71
[2b6139e7]72This function adds the new samples from the playing wavetable to the output.
[dd15573]73
74If `input` is not NULL and different from `output`, then the samples from `input`
75are added to the output.
76
77*/
[ce3ff2b]78void aubio_wavetable_do ( aubio_wavetable_t * o, const fvec_t * input, fvec_t * output);
[dd15573]79
80/** process wavetable function, multiple channels
81
[2b6139e7]82  \param o wavetable, created by new_aubio_wavetable()
[dd15573]83  \param input input of the wavetable, to be added to the output
84  \param output output of the wavetable
85
[2b6139e7]86This function adds the new samples from the playing wavetable to the output.
[dd15573]87
88If `input` is not NULL and different from `output`, then the samples from `input`
89are added to the output.
90
91*/
[ce3ff2b]92void aubio_wavetable_do_multi ( aubio_wavetable_t * o, const fmat_t * input, fmat_t * output);
[dd15573]93
94/** get current playing state
95
[2b6139e7]96  \param o wavetable, created by new_aubio_wavetable()
[dd15573]97
98  \return 0 if not playing, 1 if playing
99
100*/
[ce3ff2b]101uint_t aubio_wavetable_get_playing ( const aubio_wavetable_t * o );
[dd15573]102
103/** set current playing state
104
[2b6139e7]105  \param o wavetable, created by new_aubio_wavetable()
[dd15573]106  \param playing 0 for not playing, 1 for playing
107
108  \return 0 if successful, 1 otherwise
109
110*/
111uint_t aubio_wavetable_set_playing ( aubio_wavetable_t * o, uint_t playing );
112
113/** play sample from start
114
[2b6139e7]115  \param o wavetable, created by new_aubio_wavetable()
[dd15573]116
117  \return 0 if successful, 1 otherwise
118
119*/
120uint_t aubio_wavetable_play ( aubio_wavetable_t * o );
121
[2b6139e7]122/** stop wavetable
[dd15573]123
[2b6139e7]124  \param o wavetable, created by new_aubio_wavetable()
[dd15573]125
126  \return 0 if successful, 1 otherwise
127
128*/
129uint_t aubio_wavetable_stop ( aubio_wavetable_t * o );
130
131/** set wavetable frequency
132
[2b6139e7]133  \param o wavetable, created by new_aubio_wavetable()
[8750bbd]134  \param freq new frequency value for the wavetable
[dd15573]135
136  \return 0 if successful, 1 otherwise
137
138*/
139uint_t aubio_wavetable_set_freq ( aubio_wavetable_t * o, smpl_t freq );
140
141/** get wavetable frequency
142
[2b6139e7]143  \param o wavetable, created by new_aubio_wavetable()
[dd15573]144
145  \return current frequency, in Hz
146
147*/
[ce3ff2b]148smpl_t aubio_wavetable_get_freq ( const aubio_wavetable_t * o);
[dd15573]149
150/** set wavetable amplitude
151
[2b6139e7]152  \param o wavetable, created by new_aubio_wavetable()
[8750bbd]153  \param amp new amplitude value for the wavetable
[dd15573]154
155  \return 0 if successful, 1 otherwise
156
157*/
158uint_t aubio_wavetable_set_amp ( aubio_wavetable_t * o, smpl_t amp );
159
160/** get wavetable amplitude
161
[2b6139e7]162  \param o wavetable, created by new_aubio_wavetable()
[dd15573]163
164  \return current amplitude
165
166*/
[ce3ff2b]167smpl_t aubio_wavetable_get_amp ( const aubio_wavetable_t * o);
[dd15573]168
[2b6139e7]169/** destroy aubio_wavetable_t object
[dd15573]170
[2b6139e7]171  \param o wavetable, created by new_aubio_wavetable()
[dd15573]172
173*/
174void del_aubio_wavetable( aubio_wavetable_t * o );
175
176#ifdef __cplusplus
177}
178#endif
179
[6f42c16]180#endif /* AUBIO_WAVETABLE_H */
Note: See TracBrowser for help on using the repository browser.