@@ -248,7 +248,7 @@ audioio_get_buffer_result_t audiodelays_pitch_shift_get_buffer(audiodelays_pitch
248248 // get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required
249249 shared_bindings_synthio_lfo_tick (self -> base .sample_rate , n / self -> base .channel_count );
250250 mp_float_t semitones = synthio_block_slot_get (& self -> semitones );
251- mp_float_t mix = synthio_block_slot_get_limited (& self -> mix , MICROPY_FLOAT_CONST (0.0 ), MICROPY_FLOAT_CONST (1.0 ));
251+ 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 ) ;
252252
253253 // Only recalculate rate if semitones has changes
254254 if (memcmp (& semitones , & self -> current_semitones , sizeof (mp_float_t ))) {
@@ -300,13 +300,16 @@ audioio_get_buffer_result_t audiodelays_pitch_shift_get_buffer(audiodelays_pitch
300300 word /= (int32_t )overlap_size ;
301301 }
302302
303+ word = (int32_t )((sample_word * MIN (MICROPY_FLOAT_CONST (2.0 ) - mix , MICROPY_FLOAT_CONST (1.0 ))) + (word * MIN (mix , MICROPY_FLOAT_CONST (1.0 ))));
304+ word = synthio_mix_down_sample (word , SYNTHIO_MIX_DOWN_SCALE (2 ));
305+
303306 if (MP_LIKELY (self -> base .bits_per_sample == 16 )) {
304- word_buffer [i ] = (int16_t )(( sample_word * ( MICROPY_FLOAT_CONST ( 1.0 ) - mix )) + ( word * mix )) ;
307+ word_buffer [i ] = (int16_t )word ;
305308 if (!self -> base .samples_signed ) {
306309 word_buffer [i ] ^= 0x8000 ;
307310 }
308311 } else {
309- int8_t mixed = (int8_t )(( sample_word * ( MICROPY_FLOAT_CONST ( 1.0 ) - mix )) + ( word * mix )) ;
312+ int8_t mixed = (int8_t )word ;
310313 if (self -> base .samples_signed ) {
311314 hword_buffer [i ] = mixed ;
312315 } else {
0 commit comments