The depth (how much the speed is changed) can be adjusted by changing the number in the first line (currently 2.5)
This should work well on selections of about 1/4 to 1/2 second duration.
It’s just a simple form of “always open” “forward” scratch that speeds up the audio, slows it down, and speeds it back up again. “depth” settings higher than 10 will cause a more rapid scratch type effect as the frequency attempts (but fails) to go negative.
One way that it is possible to reverse a sound in Audacity Nyquist is to read the samples into an array, reverse the array then turn it back into a sound.
Note that this example uses rather a lot of memory so it is only really suitable for short tracks.