Change *track* Pitch with pwl?

Hello all! I’m back.

Is there a way to change the pitch of track according to a pwl envelope?

I can get the pitch to shift with pitshift but can’t get it to work with the pwl.

Then I thought I might have luck with transpose, but couldn’t get that to do anything.

Then I tried the Pitch Change by Resampling Tutorial, though it shifts in steps and I would prefer shifting in percentages. I couldn’t get it to work once I substituted the osc with track.

Is there a way? Am I close at all?

I’m using window 7, audacity 2.1.2 and used the .exe installer.

Oops. I meant to post this in the Nyquist section.

No problem, I’ve moved it for you :wink:

Do you need to change the pitch while keeping the original tempo, or is it ok to change the “speed” (pitch and tempo)?

For changing the “speed”, if the sound track is short, you could use SND-COMPOSE Nyquist Functions
This is not easy to use if you want precise results, but you can see an example of it’s use in the old “Turntable Warping” plug-in: Missing features - Audacity Support

Alternatively you could use SOUND-WARP Nyquist Functions
Again, this is not easy to use for predictable results.
Example:

(setf dur (get-duration 1))
(sound-warp (snd-exp (mult (snd-log (pwlv 0.0001 1 dur)) 0.8)) *track*)

If you need to stretch the pitch without changing the tempo, then currently the only available built-in function is PITCHSHIFT Nyquist Functions but this can only shift by a fixed amount, and the sound quality is not particularly good.
Example:

(pitshift *track* 0.5 1)

In the latest version of Nyquist there are a couple of new functions for high quality time stretching, but these are not yet available in Audacity.

Thanks for the quick reply!

I want to change the pitch without changing the original tempo. Pitshifts sound quality is fine for me. It doesn’t necessarily have to sound “good” for what I’m doing. I’m guessing pitshift is using something like the “synchronized overlap-add” method and currently Nyquist can’t access the “Subband Sinusoidal Modeling Synthesis” Audacity uses for the Sliding Time Scale/Pitch Shift effect.

Is it possible to do the type of pitch envelope I’d like in the standalone Nyquist?

Or perhaps, change the speed with the pitch then change the speed back without changing the pitch back?

Otherwise, now I’m thinking I may be able to fudge something like this for a reasonable facsimile.

(setf highestpitch 2)
(setf lowestpitch .5)
(sim
(pitshift (mult (pwlv 1 .2 1 .4 0 .6 0 .8 1 1 1) *track*) highestpitch 1)
(pitshift (mult (pwlv 0 .2 0 .4 1 .6 1 .8 0 1 0) *track*) lowestpitch 1))

I pitshift track to the highest pitch in the range and set its amplitude by the original intended pitch envelope.
Then I invert the breakpoints of that envelope and apply it the amplitude of track pitshifted to the lowest pitch in the range.

I’m thinking if I add a few more versions pitshifted to pitches in the middle of the pitch range and adjust all the envelopes top and/or bottom lines to appropriate ratios, I may get something smooth enough I could work with.

(setf highestpitch 2)
(setf midpitch 1.25)
(setf lowestpitch .5)
(sim
(pitshift (mult (pwlv 1 .5 0 1 0) *track*) highestpitch 1)

(pitshift (mult (pwlv 0 .5 1 1 0) *track*) midpitch 1)

(pitshift (mult (pwlv 0 .5 0 1 1) *track*) lowestpitch 1))

Something like that, except doing that with the pitch range set between each of the breakpoints inside the original envelope.

I’ll have to come up with an algorithm to take the original envelope and calculate the inverted and adjusted envelopes by the number of mid range pitches. I think I see this working but it’ll take me awhile to get the actual formula down. But since I’m automating, I should be able to add as many mid range pitches as I want.

Think there is any merit in this idea? See any big flaws? Am I explaining it in a way that makes sense or is this just the ramblings of an insane mind?

and what is it that you’re doing? I may think of some workarounds if I know what that is.

Stand alone Nyquist has:
PHASEVOCODER Nyquist Functions
PV-TIME-PITCH Nyquist Functions

I’ve created a chorus type effect that takes track and layers copies of itself at various shifted pitches and/or start times. I’ve done the GUI and all the calculations in Autoit Scripting Language and it translates the information to Nyquist code for output. I often use it on recordings of a person talking. It works great, I’m getting all kinds of weird results ranging from robotic to demonic. That is what I mean by not having to sound “good”. I’m not trying to make clean or realistic sounds, I’m going for the crazy type sounds, so some distortion from a pitch shift doesn’t bother me.

What I’d like to do now is have the ability to shift the pitches of some or all of those copies over time, to add even more textural variety to the effect. I’m all about the pwlv envelopes because I want to be able to shift things in shapes beyond LFOs or ADSR envelopes. And I don’t want to change the speed because often I’m using it on a sound clip taken from a video file and want to be able to sync it back to the video without having to change the speed of the video.

Have a look at SND-TAPV (http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index697)

Example (try it on a mono speech recording):

(setf amount1 0.01)
(setf speed1 5.0)
(setf amount2 0.03)
(setf speed2 3.0)

(let ((vardelay1 (mult amount1 (lfo speed1 1 *sine-table* -80)))
      (vardelay2 (mult amount2 (lfo speed2 1 *sine-table* -80))))
  (mult 0.4
    (sum *track*
      (snd-tapv *track* amount1 vardelay1 (* 2 amount1))
      (snd-tapv *track* amount2 vardelay2 (* 2 amount2)))))

Thank you for your help and suggestions, this forum rocks!

I didn’t like SND-TAPV because I really wanted to avoid using LFOs to control the shifting.

I did try something else though, kinda similar to my other idea. I take the desired pitch envelope and enter it as an input in Autoit, with variables for highest pitch, lowest pitch and
overlap amount. The Autoit algorithm then slices the envelope up into equal sections and maps the envelope value for each section, up to 100 sections. It then outputs Nyquist code combining
an instance of track for each section, shifts the pitch for the whole instance and adds an amplitude envelope to reveal each section in order with a slight overlap.

This example has an input envelope of pwlv(0 0.20 0 0.50 1 0.80 0 1 0). Its highest pitch = 2, lowest = .5 and the overlap = 0.009. It outputs this…

(sim
(pitshift (mult (pwlv 1 0.191 1 0.209 0 1 0) *track*) 0.5 1)
(pitshift (mult (pwlv 0 0.191 0 0.209 1 0.201 1 0.219 0 1 0) *track*) 0.545 1)
(pitshift (mult (pwlv 0 0.201 0 0.219 1 0.211 1 0.229 0 1 0) *track*) 0.59 1)
(pitshift (mult (pwlv 0 0.211 0 0.229 1 0.221 1 0.239 0 1 0) *track*) 0.65 1)
(pitshift (mult (pwlv 0 0.221 0 0.239 1 0.231 1 0.249 0 1 0) *track*) 0.695 1)
(pitshift (mult (pwlv 0 0.231 0 0.249 1 0.241 1 0.259 0 1 0) *track*) 0.74 1)
(pitshift (mult (pwlv 0 0.241 0 0.259 1 0.251 1 0.269 0 1 0) *track*) 0.8 1)
(pitshift (mult (pwlv 0 0.251 0 0.269 1 0.261 1 0.279 0 1 0) *track*) 0.845 1)
(pitshift (mult (pwlv 0 0.261 0 0.279 1 0.271 1 0.289 0 1 0) *track*) 0.89 1)
(pitshift (mult (pwlv 0 0.271 0 0.289 1 0.281 1 0.299 0 1 0) *track*) 0.935 1)
(pitshift (mult (pwlv 0 0.281 0 0.299 1 0.291 1 0.309 0 1 0) *track*) 0.995 1)
(pitshift (mult (pwlv 0 0.291 0 0.309 1 0.301 1 0.319 0 1 0) *track*) 1.04 1)
(pitshift (mult (pwlv 0 0.301 0 0.319 1 0.311 1 0.329 0 1 0) *track*) 1.1 1)
(pitshift (mult (pwlv 0 0.311 0 0.329 1 0.321 1 0.339 0 1 0) *track*) 1.145 1)
(pitshift (mult (pwlv 0 0.321 0 0.339 1 0.331 1 0.349 0 1 0) *track*) 1.19 1)
(pitshift (mult (pwlv 0 0.331 0 0.349 1 0.341 1 0.359 0 1 0) *track*) 1.25 1)
(pitshift (mult (pwlv 0 0.341 0 0.359 1 0.351 1 0.369 0 1 0) *track*) 1.295 1)
(pitshift (mult (pwlv 0 0.351 0 0.369 1 0.361 1 0.379 0 1 0) *track*) 1.34 1)
(pitshift (mult (pwlv 0 0.361 0 0.379 1 0.371 1 0.389 0 1 0) *track*) 1.4 1)
(pitshift (mult (pwlv 0 0.371 0 0.389 1 0.381 1 0.399 0 1 0) *track*) 1.445 1)
(pitshift (mult (pwlv 0 0.381 0 0.399 1 0.391 1 0.409 0 1 0) *track*) 1.49 1)
(pitshift (mult (pwlv 0 0.391 0 0.409 1 0.401 1 0.419 0 1 0) *track*) 1.55 1)
(pitshift (mult (pwlv 0 0.401 0 0.419 1 0.411 1 0.429 0 1 0) *track*) 1.595 1)
(pitshift (mult (pwlv 0 0.411 0 0.429 1 0.421 1 0.439 0 1 0) *track*) 1.64 1)
(pitshift (mult (pwlv 0 0.421 0 0.439 1 0.431 1 0.449 0 1 0) *track*) 1.7 1)
(pitshift (mult (pwlv 0 0.431 0 0.449 1 0.441 1 0.459 0 1 0) *track*) 1.745 1)
(pitshift (mult (pwlv 0 0.441 0 0.459 1 0.451 1 0.469 0 1 0) *track*) 1.79 1)
(pitshift (mult (pwlv 0 0.451 0 0.469 1 0.461 1 0.479 0 1 0) *track*) 1.835 1)
(pitshift (mult (pwlv 0 0.461 0 0.479 1 0.471 1 0.489 0 1 0) *track*) 1.895 1)
(pitshift (mult (pwlv 0 0.471 0 0.489 1 0.481 1 0.499 0 1 0) *track*) 1.94 1)
(pitshift (mult (pwlv 0 0.481 0 0.499 1 0.491 1 0.509 0 1 0) *track*) 2 1)
(pitshift (mult (pwlv 0 0.491 0 0.509 1 0.501 1 0.519 0 1 0) *track*) 1.94 1)
(pitshift (mult (pwlv 0 0.501 0 0.519 1 0.511 1 0.529 0 1 0) *track*) 1.895 1)
(pitshift (mult (pwlv 0 0.511 0 0.529 1 0.521 1 0.539 0 1 0) *track*) 1.85 1)
(pitshift (mult (pwlv 0 0.521 0 0.539 1 0.531 1 0.549 0 1 0) *track*) 1.79 1)
(pitshift (mult (pwlv 0 0.531 0 0.549 1 0.541 1 0.559 0 1 0) *track*) 1.745 1)
(pitshift (mult (pwlv 0 0.541 0 0.559 1 0.551 1 0.569 0 1 0) *track*) 1.7 1)
(pitshift (mult (pwlv 0 0.551 0 0.569 1 0.561 1 0.579 0 1 0) *track*) 1.64 1)
(pitshift (mult (pwlv 0 0.561 0 0.579 1 0.571 1 0.589 0 1 0) *track*) 1.595 1)
(pitshift (mult (pwlv 0 0.571 0 0.589 1 0.581 1 0.599 0 1 0) *track*) 1.55 1)
(pitshift (mult (pwlv 0 0.581 0 0.599 1 0.591 1 0.609 0 1 0) *track*) 1.49 1)
(pitshift (mult (pwlv 0 0.591 0 0.609 1 0.601 1 0.619 0 1 0) *track*) 1.445 1)
(pitshift (mult (pwlv 0 0.601 0 0.619 1 0.611 1 0.629 0 1 0) *track*) 1.4 1)
(pitshift (mult (pwlv 0 0.611 0 0.629 1 0.621 1 0.639 0 1 0) *track*) 1.34 1)
(pitshift (mult (pwlv 0 0.621 0 0.639 1 0.631 1 0.649 0 1 0) *track*) 1.295 1)
(pitshift (mult (pwlv 0 0.631 0 0.649 1 0.641 1 0.659 0 1 0) *track*) 1.25 1)
(pitshift (mult (pwlv 0 0.641 0 0.659 1 0.651 1 0.669 0 1 0) *track*) 1.19 1)
(pitshift (mult (pwlv 0 0.651 0 0.669 1 0.661 1 0.679 0 1 0) *track*) 1.145 1)
(pitshift (mult (pwlv 0 0.661 0 0.679 1 0.671 1 0.689 0 1 0) *track*) 1.1 1)
(pitshift (mult (pwlv 0 0.671 0 0.689 1 0.681 1 0.699 0 1 0) *track*) 1.04 1)
(pitshift (mult (pwlv 0 0.681 0 0.699 1 0.691 1 0.709 0 1 0) *track*) 0.995 1)
(pitshift (mult (pwlv 0 0.691 0 0.709 1 0.701 1 0.719 0 1 0) *track*) 0.95 1)
(pitshift (mult (pwlv 0 0.701 0 0.719 1 0.711 1 0.729 0 1 0) *track*) 0.89 1)
(pitshift (mult (pwlv 0 0.711 0 0.729 1 0.721 1 0.739 0 1 0) *track*) 0.845 1)
(pitshift (mult (pwlv 0 0.721 0 0.739 1 0.731 1 0.749 0 1 0) *track*) 0.8 1)
(pitshift (mult (pwlv 0 0.731 0 0.749 1 0.741 1 0.759 0 1 0) *track*) 0.74 1)
(pitshift (mult (pwlv 0 0.741 0 0.759 1 0.751 1 0.769 0 1 0) *track*) 0.695 1)
(pitshift (mult (pwlv 0 0.751 0 0.769 1 0.761 1 0.779 0 1 0) *track*) 0.65 1)
(pitshift (mult (pwlv 0 0.761 0 0.779 1 0.771 1 0.789 0 1 0) *track*) 0.59 1)
(pitshift (mult (pwlv 0 0.771 0 0.789 1 0.781 1 0.799 0 1 0) *track*) 0.545 1)
(pitshift (mult (pwlv 0 0.781 0 0.799 1 1 1) *track*) 0.5 1))

I’m reasonably pleased at how this sounds but that is an awful lot of layers. Especially since I’d like to layer several of these on top of each other at once. So my question is…

How much is too much? How many simultaneous instances of track becomes to much for Nyquist? Is there a limit?

You don’t have to use LFO with SND-TAPV. You can use PWL or any other type of control signal. I only used LFO because I couldn’t be bothered to type out a long list of break points :wink:

Nyquist can handle a lot of “layers”, but eventually you will overflow somewhere and get an error.
I can see what you’re doing; it’s basically overlapping windows isn’t it? (but it’s very cumbersome). I’ve not got time right now but I’ll see if I can come up with a more elegant solution.