How do you adjust tempo without changing pitch?

How do audio editing programs like audacity change the tempo of a track without altering the pitch?

The only thing I can think of is some sort of sampling algorithm that expands or contracts each snapshot to change the tempo.

I’ve tried changing the tempo on a few different tracks, and hear no change in the pitch of the notes, just their duration.

Just sing or play faster or slower. (I just read headers.)

I believe the programs effectively “slice” the sound and then fill the gaps by interpolating the pitch between “slices”. I remember dance tracks that used early versions of this software had a distinctive kind of “pulsing” where it wasn’t filled smoothly. Think “Higher State of Consciousness” by Josh Wink, for instance.

Edit: see Audio time stretching and pitch scaling - Wikipedia

Yup. Chop it up into samples that can be thought of as little packets of a single frequency - then replay all those individual samples for longer or shorter durations as required.

Or do the opposite - shift their frequency and play them for the same duration - and you can change pitch without affecting tempo.

This is how autotune works - the smaller the change you make, the easier it is to accept as natural.