Skip to content

Commit 0a3faf8

Browse files
authored
Merge pull request #7959 from jepler/synthio-bend-pan-ring
Synthio: next round of features
2 parents db8bd56 + 585b1c2 commit 0a3faf8

File tree

33 files changed

+971
-931
lines changed

33 files changed

+971
-931
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,6 @@
338338
[submodule "frozen/circuitpython-pcf85063a"]
339339
path = frozen/circuitpython-pcf85063a
340340
url = https://github.com/bablokb/circuitpython-pcf85063a
341+
[submodule "frozen/Adafruit_CircuitPython_Wave"]
342+
path = frozen/Adafruit_CircuitPython_Wave
343+
url = http://github.com/adafruit/Adafruit_CircuitPython_Wave.git

ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C
1111
LONGINT_IMPL = MPZ
1212

1313
CIRCUITPY__EVE = 1
14+
CIRCUITPY_SYNTHIO = 0

ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
1111
LONGINT_IMPL = MPZ
1212

1313
CIRCUITPY__EVE = 1
14+
CIRCUITPY_SYNTHIO = 0

ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
1111
LONGINT_IMPL = MPZ
1212

1313
CIRCUITPY__EVE = 1
14+
CIRCUITPY_SYNTHIO = 0

shared-bindings/synthio/MidiTrack.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,15 @@ STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_a
8888
mp_buffer_info_t bufinfo;
8989
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ);
9090

91-
mp_buffer_info_t bufinfo_waveform;
92-
synthio_synth_parse_waveform(&bufinfo_waveform, args[ARG_waveform].u_obj);
93-
9491
synthio_miditrack_obj_t *self = m_new_obj(synthio_miditrack_obj_t);
9592
self->base.type = &synthio_miditrack_type;
9693

9794
common_hal_synthio_miditrack_construct(self,
9895
(uint8_t *)bufinfo.buf, bufinfo.len,
9996
args[ARG_tempo].u_int,
10097
args[ARG_sample_rate].u_int,
101-
bufinfo_waveform.buf,
102-
bufinfo_waveform.len / 2,
98+
args[ARG_waveform].u_obj,
99+
mp_const_none,
103100
args[ARG_envelope].u_obj
104101
);
105102

shared-bindings/synthio/MidiTrack.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@
2727
#pragma once
2828

2929
#include "shared-module/synthio/MidiTrack.h"
30+
#include "py/obj.h"
3031

3132
extern const mp_obj_type_t synthio_miditrack_type;
3233

33-
void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self,
34-
const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_len,
35-
mp_obj_t envelope);
34+
void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope_obj);
3635

3736
void common_hal_synthio_miditrack_deinit(synthio_miditrack_obj_t *self);
3837
bool common_hal_synthio_miditrack_deinited(synthio_miditrack_obj_t *self);

shared-bindings/synthio/Note.c

Lines changed: 143 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,45 @@
3030
#include "py/objproperty.h"
3131
#include "py/runtime.h"
3232
#include "shared-bindings/util.h"
33+
#include "shared-bindings/synthio/__init__.h"
3334
#include "shared-bindings/synthio/Note.h"
3435
#include "shared-module/synthio/Note.h"
3536

3637
static const mp_arg_t note_properties[] = {
3738
{ MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } },
38-
{ MP_QSTR_amplitude, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } },
39+
{ MP_QSTR_panning, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } },
3940
{ MP_QSTR_tremolo_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
4041
{ MP_QSTR_tremolo_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
41-
{ MP_QSTR_vibrato_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
42-
{ MP_QSTR_vibrato_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
42+
{ MP_QSTR_bend_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
43+
{ MP_QSTR_bend_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
44+
{ MP_QSTR_bend_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = (mp_obj_t)MP_ROM_PTR(&bend_mode_VIBRATO_obj) } },
4345
{ MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } },
4446
{ MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } },
47+
{ MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } },
48+
{ MP_QSTR_ring_frequency, MP_ARG_OBJ, {.u_obj = NULL } },
49+
{ MP_QSTR_ring_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } },
4550
};
4651
//| class Note:
4752
//| def __init__(
4853
//| self,
4954
//| *,
5055
//| frequency: float,
51-
//| amplitude: float = 1.0,
56+
//| panning: float = 0.0,
5257
//| waveform: Optional[ReadableBuffer] = None,
5358
//| envelope: Optional[Envelope] = None,
5459
//| tremolo_depth: float = 0.0,
5560
//| tremolo_rate: float = 0.0,
56-
//| vibrato_depth: float = 0.0,
57-
//| vibrato_rate: float = 0.0,
61+
//| bend_depth: float = 0.0,
62+
//| bend_rate: float = 0.0,
63+
//| bend_mode: "BendMode" = BendMode.VIBRATO,
5864
//| ) -> None:
59-
//| """Construct a Note object, with a frequency in Hz, and optional amplitude (volume), waveform, envelope, tremolo (volume change) and vibrato (frequency change).
65+
//| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change).
6066
//|
6167
//| If waveform or envelope are `None` the synthesizer object's default waveform or envelope are used.
6268
//|
6369
//| If the same Note object is played on multiple Synthesizer objects, the result is undefined.
6470
//| """
6571
STATIC mp_obj_t synthio_note_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
66-
enum { ARG_frequency, ARG_amplitude, ARG_waveform, ARG_envelope, ARG_tremolo_rate, ARG_tremolo_depth, ARG_vibrato_rate, ARG_vibrato_depth };
6772
mp_arg_val_t args[MP_ARRAY_SIZE(note_properties)];
6873
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(note_properties), note_properties, args);
6974

@@ -98,23 +103,46 @@ MP_PROPERTY_GETSET(synthio_note_frequency_obj,
98103
(mp_obj_t)&synthio_note_get_frequency_obj,
99104
(mp_obj_t)&synthio_note_set_frequency_obj);
100105

101-
//| amplitude: float
102-
//| """The base amplitude of the note, from 0 to 1"""
103-
STATIC mp_obj_t synthio_note_get_amplitude(mp_obj_t self_in) {
106+
//| filter: bool
107+
//| """True if the note should be processed via the synthesizer's FIR filter."""
108+
STATIC mp_obj_t synthio_note_get_filter(mp_obj_t self_in) {
104109
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
105-
return mp_obj_new_float(common_hal_synthio_note_get_amplitude(self));
110+
return mp_obj_new_bool(common_hal_synthio_note_get_filter(self));
106111
}
107-
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_amplitude_obj, synthio_note_get_amplitude);
112+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_filter_obj, synthio_note_get_filter);
108113

109-
STATIC mp_obj_t synthio_note_set_amplitude(mp_obj_t self_in, mp_obj_t arg) {
114+
STATIC mp_obj_t synthio_note_set_filter(mp_obj_t self_in, mp_obj_t arg) {
110115
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
111-
common_hal_synthio_note_set_amplitude(self, mp_obj_get_float(arg));
116+
common_hal_synthio_note_set_filter(self, mp_obj_is_true(arg));
112117
return mp_const_none;
113118
}
114-
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_amplitude_obj, synthio_note_set_amplitude);
115-
MP_PROPERTY_GETSET(synthio_note_amplitude_obj,
116-
(mp_obj_t)&synthio_note_get_amplitude_obj,
117-
(mp_obj_t)&synthio_note_set_amplitude_obj);
119+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_filter_obj, synthio_note_set_filter);
120+
MP_PROPERTY_GETSET(synthio_note_filter_obj,
121+
(mp_obj_t)&synthio_note_get_filter_obj,
122+
(mp_obj_t)&synthio_note_set_filter_obj);
123+
124+
//| panning: float
125+
//| """Defines the channel(s) in which the note appears.
126+
//|
127+
//| -1 is left channel only, 0 is both channels, and 1 is right channel.
128+
//| For fractional values, the note plays at full amplitude in one channel
129+
//| and partial amplitude in the other channel. For instance -.5 plays at full
130+
//| amplitude in the left channel and 1/2 amplitude in the right channel."""
131+
STATIC mp_obj_t synthio_note_get_panning(mp_obj_t self_in) {
132+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
133+
return mp_obj_new_float(common_hal_synthio_note_get_panning(self));
134+
}
135+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_panning_obj, synthio_note_get_panning);
136+
137+
STATIC mp_obj_t synthio_note_set_panning(mp_obj_t self_in, mp_obj_t arg) {
138+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
139+
common_hal_synthio_note_set_panning(self, mp_obj_get_float(arg));
140+
return mp_const_none;
141+
}
142+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_panning_obj, synthio_note_set_panning);
143+
MP_PROPERTY_GETSET(synthio_note_panning_obj,
144+
(mp_obj_t)&synthio_note_get_panning_obj,
145+
(mp_obj_t)&synthio_note_set_panning_obj);
118146

119147

120148
//| tremolo_depth: float
@@ -158,46 +186,67 @@ MP_PROPERTY_GETSET(synthio_note_tremolo_rate_obj,
158186
(mp_obj_t)&synthio_note_get_tremolo_rate_obj,
159187
(mp_obj_t)&synthio_note_set_tremolo_rate_obj);
160188

161-
//| vibrato_depth: float
162-
//| """The vibrato depth of the note, from 0 to 1
163189
//|
164-
//| A depth of 0 disables vibrato. A depth of 1 corresponds to a vibrato of ±1
165-
//| octave. A depth of (1/12) = 0.833 corresponds to a vibrato of ±1 semitone,
190+
//| bend_mode: BendMode
191+
//| """The type of bend operation"""
192+
STATIC mp_obj_t synthio_note_get_bend_mode(mp_obj_t self_in) {
193+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
194+
return cp_enum_find(&synthio_bend_mode_type, common_hal_synthio_note_get_bend_mode(self));
195+
}
196+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_mode_obj, synthio_note_get_bend_mode);
197+
198+
STATIC mp_obj_t synthio_note_set_bend_mode(mp_obj_t self_in, mp_obj_t arg) {
199+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
200+
common_hal_synthio_note_set_bend_mode(self, cp_enum_value(&synthio_bend_mode_type, arg, MP_QSTR_bend_mode));
201+
return mp_const_none;
202+
}
203+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_mode_obj, synthio_note_set_bend_mode);
204+
MP_PROPERTY_GETSET(synthio_note_bend_mode_obj,
205+
(mp_obj_t)&synthio_note_get_bend_mode_obj,
206+
(mp_obj_t)&synthio_note_set_bend_mode_obj);
207+
208+
//
209+
//|
210+
//| bend_depth: float
211+
//| """The bend depth of the note, from -1 to +1
212+
//|
213+
//| A depth of 0 disables bend. A depth of 1 corresponds to a bend of 1
214+
//| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone,
166215
//| and a depth of .00833 corresponds to one musical cent.
167216
//| """
168-
STATIC mp_obj_t synthio_note_get_vibrato_depth(mp_obj_t self_in) {
217+
STATIC mp_obj_t synthio_note_get_bend_depth(mp_obj_t self_in) {
169218
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
170-
return mp_obj_new_float(common_hal_synthio_note_get_vibrato_depth(self));
219+
return mp_obj_new_float(common_hal_synthio_note_get_bend_depth(self));
171220
}
172-
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_vibrato_depth_obj, synthio_note_get_vibrato_depth);
221+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_depth_obj, synthio_note_get_bend_depth);
173222

174-
STATIC mp_obj_t synthio_note_set_vibrato_depth(mp_obj_t self_in, mp_obj_t arg) {
223+
STATIC mp_obj_t synthio_note_set_bend_depth(mp_obj_t self_in, mp_obj_t arg) {
175224
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
176-
common_hal_synthio_note_set_vibrato_depth(self, mp_obj_get_float(arg));
225+
common_hal_synthio_note_set_bend_depth(self, mp_obj_get_float(arg));
177226
return mp_const_none;
178227
}
179-
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_vibrato_depth_obj, synthio_note_set_vibrato_depth);
180-
MP_PROPERTY_GETSET(synthio_note_vibrato_depth_obj,
181-
(mp_obj_t)&synthio_note_get_vibrato_depth_obj,
182-
(mp_obj_t)&synthio_note_set_vibrato_depth_obj);
183-
184-
//| vibrato_rate: float
185-
//| """The vibrato rate of the note, in Hz."""
186-
STATIC mp_obj_t synthio_note_get_vibrato_rate(mp_obj_t self_in) {
228+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_depth_obj, synthio_note_set_bend_depth);
229+
MP_PROPERTY_GETSET(synthio_note_bend_depth_obj,
230+
(mp_obj_t)&synthio_note_get_bend_depth_obj,
231+
(mp_obj_t)&synthio_note_set_bend_depth_obj);
232+
233+
//| bend_rate: float
234+
//| """The bend rate of the note, in Hz."""
235+
STATIC mp_obj_t synthio_note_get_bend_rate(mp_obj_t self_in) {
187236
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
188-
return mp_obj_new_float(common_hal_synthio_note_get_vibrato_rate(self));
237+
return mp_obj_new_float(common_hal_synthio_note_get_bend_rate(self));
189238
}
190-
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_vibrato_rate_obj, synthio_note_get_vibrato_rate);
239+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_rate_obj, synthio_note_get_bend_rate);
191240

192-
STATIC mp_obj_t synthio_note_set_vibrato_rate(mp_obj_t self_in, mp_obj_t arg) {
241+
STATIC mp_obj_t synthio_note_set_bend_rate(mp_obj_t self_in, mp_obj_t arg) {
193242
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
194-
common_hal_synthio_note_set_vibrato_rate(self, mp_obj_get_float(arg));
243+
common_hal_synthio_note_set_bend_rate(self, mp_obj_get_float(arg));
195244
return mp_const_none;
196245
}
197-
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_vibrato_rate_obj, synthio_note_set_vibrato_rate);
198-
MP_PROPERTY_GETSET(synthio_note_vibrato_rate_obj,
199-
(mp_obj_t)&synthio_note_get_vibrato_rate_obj,
200-
(mp_obj_t)&synthio_note_set_vibrato_rate_obj);
246+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_rate_obj, synthio_note_set_bend_rate);
247+
MP_PROPERTY_GETSET(synthio_note_bend_rate_obj,
248+
(mp_obj_t)&synthio_note_get_bend_rate_obj,
249+
(mp_obj_t)&synthio_note_set_bend_rate_obj);
201250

202251
//| waveform: Optional[ReadableBuffer]
203252
//| """The waveform of this note. Setting the waveform to a buffer of a different size resets the note's phase."""
@@ -237,20 +286,67 @@ MP_PROPERTY_GETSET(synthio_note_envelope_obj,
237286
(mp_obj_t)&synthio_note_get_envelope_obj,
238287
(mp_obj_t)&synthio_note_set_envelope_obj);
239288

289+
//| ring_frequency: float
290+
//| """The ring frequency of the note, in Hz. Zero disables.
291+
//|
292+
//| For ring to take effect, both ``ring_frequency`` and ``ring_waveform`` must be set."""
293+
STATIC mp_obj_t synthio_note_get_ring_frequency(mp_obj_t self_in) {
294+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
295+
return mp_obj_new_float(common_hal_synthio_note_get_ring_frequency(self));
296+
}
297+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_ring_frequency_obj, synthio_note_get_ring_frequency);
298+
299+
STATIC mp_obj_t synthio_note_set_ring_frequency(mp_obj_t self_in, mp_obj_t arg) {
300+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
301+
common_hal_synthio_note_set_ring_frequency(self, mp_obj_get_float(arg));
302+
return mp_const_none;
303+
}
304+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_ring_frequency_obj, synthio_note_set_ring_frequency);
305+
MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj,
306+
(mp_obj_t)&synthio_note_get_ring_frequency_obj,
307+
(mp_obj_t)&synthio_note_set_ring_frequency_obj);
308+
309+
//| ring_waveform: Optional[ReadableBuffer]
310+
//| """The ring waveform of this note. Setting the ring_waveform to a buffer of a different size resets the note's phase.
311+
//|
312+
//| For ring to take effect, both ``ring_frequency`` and ``ring_waveform`` must be set."""
313+
//|
314+
STATIC mp_obj_t synthio_note_get_ring_waveform(mp_obj_t self_in) {
315+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
316+
return common_hal_synthio_note_get_ring_waveform_obj(self);
317+
}
318+
MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_ring_waveform_obj, synthio_note_get_ring_waveform);
319+
320+
STATIC mp_obj_t synthio_note_set_ring_waveform(mp_obj_t self_in, mp_obj_t arg) {
321+
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
322+
common_hal_synthio_note_set_ring_waveform(self, arg);
323+
return mp_const_none;
324+
}
325+
MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_ring_waveform_obj, synthio_note_set_ring_waveform);
326+
MP_PROPERTY_GETSET(synthio_note_ring_waveform_obj,
327+
(mp_obj_t)&synthio_note_get_ring_waveform_obj,
328+
(mp_obj_t)&synthio_note_set_ring_waveform_obj);
329+
330+
331+
240332
static void note_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
241333
(void)kind;
242334
properties_print_helper(print, self_in, note_properties, MP_ARRAY_SIZE(note_properties));
243335
}
244336

245337
STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = {
246338
{ MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&synthio_note_frequency_obj) },
247-
{ MP_ROM_QSTR(MP_QSTR_amplitude), MP_ROM_PTR(&synthio_note_amplitude_obj) },
339+
{ MP_ROM_QSTR(MP_QSTR_filter), MP_ROM_PTR(&synthio_note_filter_obj) },
340+
{ MP_ROM_QSTR(MP_QSTR_panning), MP_ROM_PTR(&synthio_note_panning_obj) },
248341
{ MP_ROM_QSTR(MP_QSTR_waveform), MP_ROM_PTR(&synthio_note_waveform_obj) },
249342
{ MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_note_envelope_obj) },
250343
{ MP_ROM_QSTR(MP_QSTR_tremolo_depth), MP_ROM_PTR(&synthio_note_tremolo_depth_obj) },
251344
{ MP_ROM_QSTR(MP_QSTR_tremolo_rate), MP_ROM_PTR(&synthio_note_tremolo_rate_obj) },
252-
{ MP_ROM_QSTR(MP_QSTR_vibrato_depth), MP_ROM_PTR(&synthio_note_vibrato_depth_obj) },
253-
{ MP_ROM_QSTR(MP_QSTR_vibrato_rate), MP_ROM_PTR(&synthio_note_vibrato_rate_obj) },
345+
{ MP_ROM_QSTR(MP_QSTR_bend_depth), MP_ROM_PTR(&synthio_note_bend_depth_obj) },
346+
{ MP_ROM_QSTR(MP_QSTR_bend_rate), MP_ROM_PTR(&synthio_note_bend_rate_obj) },
347+
{ MP_ROM_QSTR(MP_QSTR_bend_mode), MP_ROM_PTR(&synthio_note_bend_mode_obj) },
348+
{ MP_ROM_QSTR(MP_QSTR_ring_frequency), MP_ROM_PTR(&synthio_note_ring_frequency_obj) },
349+
{ MP_ROM_QSTR(MP_QSTR_ring_waveform), MP_ROM_PTR(&synthio_note_ring_waveform_obj) },
254350
};
255351
STATIC MP_DEFINE_CONST_DICT(synthio_note_locals_dict, synthio_note_locals_dict_table);
256352

shared-bindings/synthio/Note.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,40 @@
44

55
typedef struct synthio_note_obj synthio_note_obj_t;
66
extern const mp_obj_type_t synthio_note_type;
7+
typedef enum synthio_bend_mode_e synthio_bend_mode_t;
78

89
mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self);
910
void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value);
1011

11-
mp_float_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self);
12-
void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_float_t value);
12+
bool common_hal_synthio_note_get_filter(synthio_note_obj_t *self);
13+
void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, bool value);
14+
15+
mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self);
16+
void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_float_t value);
17+
18+
mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self);
19+
void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_float_t value);
1320

1421
mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self);
1522
void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float_t value);
1623

1724
mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self);
1825
void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value);
1926

20-
mp_float_t common_hal_synthio_note_get_vibrato_rate(synthio_note_obj_t *self);
21-
void common_hal_synthio_note_set_vibrato_rate(synthio_note_obj_t *self, mp_float_t value);
27+
synthio_bend_mode_t common_hal_synthio_note_get_bend_mode(synthio_note_obj_t *self);
28+
void common_hal_synthio_note_set_bend_mode(synthio_note_obj_t *self, synthio_bend_mode_t value);
2229

23-
mp_float_t common_hal_synthio_note_get_vibrato_depth(synthio_note_obj_t *self);
24-
void common_hal_synthio_note_set_vibrato_depth(synthio_note_obj_t *self, mp_float_t value);
30+
mp_float_t common_hal_synthio_note_get_bend_rate(synthio_note_obj_t *self);
31+
void common_hal_synthio_note_set_bend_rate(synthio_note_obj_t *self, mp_float_t value);
32+
33+
mp_float_t common_hal_synthio_note_get_bend_depth(synthio_note_obj_t *self);
34+
void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t value);
2535

2636
mp_obj_t common_hal_synthio_note_get_waveform_obj(synthio_note_obj_t *self);
2737
void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t value);
2838

39+
mp_obj_t common_hal_synthio_note_get_ring_waveform_obj(synthio_note_obj_t *self);
40+
void common_hal_synthio_note_set_ring_waveform(synthio_note_obj_t *self, mp_obj_t value);
41+
2942
mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self);
3043
void common_hal_synthio_note_set_envelope(synthio_note_obj_t *self, mp_obj_t value);

0 commit comments

Comments
 (0)