Change Pitch/Tempo of Sound

by ten_6044
See Code Download Embed
This is a play sound block where you can change pitch and tempo separately. It changes the pitch and the tempo of a sound. However, when played, you might experience glitches. We will continue contributing this block to reduce glitches. It is also quite laggy for longer sounds and it converts sounds to mono if stereo.

You can modify this block. Instructions:

Atoms -- All the samples a sound has.
Freq -- Multiplier for the pitch effect.
S -- The number of samples before skipping atoms. Works best at 4096 to avoid glitches. Recommended: 2048 - 8192
Glitch removal strength -- Removes glitches from the audio with effects. Works best at 8 for high quality, and works best at 12 for minimum glitches. Recommended: 6 - 16. A higher number will reduce glitches, but will also reduce the quality.

----

Want to use this on your projects? Click "See code" then click File, then click Export blocks.
To import, click File, choose Import.

----

Credits
======
Music used: Dance Around from Scratch Sound Library

Created April 6, 2022

Last updated September 23, 2022

Published April 6, 2022