synthio: doc fixes, rename BendType to BendMode
This commit is contained in:
parent
23baf02399
commit
17df238145
@ -59,7 +59,7 @@ static const mp_arg_t note_properties[] = {
|
||||
//| tremolo_rate: float = 0.0,
|
||||
//| bend_depth: float = 0.0,
|
||||
//| bend_rate: float = 0.0,
|
||||
//| bend_mode: BendMode = BendMode.VIBRATO,
|
||||
//| bend_mode: "BendMode" = BendMode.VIBRATO,
|
||||
//| ) -> None:
|
||||
//| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change).
|
||||
//|
|
||||
@ -270,7 +270,7 @@ MP_PROPERTY_GETSET(synthio_note_envelope_obj,
|
||||
//| ring_frequency: float
|
||||
//| """The ring frequency of the note, in Hz. Zero disables.
|
||||
//|
|
||||
//| For ring to take effect, both ring_frequency and ring_wavefor must be set."""
|
||||
//| For ring to take effect, both ``ring_frequency`` and ``ring_waveform`` must be set."""
|
||||
STATIC mp_obj_t synthio_note_get_ring_frequency(mp_obj_t self_in) {
|
||||
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
return mp_obj_new_float(common_hal_synthio_note_get_ring_frequency(self));
|
||||
@ -290,7 +290,7 @@ MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj,
|
||||
//| ring_waveform: Optional[ReadableBuffer]
|
||||
//| """The ring waveform of this note. Setting the ring_waveform to a buffer of a different size resets the note's phase.
|
||||
//|
|
||||
//| For ring to take effect, both ring_frequency and ring_wavefor must be set."""
|
||||
//| For ring to take effect, both ``ring_frequency`` and ``ring_waveform`` must be set."""
|
||||
//|
|
||||
STATIC mp_obj_t synthio_note_get_ring_waveform(mp_obj_t self_in) {
|
||||
synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
@ -289,36 +289,41 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz);
|
||||
MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, STATIC, SYNTHIO_BEND_MODE_STATIC);
|
||||
MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, VIBRATO, SYNTHIO_BEND_MODE_VIBRATO);
|
||||
MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEEP);
|
||||
MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP_IN, SYNTHIO_BEND_MODE_SWEEP_IN);
|
||||
|
||||
//|
|
||||
//| class BendType:
|
||||
//| class BendMode:
|
||||
//| """Controls the way the ``Note.pitch_bend_depth`` and ``Note.pitch_bend_rate`` properties are interpreted."""
|
||||
//|
|
||||
//| STATIC: object
|
||||
//| """The Note's pitch is modified by its ``pitch_bend_depth``. ``pitch_bend_rate`` is ignored."""
|
||||
//|
|
||||
//| VIBRATO: object
|
||||
//| """The Note's pitch varies by ``±pitch_bend_depth` at a rate of ``pitch_bend_rate``Hz."""
|
||||
//| """The Note's pitch varies by ``±pitch_bend_depth`` at a rate of ``pitch_bend_rate`` Hz."""
|
||||
//|
|
||||
//| SWEEP: object
|
||||
//| """The Note's pitch starts at ``Note.frequency`` then sweeps up or down by ``pitch_bend_depth`` over ``1/pitch_bend_rate`` seconds."""
|
||||
//|
|
||||
//| SWEEP_IN: object
|
||||
//| """The Note's pitch sweep is the reverse of ``SWEEP`` mode, starting at the bent pitch and arriving at the tuned pitch."""
|
||||
//|
|
||||
MAKE_ENUM_MAP(synthio_bend_mode) {
|
||||
MAKE_ENUM_MAP_ENTRY(bend_mode, STATIC),
|
||||
MAKE_ENUM_MAP_ENTRY(bend_mode, VIBRATO),
|
||||
MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP),
|
||||
MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP_IN),
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(synthio_bend_mode_locals_dict, synthio_bend_mode_locals_table);
|
||||
|
||||
MAKE_PRINTER(synthio, synthio_bend_mode);
|
||||
|
||||
MAKE_ENUM_TYPE(synthio, BendType, synthio_bend_mode);
|
||||
MAKE_ENUM_TYPE(synthio, BendMode, synthio_bend_mode);
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BendType), MP_ROM_PTR(&synthio_bend_mode_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BendMode), MP_ROM_PTR(&synthio_bend_mode_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) },
|
||||
|
@ -116,7 +116,7 @@ def synthesize6(synth):
|
||||
tremolo_rate=1.5,
|
||||
bend_depth=-5 / 12,
|
||||
bend_rate=1 / 2,
|
||||
bend_mode=synthio.BendType.SWEEP,
|
||||
bend_mode=synthio.BendMode.SWEEP,
|
||||
waveform=sine,
|
||||
envelope=envelope,
|
||||
)
|
||||
|
@ -37,7 +37,7 @@ def synthesize(synth):
|
||||
frequency=synthio.midi_to_hz(1 + i),
|
||||
waveform=noise,
|
||||
envelope=envelope,
|
||||
bend_mode=synthio.BendType.SWEEP,
|
||||
bend_mode=synthio.BendMode.SWEEP,
|
||||
bend_depth=random.choice((-1, 1)),
|
||||
bend_rate=randf(4, 12),
|
||||
)
|
||||
|
@ -1,10 +1,10 @@
|
||||
()
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),)
|
||||
(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),)
|
||||
[-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383]
|
||||
(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None))
|
||||
(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None))
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046]
|
||||
(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),)
|
||||
(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),)
|
||||
[0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0]
|
||||
(-5242, 5242)
|
||||
(-10485, 10484)
|
||||
|
Loading…
Reference in New Issue
Block a user