@@ -248,7 +248,7 @@ audioio_get_buffer_result_t audiodelays_pitch_shift_get_buffer(audiodelays_pitch
248
248
// get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required
249
249
shared_bindings_synthio_lfo_tick (self -> base .sample_rate , n / self -> base .channel_count );
250
250
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 ) ;
252
252
253
253
// Only recalculate rate if semitones has changes
254
254
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
300
300
word /= (int32_t )overlap_size ;
301
301
}
302
302
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
+
303
306
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 ;
305
308
if (!self -> base .samples_signed ) {
306
309
word_buffer [i ] ^= 0x8000 ;
307
310
}
308
311
} else {
309
- int8_t mixed = (int8_t )(( sample_word * ( MICROPY_FLOAT_CONST ( 1.0 ) - mix )) + ( word * mix )) ;
312
+ int8_t mixed = (int8_t )word ;
310
313
if (self -> base .samples_signed ) {
311
314
hword_buffer [i ] = mixed ;
312
315
} else {
0 commit comments