Skip to content

Commit 146c13e

Browse files
committed
Improved documentation
1 parent d2e5173 commit 146c13e

File tree

1 file changed

+19
-11
lines changed
  • shared-bindings/audiodelays

1 file changed

+19
-11
lines changed

shared-bindings/audiodelays/Echo.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,29 @@
2525
//| def __init__(
2626
//| self,
2727
//| max_delay_ms: int = 500,
28-
//| delay_ms: BlockInput = 250.0,
29-
//| decay: BlockInput = 0.7,
30-
//| mix: BlockInput = 0.5,
28+
//| delay_ms: synthio.BlockInput = 250.0,
29+
//| decay: synthio.BlockInput = 0.7,
30+
//| mix: synthio.BlockInput = 0.5,
3131
//| buffer_size: int = 512,
3232
//| sample_rate: int = 8000,
3333
//| bits_per_sample: int = 16,
3434
//| samples_signed: bool = True,
3535
//| channel_count: int = 1,
3636
//| ) -> None:
37-
//| """Create a Echo effect that echos an audio sample every set number of milliseconds.
37+
//| """Create a Echo effect where you hear the original sample play back, at a lesser volume after
38+
//| a set number of millisecond delay. The delay timing of the echo can be changed at runtime
39+
//| with the delay_ms parameter but the delay can never exceed the max_delay_ms parameter. The
40+
//| maximum delay you can set is limited by available memory.
3841
//|
39-
//| :param int max_delay_ms: The maximum delay the echo can be
40-
//| :param BlockInput delay_ms: The current echo delay
41-
//| :param BlockInput decay: The rate the echo fades. 0.0 = instant; 1.0 = never.
42-
//| :param BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0).
42+
//| Each time the echo plays back the volume is reduced by the decay setting (echo * decay).
43+
//|
44+
//| The mix parameter allows you to change how much of the unchanged sample passes through to
45+
//| the output to how much of the effect audio you hear as the output.
46+
//|
47+
//| :param int max_delay_ms: The maximum time the echo can be in milliseconds
48+
//| :param synthio.BlockInput delay_ms: The current time of the echo delay in milliseconds. Must be less the max_delay_ms
49+
//| :param synthio.BlockInput decay: The rate the echo fades. 0.0 = instant; 1.0 = never.
50+
//| :param synthio.BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0).
4351
//| :param int buffer_size: The total size in bytes of each of the two playback buffers to use
4452
//| :param int sample_rate: The sample rate to be used
4553
//| :param int channel_count: The number of channels the source samples contain. 1 = mono; 2 = stereo.
@@ -132,7 +140,7 @@ static mp_obj_t audiodelays_echo_obj___exit__(size_t n_args, const mp_obj_t *arg
132140
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiodelays_echo___exit___obj, 4, 4, audiodelays_echo_obj___exit__);
133141

134142

135-
//| delay_ms: BlockInput
143+
//| delay_ms: synthio.BlockInput
136144
//| """Delay of the echo in milliseconds. (read-only)"""
137145
//|
138146
static mp_obj_t audiodelays_echo_obj_get_delay_ms(mp_obj_t self_in) {
@@ -162,7 +170,7 @@ MP_PROPERTY_GETSET(audiodelays_echo_delay_ms_obj,
162170
(mp_obj_t)&audiodelays_echo_get_delay_ms_obj,
163171
(mp_obj_t)&audiodelays_echo_set_delay_ms_obj);
164172

165-
//| decay: BlockInput
173+
//| decay: synthio.BlockInput
166174
//| """The rate the echo decays between 0 and 1 where 1 is forever and 0 is no echo."""
167175
static mp_obj_t audiodelays_echo_obj_get_decay(mp_obj_t self_in) {
168176
return common_hal_audiodelays_echo_get_decay(self_in);
@@ -188,7 +196,7 @@ MP_PROPERTY_GETSET(audiodelays_echo_decay_obj,
188196
(mp_obj_t)&audiodelays_echo_get_decay_obj,
189197
(mp_obj_t)&audiodelays_echo_set_decay_obj);
190198

191-
//| mix: BlockInput
199+
//| mix: synthio.BlockInput
192200
//| """The rate the echo mix between 0 and 1 where 0 is only sample and 1 is all effect."""
193201
static mp_obj_t audiodelays_echo_obj_get_mix(mp_obj_t self_in) {
194202
return common_hal_audiodelays_echo_get_mix(self_in);

0 commit comments

Comments
 (0)