@@ -71,7 +71,7 @@ void common_hal_audiodelays_echo_construct(audiodelays_echo_obj_t *self, uint32_
71
71
synthio_block_assign_slot (delay_ms , & self -> delay_ms , MP_QSTR_delay_ms );
72
72
73
73
if (mix == MP_OBJ_NULL ) {
74
- mix = mp_obj_new_float (MICROPY_FLOAT_CONST (0.5 ));
74
+ mix = mp_obj_new_float (MICROPY_FLOAT_CONST (0.25 ));
75
75
}
76
76
synthio_block_assign_slot (mix , & self -> mix , MP_QSTR_mix );
77
77
@@ -268,7 +268,7 @@ audioio_get_buffer_result_t audiodelays_echo_get_buffer(audiodelays_echo_obj_t *
268
268
269
269
// get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required
270
270
shared_bindings_synthio_lfo_tick (self -> base .sample_rate , n / self -> base .channel_count );
271
- mp_float_t mix = synthio_block_slot_get_limited (& self -> mix , MICROPY_FLOAT_CONST (0.0 ), MICROPY_FLOAT_CONST (1.0 ));
271
+ mp_float_t mix = synthio_block_slot_get_limited (& self -> mix , MICROPY_FLOAT_CONST (0.0 ), MICROPY_FLOAT_CONST (1.0 )) * MICROPY_FLOAT_CONST ( 2.0 ) ;
272
272
mp_float_t decay = synthio_block_slot_get_limited (& self -> decay , MICROPY_FLOAT_CONST (0.0 ), MICROPY_FLOAT_CONST (1.0 ));
273
273
274
274
mp_float_t f_delay_ms = synthio_block_slot_get (& self -> delay_ms );
@@ -323,7 +323,7 @@ audioio_get_buffer_result_t audiodelays_echo_get_buffer(audiodelays_echo_obj_t *
323
323
echo_buffer [self -> echo_buffer_write_pos ++ ] = word ;
324
324
}
325
325
326
- word = (int16_t )(echo * mix );
326
+ word = (int16_t )(echo * MIN ( mix , MICROPY_FLOAT_CONST ( 1.0 )) );
327
327
328
328
if (MP_LIKELY (self -> base .bits_per_sample == 16 )) {
329
329
word_buffer [i ] = word ;
@@ -414,16 +414,17 @@ audioio_get_buffer_result_t audiodelays_echo_get_buffer(audiodelays_echo_obj_t *
414
414
}
415
415
}
416
416
417
- word = echo + sample_word ;
417
+ word = (int32_t )((sample_word * MIN (MICROPY_FLOAT_CONST (2.0 ) - mix , MICROPY_FLOAT_CONST (1.0 )))
418
+ + (echo * MIN (mix , MICROPY_FLOAT_CONST (1.0 ))));
418
419
word = synthio_mix_down_sample (word , SYNTHIO_MIX_DOWN_SCALE (2 ));
419
420
420
421
if (MP_LIKELY (self -> base .bits_per_sample == 16 )) {
421
- word_buffer [i ] = (int16_t )(( sample_word * ( MICROPY_FLOAT_CONST ( 1.0 ) - mix )) + ( word * mix )) ;
422
+ word_buffer [i ] = (int16_t )word ;
422
423
if (!self -> base .samples_signed ) {
423
424
word_buffer [i ] ^= 0x8000 ;
424
425
}
425
426
} else {
426
- int8_t mixed = (int16_t )(( sample_word * ( MICROPY_FLOAT_CONST ( 1.0 ) - mix )) + ( word * mix )) ;
427
+ int8_t mixed = (int16_t )word ;
427
428
if (self -> base .samples_signed ) {
428
429
hword_buffer [i ] = mixed ;
429
430
} else {
0 commit comments