Weird thing on Spectral edit Ver 2.3.1

Help for Audacity on macOS.
Forum rules
ImageThis forum is for Audacity on macOS 10.4 and later.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".


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.
Paul2
Posts: 155
Joined: Wed Sep 04, 2019 1:17 pm
Operating System: macOS 10.15 Catalina or later

Re: Weird thing on Spectral edit Ver 2.3.1

Post by Paul2 » Sat May 08, 2021 9:01 pm

No worries Steve.

Will definitely experiment and post back under a new thread.

I did expect that the actual selection was handled in the main application, no problem, can make multiple smaller square and rectangular selections to approximate the irregular shape.
Not ideal but also not a deal breaker.

Thanks for the example and your time.

Cheers for now.
Paul

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

Re: Weird thing on Spectral edit Ver 2.3.1

Post by steve » Sun May 09, 2021 1:12 pm

I do agree that it would be nice to have more flexibility in spectral selection beyond a rectangular selection. I believe that it was intended all along to add more features, but there's a lot of ideas on the back burner and always a great amount of immediately pressing issues.
Paul2 wrote:
Sat May 08, 2021 9:01 pm
I did expect that the actual selection was handled in the main application,
Personally I think that the main application should handle more. Rather than just defining the frequency range, Audacity should (in my opinion) handle the frequency separation so that the "spectral" selection can be passed to any effect for processing (including built-in effects, VST effects, and any other effects that are installed). However, this is not the way that it is currently implemented.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul2
Posts: 155
Joined: Wed Sep 04, 2019 1:17 pm
Operating System: macOS 10.15 Catalina or later

Re: Weird thing on Spectral edit Ver 2.3.1

Post by Paul2 » Sun May 09, 2021 3:04 pm

That would be awesome and almost getting into RX8 territory.
The ability to pass only the spectral selections to VST's, to separate tracks, etc would open up so many possibilities.

I'm currently working on a BPF for spectral editing.
The user makes a selection, Nyquist is then aware of start time, end time, BW, center freq, rms and so on.
The plugin will calculate the ideal Q and band pass filter only the selection.

Could be very handy to isolate certain sounds (as opposed to nuking them).
It's slow going as the Nyquist/Lisp syntax is not exactly what I would call intuitive.

If it's possible, may even implement a copy and paste selection feature to another track.
Wonder if that is not being too optimistic though.

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

Re: Weird thing on Spectral edit Ver 2.3.1

Post by steve » Sun May 09, 2021 3:51 pm

Paul2 wrote:
Sun May 09, 2021 3:04 pm
I'm currently working on a BPF for spectral editing.
"Band Pass Filter"?
Paul2 wrote:
Sun May 09, 2021 3:04 pm
It's slow going as the Nyquist/Lisp syntax is not exactly what I would call intuitive.
There have been Holy Wars about LISP syntax :D
The basics are very easy:
  1. Open parentheses
  2. Function name (symbol)
  3. Arguments (parameters, values, etc)
  4. Close parentheses

Code: Select all

(my-function arg1 arg2 ...)
Of course it does get more complex than that in some cases, as you might expect for a full programming language, but it does become more intuitive with practice.

Once you have more than a few lines of code, it becomes very useful (essential) to adopt good indentation. I recently added this guide to the Audacity wiki: https://wiki.audacityteam.org/wiki/Nyqu ... tion_Guide
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul2
Posts: 155
Joined: Wed Sep 04, 2019 1:17 pm
Operating System: macOS 10.15 Catalina or later

Re: Weird thing on Spectral edit Ver 2.3.1

Post by Paul2 » Sun May 09, 2021 4:13 pm

"Band Pass Filter"?
Yep, band pass.
Other "big brand" spectral editors have two play buttons.
First one plays everything as per normal, but the second one only plays the selection.
In Audacity, that they may not be possible, so instead it would be a work around where one makes a selection, band pass filters it then plays it normally.
If not wanted, then simply undo.

Similar to when using de-clicker.
First select "isolate changes" to hear what it will take out, if happy then undo and run it again but this time with "apply changes".
That kind of thing.

There is a SpectralEditParametricEQ.ny but that only amplifies or attenuates the selection.
The idea is to keep the selection unaltered whilst nuking everything else in the selected time range, if that makes sense.

Uses include getting rid of short background noises, clicks, harmonics etc and one does not always know which one to nuke.
There have been Holy Wars about LISP syntax :D
I'm not surprised. :D
The basics are very easy:
Errrr, no. :D
To make matters worse, Lisp uses something similar to RPN.
For example, add 2 to a variable.
(sum s-in 2)

Would be much more straight forward if it were:

(s-in sum 2) or even better, (s-in + 2).

But it is what it is, so will knuckle down and learn this Lisp thing.
It's a steep learning curve, but when compared to VST or AU compilation, not so bad.

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

Re: Weird thing on Spectral edit Ver 2.3.1

Post by steve » Sun May 09, 2021 4:53 pm

Paul2 wrote:
Sun May 09, 2021 4:13 pm
For example, add 2 to a variable.
(sum s-in 2)
Yes. LISP uses "s-expressions" (https://en.wikipedia.org/wiki/S-expression)
Paul2 wrote:
Sun May 09, 2021 4:13 pm
Would be much more straight forward if it were:

(s-in sum 2) or even better, (s-in + 2).
That would certainly be more familiar :)

However, in languages like C / C++ we see inconsistencies where sometime the function symbol comes first,

Code: Select all

FunctionSymbol(arg1, arg2);
and other times, as in arithmetic operators, the functional symbol is somewhere in the middle,

Code: Select all

val = 5 + 2;
In Nyquist, it's consistent:

Code: Select all

(FunctionSymbol arg1 arg2)
(setq val (+  5 2))

-----

The "+" symbol is valid for adding numeric values.
"SUM" (or "SIM" which is an alias for SUM) is required when adding signals / sounds.

Similarly "*" can be used for multiplying numeric values, but "MULT" is required for sounds.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul2
Posts: 155
Joined: Wed Sep 04, 2019 1:17 pm
Operating System: macOS 10.15 Catalina or later

Re: Weird thing on Spectral edit Ver 2.3.1

Post by Paul2 » Sun May 09, 2021 6:18 pm

I can't believe it, actually made my first plugin in Nyquist/Lisp, all 4 lines of it. :lol:
Thank you very much Steve for your help and patience.

It's not perfect yet, but getting there.
I know there are other ways of achieving the same thing, but it's a pain to get out of spectral mode, find the spot, apply a filter, then back into spectral mode.
This way, can just do a quick BPF and compare.
Just wish there was a steeper bandpass in Nyquist, can I cascade bandpass2?
Screen Shot 2021-05-09 at 8.24.27 PM.png
Screen Shot 2021-05-09 at 8.24.27 PM.png (317.42 KiB) Viewed 138 times

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

Re: Weird thing on Spectral edit Ver 2.3.1

Post by steve » Sun May 09, 2021 7:05 pm

Paul2 wrote:
Sun May 09, 2021 6:18 pm
I can't believe it, actually made my first plugin in Nyquist/Lisp, all 4 lines of it.
Congratulations :)

However, I don't think that your calculation of Q is correct.
I think it should be:

Q = sqrt(2 ^ bw) / ((2 ^ bw) - 1)
where "bw" is the bandwidth in octaves.

In Nyquist:

Code: Select all

(setf q (/ (sqrt (power 2.0 bw))(- (power 2.0 bw) 1)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Paul2
Posts: 155
Joined: Wed Sep 04, 2019 1:17 pm
Operating System: macOS 10.15 Catalina or later

Re: Weird thing on Spectral edit Ver 2.3.1

Post by Paul2 » Sun May 09, 2021 7:46 pm

However, I don't think that your calculation of Q is correct.
I think it should be:

Q = sqrt(2 ^ bw) / ((2 ^ bw) - 1)
where "bw" is the bandwidth in octaves.
Perfect, thanks Steve.
Modified the code accordingly and added it as a plugin, works like a charm.

Paul2
Posts: 155
Joined: Wed Sep 04, 2019 1:17 pm
Operating System: macOS 10.15 Catalina or later

Re: Weird thing on Spectral edit Ver 2.3.1

Post by Paul2 » Mon May 10, 2021 5:11 pm

Steve, sorry 3 more questions if I may:

Many moons ago, you wrote a Nyquist ultra narrow BPF.
I want to modified it to work in spectral mode.
Modifying lines 1 - 5 is easy.
Making "freq" set to "'*selection* 'center-hz" and "repeat" set to 10 is also straight forward.
(Don't need sliders).

The questions I have are:

- what do I do with all the "s-in" 's, do I change them to *track* ?
- and what about the single "s" in line 20, that becomes *track* as well?
- lastly, what does the "peak" on line 18 do?

TIA.
Screen Shot 2021-05-10 at 7.18.23 PM.png
Screen Shot 2021-05-10 at 7.18.23 PM.png (40.34 KiB) Viewed 112 times
EDIT:

All good Steve.
Tried the modifications I wrote about and it works really well, too well in fact, had to reduce the iterations to 3.

Slowly getting the hang of this Nyquist/Lisp thing.

Post Reply