We need to be a bit careful with the terminology - we have 6 related "effects" but they are all different.Gale Andrews wrote:Someone may jump in and point out that reducing the sample rate in "Change Rate" also removes the high frequencies, even though it is not resampling but only changing the rate the samples are being "pushed out" at (Is there a better description than that)?
Effect Menu:
- Change Speed - Literally speeds up or slows down the audio, like changing the speed of a tape or record. The final sample rate of the audio is the same as the original audio.
When speeding up, the samples, hence the waveform, is "squashed" into a shorter time, which would increase the sample rate, so the audio is then resampled, (discarding some samples) so that the final sample rate is brought back down to the original track rate.
When slowing down, the samples, hence the waveform, is "stretched" to a longer duration, which would decrease the sample rate, so the audio is then resampled (adding/interpolating extra samples) so that the final sample rate is brought back up to the original track rate. - Change Tempo - Changes the tempo without changing the pitch, like asking a musician to play faster or slower but still play the same notes.
This effect breaks up the audio into small "packets" and either spreads the packets out so that they occupy a longer time, or pushes them together so that they occupy a shorter duration. To achieve a reasonably smooth effect, the "packets" all overlap. Distortion occurs due to the inevitable mismatch between packets as the overlap in the final audio is different to the overlap in the original. (a little bit of magic dust is sprinkled over the result to make the final audio sound better than this simplified description implies, but there is still a marked loss of sound quality). - Change Pitch - Changes the pitch while maintaining the original tempo, like singing in a higher or lower key.
This works in a similar way to "Change Tempo", but the result is then resampled (like in the "Change Speed" effect) to bring the duration back to a similar duration of the original (this is inexact and the final duration will usually be a bit longer or shorter than the original). - Sliding Time Scale/Pitch Shift - This is similar to a combination of "Change Tempo" and "Change Pitch". The main differences are:
1) The Tempo Change/Pitch Shift amount can vary over time. (initial and final values are set and the result is an interpolation (linear?) between these values.
2) The handling of the overlaps between "packets" uses a lot of magic dust to produce much higher quality than Change Speed/Temp effects.
3) This effect is more precise, but a lot slower than Change Speed/Temp effects.
- Resample - Depending on the Audacity build, this either uses a very high quality algorithm (libresample) or an extremely high quality algorithm (libsamplerate) to change the sample rate of the track. As it changes the track sample rate it is always applied to the entire track, not just the current selection. Resampling either increases or decreases the number of samples per second, but the waveform (hence the Tempo and Pitch) remains essentially unchanged.
Important to note that the highest frequency that can be represented in digitally sampled audio is half of the sample rate. This is known as the "Nyquist Frequency".
- Set Rate - This changes the sample rate of the track, but unlike Resample, affecting the length (hence tempo and pitch) of the track.
Increasing the sample rate will squeeze the samples together into a shorter time (playback will be faster and higher pitch).
Decreasing the sample rate will spread the samples out over a longer time (playback will be slower and lower pitch).
Unlike the aforementioned effects, no samples are harmed in this production, they are just moved to different positions along the time line.
This effect (unlike the aforementioned) is 100% reversible - If the track rate is changed and then changed back, the final audio will be identical to the original.
True - because the Nyquist frequency is 22050 Hz.Gale Andrews wrote:So in an audio track at a sample rate of 44100 Hz, however much you speed up the audio using Change Speed, you cannot increase the highest frequency it contains above 22050 Hz
The highest quality way to change the speed (pitch and tempo) of an entire track is to change the sample rate form the Track drop-down menu (Set Rate).
If it is necessary to lower the speed (pitch and tempo) of a selection, then "Change Speed" can be used and the result will be very high quality.
If it is necessary to raise the speed (pitch and tempo) of a selection, then any resulting frequencies above the Nyquist will be lost. To mitigate this problem the track could be "Resampled" (Tracks menu) to a higher sample rate before changing the speed. This is only an issue if the intention is to change the speed back again later. While it's true that increasing the sample rate to 96 kHz will raise the Nyquist frequency to 48 kHz, frequencies above 20 kHz are inaudible, so it's only if we intend to reduce the speed later (bringing frequencies above 20 kHz back into the audible range) that we need to be concerned about them.
From the manual
I'm not sure that is true - or at least not clear. Slowing down the audio (with the Change Speed effect) does not "remove" frequencies. When audio is slowed down, the pitch (frequencies) become lower. This applies to all frequencies present in the original audio, so if the original audio had frequencies at 16 kHz and it was slowed down to half speed, these frequencies will then become 8 kHz. This is not a limitation of the method or the technology, it is what should happen.For example, the more you slow down the audio, the more of the higher frequencies will be removed, making the audio sound "duller".
The limitation is that if the speed is increased, then very high frequencies in the original may rise above the Nyquist frequency unless the track sample rate is sufficiently high. As there can be no frequencies above the Nyquist frequency, these frequencies will be lost (permanently). This is not a problem if the speed is only being increased, as the lost frequencies would be inaudible anyway (assuming a track sample rate of at least 44.1 kHz). The problem only exists if the speed is later slowed down again.
For example:
- Track Sample Rate = 44100 Hz (32 bit float)
- Generate White Noise, amplitude 0.2
- On a new track, generate a tone at 1000 Hz, amplitude 0.5
- Mix the two tracks.
"Plot Spectrum" will show an essentially flat frequency response up to 22050 Hz with a spike at 1000 Hz. - Use "Change Speed" to increase the the speed by 100%
The duration will shorten to half its original length (will play at double speed).
"Plot Spectrum" will show an essentially flat frequency response up to about 21 kHz with a spike at 2000 Hz. All the frequencies have been doubled, but (inaudible) frequencies above 21 kHz have been lost. - Use "Change Speed" to decrease the speed by 50%
The duration will increase to double its original length (will play at half the previous speed - which is the same as the original speed).
Plot Spectrum will show an essentially flat frequency response up to about 10.5 kHz with a spike at 1 kHz. All of the frequencies have been halved - as the highest frequencies present were 21 kHz, these will drop to 10.5 kHz. Because there were no frequencies above 21 kHz before this step, there will be no frequencies above 10.5 kHz after this step.
- Track Sample Rate = 44100 Hz (32 bit float)
- Generate White Noise, amplitude 0.2
- On a new track, generate a tone at 1000 Hz, amplitude 0.5
- Mix the two tracks.
"Plot Spectrum" will show an essentially flat frequency response up to 22050 Hz with a spike at 1000 Hz. - Resample the track to 96 kHz (Tracks menu)
- Use "Change Speed" to increase the the speed by 100%
The duration will shorten to half its original length (will play at double speed).
"Plot Spectrum" will show an essentially flat frequency response up to about 42 kHz with a spike at 2000 Hz. All the frequencies have been doubled, and (inaudible) frequencies above 20 kHz are present. - Use "Change Speed" to decrease the speed by 50%
The duration will increase to double its original length (will play at half the previous speed - which is the same as the original speed).
Plot Spectrum will show an essentially flat frequency response up to about 21 kHz with a spike at 1 kHz. All of the frequencies have been halved - as the highest frequencies present were 42 kHz, these will drop to 21 kHz. - (optional) The track may be resampled again back to 44.1 kHz, the spectrum will be essentially unchanged (though the scale in the Plot Spectrum window changes).
"Change Tempo" and "Change Pitch" are both very lossy effects. "Sliding Time Scale/Pitch Shift" is also very lossy, but less so than the other two. "Change Speed" will always produce higher quality sound than "Change Tempo", "Change Pitch" or "Sliding Time Scale/Pitch Shift".Gale Andrews wrote:I suppose this raises an interesting question if you want to reduce pitch and tempo, do you do it the "natural" way with Change Speed and risk losing high frequencies, or with Change Tempo followed by Change Pitch (or with Sliding Time Scale), and keep the frequency bandwidth but risk artifacts from the stretching?
The most accurate way to change the speed is to change the sample rate of the track (from the Track drop down menu), however, when the track is finally Exported (File menu) Audacity will need to resample the track to whatever rate the final file will be in. As far as I'm aware this resampling uses the same method (libresample or libsamplerate) as is used by "Change Speed", so if only making one change to the speed (or changing only in one direction, faster OR slower) there is no difference between using "Change Speed" or changing the track sample rate (from the track drop-down menu). The "Change Speed" effect is probably more convenient in most situations.