33
33
//| samples_signed: bool = True,
34
34
//| channel_count: int = 1,
35
35
//| ) -> None:
36
- //| """Create a MultiTapDelay effect where you hear the original sample play back, at a lesser volume after
37
- //| a set number of millisecond delay. The delay timing of the echo can be changed at runtime
38
- //| with the delay_ms parameter but the delay can never exceed the max_delay_ms parameter. The
39
- //| maximum delay you can set is limited by available memory.
36
+ //| """Create a delay effect where you hear the original sample play back at varying times, or "taps".
37
+ //| These tap positions and levels can be used to create rhythmic effects.
38
+ //| The timing of the delay can be changed at runtime with the delay_ms parameter but the delay can
39
+ //| never exceed the max_delay_ms parameter. The maximum delay you can set is limited by available
40
+ //| memory.
40
41
//|
41
- //| Each time the echo plays back the volume is reduced by the decay setting (echo * decay).
42
+ //| Each time the delay plays back the volume is reduced by the decay setting (delay * decay).
42
43
//|
43
44
//| The mix parameter allows you to change how much of the unchanged sample passes through to
44
45
//| the output to how much of the effect audio you hear as the output.
45
46
//|
46
- //| :param int max_delay_ms: The maximum time the echo can be in milliseconds
47
- //| :param float delay_ms: The current time of the echo delay in milliseconds. Must be less the max_delay_ms
48
- //| :param synthio.BlockInput decay: The rate the echo fades. 0.0 = instant; 1.0 = never.
47
+ //| :param int max_delay_ms: The maximum time the delay can be in milliseconds.
48
+ //| :param float delay_ms: The current time of the delay in milliseconds. Must be less than max_delay_ms.
49
+ //| :param synthio.BlockInput decay: The rate the delay fades. 0.0 = instant; 1.0 = never.
49
50
//| :param synthio.BlockInput mix: The mix as a ratio of the sample (0.0) to the effect (1.0).
50
51
//| :param tuple taps: The positions and levels to tap into the delay buffer.
51
- //| :param int buffer_size: The total size in bytes of each of the two playback buffers to use
52
- //| :param int sample_rate: The sample rate to be used
52
+ //| :param int buffer_size: The total size in bytes of each of the two playback buffers to use.
53
+ //| :param int sample_rate: The sample rate to be used.
53
54
//| :param int channel_count: The number of channels the source samples contain. 1 = mono; 2 = stereo.
54
- //| :param int bits_per_sample: The bits per sample of the effect
55
- //| :param bool samples_signed: Effect is signed (True) or unsigned (False)
55
+ //| :param int bits_per_sample: The bits per sample of the effect.
56
+ //| :param bool samples_signed: Effect is signed (True) or unsigned (False).
56
57
//|
57
58
//| Playing adding a multi-tap delay to a synth::
58
59
//|
64
65
//|
65
66
//| audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22)
66
67
//| synth = synthio.Synthesizer(channel_count=1, sample_rate=44100)
67
- //| effect = audiodelays.MultiTapDelay(max_delay_ms=1000 , delay_ms=850 , decay=0.65, buffer_size=1024, channel_count=1, sample_rate=44100, mix=0.7, freq_shift=False )
68
+ //| effect = audiodelays.MultiTapDelay(max_delay_ms=500 , delay_ms=500 , decay=0.65, mix=0.5, taps=((2/3, 0.7), 1), buffer_size=1024, channel_count=1, sample_rate=44100 )
68
69
//| effect.play(synth)
69
70
//| audio.play(effect)
70
71
//|
71
72
//| note = synthio.Note(261)
72
73
//| while True:
73
74
//| synth.press(note)
74
- //| time.sleep(0.25 )
75
+ //| time.sleep(0.05 )
75
76
//| synth.release(note)
76
77
//| time.sleep(5)"""
77
78
//| ...
@@ -139,7 +140,7 @@ static void check_for_deinit(audiodelays_multi_tap_delay_obj_t *self) {
139
140
140
141
141
142
//| delay_ms: float
142
- //| """Maximum time to delay the incoming signal in milliseconds."""
143
+ //| """Time to delay the incoming signal in milliseconds. Must be less than max_delay_ms ."""
143
144
//|
144
145
static mp_obj_t audiodelays_multi_tap_delay_obj_get_delay_ms (mp_obj_t self_in ) {
145
146
audiodelays_multi_tap_delay_obj_t * self = MP_OBJ_TO_PTR (self_in );
@@ -177,7 +178,7 @@ MP_PROPERTY_GETSET(audiodelays_multi_tap_delay_decay_obj,
177
178
(mp_obj_t )& audiodelays_multi_tap_delay_set_decay_obj );
178
179
179
180
//| mix: synthio.BlockInput
180
- //| """The rate the echo mix between 0 and 1 where 0 is only sample, 0.5 is an equal mix of the sample and the effect and 1 is all effect."""
181
+ //| """The mix of the effect between 0 and 1 where 0 is only sample, 0.5 is an equal mix of the sample and the effect and 1 is all effect."""
181
182
static mp_obj_t audiodelays_multi_tap_delay_obj_get_mix (mp_obj_t self_in ) {
182
183
return common_hal_audiodelays_multi_tap_delay_get_mix (self_in );
183
184
}
@@ -194,11 +195,11 @@ MP_PROPERTY_GETSET(audiodelays_multi_tap_delay_mix_obj,
194
195
(mp_obj_t )& audiodelays_multi_tap_delay_get_mix_obj ,
195
196
(mp_obj_t )& audiodelays_multi_tap_delay_set_mix_obj );
196
197
197
- //| taps: Tuple[float|Tuple[float, float], ...]
198
+ //| taps: Tuple[float|int| Tuple[float|int , float|int ], ...]
198
199
//| """The position or position and level of delay taps.
199
- //| The position is a number from 0.0 (start) to 1.0 (end) as a relative position in the delay buffer.
200
- //| The level is a number from 0.0 (silence) to 1.0 (full volume).
201
- //| If only a float is provided as an element of the tuple, the level is assumed to be 1.0 .
200
+ //| The position is a number from 0 (start) to 1 (end) as a relative position in the delay buffer.
201
+ //| The level is a number from 0 (silence) to 1 (full volume).
202
+ //| If only a float or integer is provided as an element of the tuple, the level is assumed to be 1.
202
203
//| When retrieving the value of this property, the level will always be included."""
203
204
//|
204
205
static mp_obj_t audiodelays_multi_tap_delay_obj_get_taps (mp_obj_t self_in ) {
0 commit comments