Slide pitch with LINEAR rate

Help for Audacity 2.x.x on GNU/Linux.

ImageThis forum is for Audacity 2.x.x on GNU/Linux and Unix-like operating systems.
Please state which version of Linux you are using, the exact three-section version number of Audacity from Help > About Audacity... and whether you installed your distribution's release or daily version of Audacity or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.

Slide pitch with LINEAR rate

Permanent link to this post Posted by raphaelsilva00 » Thu Mar 02, 2017 12:22 am

When I use the effect "Sliding Time Scale / Pitch Shift" to get a bent note effect, I get a logarithmic (I think) change in the pitch. That means, the speed of the change is much faster in the beginning then it is in the end. I am trying to get a linear bend (constant speed of change).

I've learned this page (from 2012) that apparently there used to be an option called "Slide Types" for "Sliding Time Scale / Pitch Shift" effect. It allowed one to choose between geometric (logarithmic) and linear change. But I don't see this option in the current version.

I'm using Audacity 2.1.2 under Ubuntu 16.04 64-bit.
raphaelsilva00
 
Posts: 5
Joined: Mon Apr 11, 2016 1:25 am
Operating System: Linux *buntu

Re: Slide pitch with LINEAR rate

Permanent link to this post Posted by kozikowski » Thu Mar 02, 2017 2:23 am

I suspect what you have now is linear and you want log. 400Hz or 440Hz is generally considered roughly half-way up the scale. That's the oboe tone at the beginning of the orchestra. If you kept increasing the pitch in 400Hz jumps, you'd be at the upper end sometime next week. But if you went up by log (or octave) that would probably sound about right.

Koz
kozikowski
Forum Staff
 
Posts: 37721
Joined: Thu Aug 02, 2007 5:57 pm
Location: Los Angeles
Operating System: OS X 10.9 Mavericks

Re: Slide pitch with LINEAR rate

Permanent link to this post Posted by steve » Thu Mar 02, 2017 11:04 am

raphaelsilva00 wrote:I've learned this page (from 2012) that apparently there used to be an option called "Slide Types" for "Sliding Time Scale / Pitch Shift" effect. It allowed one to choose between geometric (logarithmic) and linear change. But I don't see this option in the current version.

The current version of the "Sliding Time Scale/Pitch Shift" effect does not have that option.

When the effect was first introduced into Audacity, it was the only way that users could access the excellent "SBSMS" time-stretch algorithm. (The algorithm used in "Change Pitch" and "Change Tempo" has been "SOLA", which is fast and can handle high stretch ratios, but tends to sound echoey and the resulting length is often not precise). For small to medium amounts of stretching, the SBSMS algorithm generally gives much higher quality. We wanted this high quality to be available to all users, so the "Sliding Time Scale/Pitch Shift" was deliberately given a simpler interface than earlier prototypes.

In the next version of Audacity (2.1.3), the SBSMS algorithm has been added as an option to the Change Pitch and Change Tempo effects, so I think that it would now be reasonable to add more features (specifically "slide type" options) to the "Sliding Time Scale/Pitch Shift" effect.

If you would like to add your support to the idea of (re-)adding "slide type" options, I'll move this post to the "Adding Features" board so that your "vote" is counted.
If you are a software developer, you are very welcome to submit a patch to add this feature.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44458
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Slide pitch with LINEAR rate

Permanent link to this post Posted by steve » Thu Mar 02, 2017 11:14 am

raphaelsilva00 wrote:That means, the speed of the change is much faster in the beginning then it is in the end. I am trying to get a linear bend (constant speed of change).

As a workaround, apply half of the amount of pitch shift twice.

In this example, 6 semitones stretch was applied twice to the upper track, and 12 semitones stretch added once to the lower track, Both tracks began life as a 1000 Hz sine tone:

tracks003.png
tracks003.png (159 KiB) Viewed 390 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44458
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Slide pitch with LINEAR rate

Permanent link to this post Posted by raphaelsilva00 » Thu Mar 02, 2017 2:40 pm

kozikowski wrote:I suspect what you have now is linear and you want log.


Oh, sorry, I said log in relation to how many semitones it changes. But in relation to the frequency, it's probably linear as you said. I think that makes sense.
raphaelsilva00
 
Posts: 5
Joined: Mon Apr 11, 2016 1:25 am
Operating System: Linux *buntu

Re: Slide pitch with LINEAR rate

Permanent link to this post Posted by raphaelsilva00 » Fri Mar 03, 2017 3:26 am

steve wrote:As a workaround, apply half of the amount of pitch shift twice.
[...]


Thanks for this tip!

I did some math and found that this approximation gets better the more times you apply the effect*. All the way to infinity! Of course making the number of iterations too high is not practical, and can even introduce error from dividing the amount of semitones desired by this huge number (I'm guessing, I didn't test).

For raising the frequency from unchanged to an octave above, here is the maximum frequency error (that occurs in the middle of the audio) I calculated for each amount of iterations:
1) 6.4%
2) 3.5%
3) 2.1%
4) 2.1%
10) 0.7%
∞) 0.0%
For comparison, two consecutive semitones have their frequencies 5.6% apart.

These errors should be the same for any initial and final pitch shift that are one octave apart, since the result would only be shifted by a certain amount of semitones.
However, the percentage gets higher if the difference between the inicial and final pitch shift increases, and vice versa. Intuitively, if you raise a sound by only 1 semitone with this effect, you wouldn't expect to have a 6.4% error anywhere, because that's more than 1 semitone.

Conclusion: Applying the effect "Sliding Time Scale/Pitch Shift" twice or three times should give a good approximation for a linear semitones slide in most cases.

Notice: Please double check my results if you intend to use them.

* I'm assuming that the effect turns the signal f(t) 0<=t<=1 into (1+rt)f(t) when "inicial pitch shift" is set to 0 and "final" is set so the frequency at t=1 is multiplied by r+1. Assuming also that a linear semitones slide (desired) would turn f(t) into 2^t*f(t). The multiplications here are done in the frequencies.
raphaelsilva00
 
Posts: 5
Joined: Mon Apr 11, 2016 1:25 am
Operating System: Linux *buntu

Re: Slide pitch with LINEAR rate

Permanent link to this post Posted by steve » Fri Mar 03, 2017 9:29 am

raphaelsilva00 wrote:Oh, sorry, I said log in relation to how many semitones it changes. But in relation to the frequency, it's probably linear as you said. I think that makes sense.

Crossed posting. I was thinking that you wanted linear rate of frequency change.
The images that I posted show linear vertical scale, and as can be seen the rate of change in frequency from two applications is very close to linear.

For constant "semi-tone change / time" you would need the slide to be interpolated geometrically (the "ratio" of frequency change per unit time being constant).
As you say, this can be approximated by applying a very small change many times, but the downside is that the sound quality suffers.

There is still a workaround for constant rate pitch (frequency ratio), but it's not very practical.
A Time Track can be used to change the pitch and tempo, with "logarithmic interpolation" not selected. Then use "Change Tempo" or "Sliding Time Scale / Pitch Shift" to restore the original tempo and length by stretching by a constant amount,
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44458
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu


Return to GNU/Linux and Unix-like



Who is online

Users browsing this forum: No registered users and 3 guests