Is there a convenient way to reduce or increase the pitch of a sound by a specific amount of semitones without preserving its duration?
Audacity’s pitch-related effects (Change Pitch and Sliding Time Scale/Pitch Shift) can apply a shift specified in semitones, but both attempt to maintain the duration/tempo of the original sound (or, in the case of Sliding Time Scale/Pitch Shift, apply an optional tempo change).
Change Speed modifies pitch and tempo, but doesn’t offer a way to apply a speed change corresponding to a pitch shift of some specified number of semitones.
This message from 2009 recommends getting the percentage change corresponding to a specified number of semitones from Change Pitch and using it in Change Speed, which works, but isn’t convenient.
Is there way to simply turn off the time correction applied by Change Pitch and Sliding Time Scale/Pitch Shift?
Windows version: Windows 7
Audacity version: 2.1.2
Installer type: executable
“Change Speed” is the effect, but it does not have “semitones” as input units.
To calculate the “change in speed” (assuming twelve-tone equal temperament) is:
The “change in speed” is simply a ratio - it’s the “Speed multiplier”.
So for example, to increase the pitch by 3 semitones, the speed must be increased by 2^(3/12) = 1.189207115
So to increase the pitch by 3 semitones without preserving the length, simply use the Change Speed effect and set the speed multiplier to 1.189207115
OK, so let’s make it more convenient.
To change the speed, we can simply resample the audio to a rate that is the inverse of the required speed ratio
which can be simplified as:
Using Nyquist in the Nyquist Prompt, we can make a simple resampling effect:
The first line is a special “header” comment. Any line beginning with a semicolon is ignored by Nyquist, but special “header” comments are read by Audacity. In this case, “;version 4” tells Audacity to assume that the code uses the new Nyquist syntax rather than the legacy syntax.
The next line is also a special header. This one tells Audacity to create a graphic interface with a slider control. The three numbers at the end set the default, minimum and maximum values for the slider control. “pitch” is the variable that is assigned the value of the slider.
;control pitch "Semitones change" real "" 0 -24 24
Then we have the mathematics where we calculate the sample rate ratio as 2^(pitch/-12)
(setf ratio (power 2.0 (/ pitch -12)))
Finally we have the resampling function. track is a special variable that passes audio from the track to Nyquist. sound-srate is a special variable that passes the sample rate of the track to Nyquist.
Perhaps there is a feature request here for those who don’t want to get their calculator out? A pitch change control for Change Speed has three prior votes on Wiki Feature Requests. Not many I know, and perhaps you Steve would regard that as clutter?
No it’s not many, and I’d imagine that for most users it would be unnecessary clutter.
I’d be happy for the plug-in from my previous post to go onto the wiki for the benefit of those that do want this feature.
Steve, thank you for creating a plugin specific to this task. I’ve installed it and it is indeed convenient!
If this functionality were to be incorporated into an existing effect, perhaps adding a single checkbox to the Change Pitch effect (e.g., “Maintain tempo”, checked by default) would be preferable to (and possibly more intuitive than) adding a pitch control to Change Speed? For example, Sound Forge’s Pitch Shift effect includes a “Preserve duration” checkbox (screenshot).
One reason I sometimes reduce the pitch of a piece of music by a specific number of semitones without preserving the duration is for transcription by ear. The reduced tempo makes it easier to pick out individual notes (particularly for fast music) and knowing that the change corresponds to a specific number of semitones allows me to simply increase the pitch of the transcribed notes by that amount.
Generally, I think the effect produced by adjusting the pitch of music or speech without compensating for the change in tempo is a fairly popular one (I’ve heard it used in music and for dramatic/comedic purposes).
Yes, I agree it’s popular/useful for dramatic / comedic purposes, but in this case it is more a case of “what sounds right” rather than a specific number of semitones that is important. For this purpose, I think the most useful “upgrade” would be to add “real-time preview” to the Change Speed effect (like the WahWah effect where parameters can be adjusted while listening to the effect preview).
Why not use Change Tempo to slow down the audio without changing the pitch?
Is it because (up 'till now) the sound quality has become rather echoey when slowing down music with the Change Tempo effect?
For most “popular” uses, I agree that the specific number of semitones isn’t likely to be a concern. I still think it would be nice to make duration preservation optional when using the Change Pitch effect, but I can understand that it may not justify the work. I do appreciate the plugin!
I’ll try Change Tempo the next time I’m transcribing something; experience with other software has made me a bit skeptical of time expansion/compression effects (perhaps unjustifiably in this case!).
The Change Tempo effect in Audacity 2.1.2, like most other tempo stretching effects, does tend to sound echoey.
The “Sliding Time Scale / Pitch Shift” effect is unusual in that it tends to not have this problem, but, it’s a bit more complex as it has the start/end settings and tempo/pitch settings, and it’s slower (a more complex algorithm is required to achieve the better sound quality).
In the next version of Audacity (2.1.3), I’ve added an option in the Change Pitch and Change Tempo effects to use the high quality algorithm from the Sliding Time Scale / Pitch Shift effect. When this “high quality stretching” option is selected, the more complex algorithm is used. For small to moderate changes in pitch / tempo this produces much better sound quality than the old algorithm. The old algorithm is still retained as: (a) it is faster, (b) it is better for very large stretch factors.
I think the main use case for this is as described by WFrane, and when Audacity 2.1.3 is released, will be better served by the new “high quality” option in the Change Tempo effect. Nevertheless, we can continue to monitor votes, and consider adding a “maintain tempo” checkbox to “Change Pitch” if needed.