system
Given the following post, respond as if you're commenting on Reddit:
human
How can audio be sped up without increasing in pitch?

For example, say that you increase the speed of a recording of a voice. Normally, the pitch of the voice would increase as the sound gets sped up, but some software allows you to increase the speed of an audio file while maintaining the pitch. What's the difference between these two functions regarding how the sound waves are behaving?
gpt
Understanding Fourier analysis is key to knowing how this works. Any complex wave signal (like a sound wave) can be represented by a sum of pure sine waves at varying amplitudes. This collection of equivalent waves as a sum constitutes the frequency spectrum of a sound at a given instant.

The frequency spectrum is constantly changing, as pitch, volume, and sound quality change over time. However, in small slices (say, 10 milliseconds), the spectrum is relatively constant.

What the software is doing is finding the frequency spectrum for a chunk, and reproducing that spectrum for a slightly shorter amount of time. So say for each 10 millisecond block, it generates that spectrum's wave for 8 milliseconds and then moves on to the next block, giving you a 20% increase in speed without changing pitch or sound quality.

This process isn't perfect. It causes distortion with low sounds, distortion with rapidly changing sound, and distortion from errors joining the chunks together which will naturally alter the final spectrum. It can be improved with sliding window averaging, clever joining of sections, dynamic chunk sizes, or any number of tricks.