Skip to content

Commit 23a4df4

Browse files
committed
Increase max_delay limit and a less then zero bug
1 parent ff0c738 commit 23a4df4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: shared-bindings/audiodelays/Chorus.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
//| (the voices) from the delay buffer. The voices played are evenly spaced across the delay
3535
//| buffer. So for 2 voices you would hear the current sample and the one delay milliseconds back.
3636
//| The delay timing of the chorus can be changed at runtime with the delay_ms parameter but the delay
37-
//| can never exceed the max_delay_ms parameter. The maximum delay is 100ms.
38-
//|
37+
//| can never exceed the max_delay_ms parameter. The maximum delay you can set is limited by available
38+
//| memory.
3939
//| :param int max_delay_ms: The maximum time the chorus can be in milliseconds
4040
//| :param synthio.BlockInput delay_ms: The current time of the chorus delay in milliseconds. Must be less the max_delay_ms.
4141
//| :param synthio.BlockInput voices: The number of voices playing split evenly over the delay buffer.
@@ -83,7 +83,7 @@ static mp_obj_t audiodelays_chorus_make_new(const mp_obj_type_t *type, size_t n_
8383
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
8484
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
8585

86-
mp_int_t max_delay_ms = mp_arg_validate_int_range(args[ARG_max_delay_ms].u_int, 1, 100, MP_QSTR_max_delay_ms);
86+
mp_int_t max_delay_ms = mp_arg_validate_int_range(args[ARG_max_delay_ms].u_int, 1, 4000, MP_QSTR_max_delay_ms);
8787

8888
mp_int_t channel_count = mp_arg_validate_int_range(args[ARG_channel_count].u_int, 1, 2, MP_QSTR_channel_count);
8989
mp_int_t sample_rate = mp_arg_validate_int_min(args[ARG_sample_rate].u_int, 1, MP_QSTR_sample_rate);

Diff for: shared-module/audiodelays/Chorus.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ audioio_get_buffer_result_t audiodelays_chorus_get_buffer(audiodelays_chorus_obj
304304
int32_t c_pos = self->chorus_buffer_pos - 1;
305305

306306
for (int32_t v = 0; v < voices; v++) {
307-
word += chorus_buffer[c_pos];
308-
309-
c_pos -= step;
310307
if (c_pos < 0) {
311308
c_pos += chorus_buf_len;
312309
}
310+
word += chorus_buffer[c_pos];
311+
312+
c_pos -= step;
313313
}
314314
word = word / voices;
315315

0 commit comments

Comments
 (0)