setting envellope control point using nyquest

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
uberprutser
Posts: 9
Joined: Sun Mar 28, 2021 5:50 pm
Operating System: Windows 10

setting envellope control point using nyquest

Post by uberprutser » Tue Apr 13, 2021 6:35 pm

I know nothing about nyquist, apart from the name and it's existence :)
But I would like to be able to set a whole bunch of envelope tool control point over the length of an audio track.
I found the following on this forum, and now I need some help modifying this to do what I want. Thanks.

Code: Select all

;version 4
;type tool

(setf time 0)   ;time of label relative to start of the selection
(setf val 0.5)  ;envelop point value

(let ((start (get '*selection* 'start)))
  (setf command (format nil
                        "SetEnvelope: Time=~s Value=~s"
                        (+ start time)
                        val))
  (aud-do command))
Last edited by steve on Tue Apr 13, 2021 7:01 pm, edited 1 time in total.
Reason: code tags added to preserve code formatting

steve
Site Admin
Posts: 81264
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: setting envellope control point using nyquest

Post by steve » Tue Apr 13, 2021 7:03 pm

uberprutser wrote:
Tue Apr 13, 2021 6:35 pm
I found the following on this forum
Did you get it to work? (in the Nyquist Prompt effect)

uberprutser wrote:
Tue Apr 13, 2021 6:35 pm
I would like to be able to set a whole bunch of envelope tool control point over the length of an audio track.
How many, where, and at what level?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

uberprutser
Posts: 9
Joined: Sun Mar 28, 2021 5:50 pm
Operating System: Windows 10

Re: setting envellope control point using nyquest

Post by uberprutser » Tue Apr 13, 2021 7:18 pm

The script I posted works in the prompt.
As for the amount of control point, Don't know what works best. But I think something like, one control point every 3 seconds for the complete length of the track.

steve
Site Admin
Posts: 81264
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: setting envellope control point using nyquest

Post by steve » Tue Apr 13, 2021 9:09 pm

uberprutser wrote:
Tue Apr 13, 2021 7:18 pm
I think something like, one control point every 3 seconds for the complete length of the track.
Select the track that you want to add control points to, then run this code:

Code: Select all

;version 4
;type tool

(setf interval 3.0) ;time interval between points
(setf val 0.5)  ;envelop point value


;; Add envelope points to selected audio.
(let ((start (get '*selection* 'start))
      (end (get '*selection* 'end)))
  (setf num (truncate (/ (- end start) interval)))
  (dotimes (i num)
    (setf command (format nil
                          "SetEnvelope: Time=~s Value=~s"
                          (+ start (* i interval))
                          val))
    (aud-do command)))

I don't understand why this is useful, given that clicking with the envelope tool adds an envelope point, but it does what you asked for.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

uberprutser
Posts: 9
Joined: Sun Mar 28, 2021 5:50 pm
Operating System: Windows 10

Re: setting envellope control point using nyquest

Post by uberprutser » Wed Apr 14, 2021 7:57 am

To be honest I'm not sure about the usefulness either :)
But I'm cleaning up some old video's with a lot of audio noise.
And after noise removal and normalisation I go though the whole track using the envelope tool, and placing all those control points is a bit tedious.

Your code worked perfectly :) I just had to change the envelope point value to 1, so it would not effect the already normalised audio level.
I think this will save me some time, so thanks a lot for your help.
(You know what would make this even more useful, it the control points could be place and the start and end of sentences.
But something like that would probably overload my computer. It already took longer than expected to apply this code :)

Quick follow up question, do you perhaps know how I can easily select a bunch of control points and delete them?

steve
Site Admin
Posts: 81264
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: setting envellope control point using nyquest

Post by steve » Wed Apr 14, 2021 8:32 am

uberprutser wrote:
Wed Apr 14, 2021 7:57 am
I think this will save me some time, so thanks a lot for your help
Isn't it just as quick to click with the envelope tool to create an envelope point, since you need to click to set the height of the point. :?

uberprutser wrote:
Wed Apr 14, 2021 7:57 am
You know what would make this even more useful, it the control points could be place and the start and end of sentences.
This is for reducing the noise level between sentences? As I wrote in your other topic, I'd make a backup copy of the track, and then use the Noise Gate effect rather than using envelopes.

uberprutser wrote:
Wed Apr 14, 2021 7:57 am
do you perhaps know how I can easily select a bunch of control points and delete them?
At present, you can't.
You can remove all envelope points in a track, or you can drag them off one at a time.

In Audacity 3.x it will be possible to make a plug-in to delete all envelope points that are in a selected region, but it would be quite slow if the track has a lot of envelope points. The plug-in would work by making a note of all of the envelope points in the track, removing all envelope points, then replacing the envelope points that are outside of the selected region. A future version of Audacity may be better in this respect.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

uberprutser
Posts: 9
Joined: Sun Mar 28, 2021 5:50 pm
Operating System: Windows 10

Re: setting envellope control point using nyquest

Post by uberprutser » Wed Apr 14, 2021 9:12 am

Usually I start on the left side of the audio file, placing control point one at the time, and work my way to the right.
I spent a lot of time placing the control point at the same height before adjusting them. I know it doesn't matter all that much, it's probably an o.c.b. thing. But having the control points placed automatically I'm sure I won't end up lower or higher on the right end of the track.
It's not so much for noise removal but for other speaking noises. Breathing and such. I tried to completely remove those sounds using ctrl-l but that sounds weird. Replacing it with some noise it tedious. So going though the audio with the envelope tool gets me the best result.
Would it be possible to use Nyquist to remove the control points for a selection?

steve
Site Admin
Posts: 81264
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: setting envellope control point using nyquest

Post by steve » Wed Apr 14, 2021 9:28 am

uberprutser wrote:
Wed Apr 14, 2021 9:12 am
Would it be possible to use Nyquist to remove the control points for a selection?
This plug-in requires Audacity 3.0.0 or later:
DeleteEnvelope.ny
(3.43 KiB) Downloaded 7 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

uberprutser
Posts: 9
Joined: Sun Mar 28, 2021 5:50 pm
Operating System: Windows 10

Re: setting envellope control point using nyquest

Post by uberprutser » Wed Apr 14, 2021 11:47 am

I upgraded to v3.0.0 without problems. Although for some reason lots of scripts are installed in two languages. But that is probably the result of the original Dutch language when my computer was installed. No problem, everything seems to work just fine. Perhaps a bit slower, maybe I just need a computer upgrade.
It took a while before I figured out where I would find this delete script. I kept looking for it under the effect pull-down menu. But it was just under tools. Anyway it works as expected and it is just what I needed :) Thanks a lot!

uberprutser
Posts: 9
Joined: Sun Mar 28, 2021 5:50 pm
Operating System: Windows 10

Re: setting envellope control point using nyquest

Post by uberprutser » Sat Apr 24, 2021 8:39 pm

Steve, Thanks again for your help on the Nyquist scripts. They worked great for me.
I made a video about how I use Audacity and Videopad to improve the audio quality on some of my old youtube videos.
I thought you might like it :)There's no need to watch, I'm not posting this for a hand full of extra views.
But I am looking for tips and trick on how I can improve my result :)

https://youtu.be/FGvr4z84WnA

Post Reply