Could you calculate and shift values in Nyquist?

I have an idea on how to reverse pitch… but it requires math. I asked this in the end of one post to invert pitch, but nobody replied. So for calculating, can audacity somehow calculate numbers? If so, and for example if it is 10=high notes & 0=low notes, would it be possible to do x-1 (-10=high & 0=low), then + 10 (0=high & 10=low)? I don’t want to make over 20,000 sound files with each frequency, pitch shift them, and merge it all back together, that’d take up huge memory and it would be a pain-in-the-neck amount of time. I want the musical notes in frequencies to be reversed, not the Hz. So, is it possible to make a Nyquist plugin that does something like this, and if so, could you please give me an example?

Example of octave: 0 to 12 x -1 = 0 to -12, + 12 = 12 to 0

Plus, another plugin I made needs a value to be 1/60, and because I don’t know how to do math in Nyquist, I rounded & wrote “0.016666667”, but I can’t write the 6 infinite times. How would I be able to write 1/60 in Nyquist? (I’ve done something similar in HTML/Java, but the symbol I used in Java or HTML to divide doesn’t work in Nyquist.)

Please, respond, I know I already asked about the pitch, but about calculating the numbers, at least? If possible, how would I write something, like 3+3=6, 3-3=0, 3/3=1, 3*3=9, 3(log3)3=1 or 3^3=27? (Could not find symbol for “log3”, but is opposite of “^”.)

Yes Audacity can do arithmetic operations. For example, in the Nyquist Prompt:

(setf A 23)
(setf B 7)
(print (+ A B))  ;prints "30"

Nyquist does not know what “high notes” and “low notes” mean.

As I wrote in one of my replies a long time back, to obtain frequencies from sounds you need to use FFT analysis of the sound, and that is complicated.
To use FFT and IFFT in Nyquist, you have to use “objects” and “classes”. This is NOT a topic for beginners. Some information about object orientated programming in Nyquist / Xlisp is here:

Like this:

(/ 1.0 60)

Note that at least one of the numbers must be explicitly a floating point number.


(/ 1 60)

evaluates to 0, because it is written as integer arithmetic.


(/ 1.0 60)

evaluates to 0.01666…

(+ 3 3)

(- 3 3)

(/ 3 3)

“3(log3)3=1” :confused:

Nyquist uses “natural log” rather than base 10 log.

Natural log (log to base e):
ln(3) would be written as:

(log 3.0)

log to base 10:
log(3) would be written as:

(/ (log 3.0)(log 10.0))

(power 3 3)

This is all in the manual:

I can’t help with the details but you can probably do what you want with [u]FFT[/u]. (I did a quick search of the Nyquist documentation and it does have some FFT functions.)

The official Nyquist FFT Tutorial is here:
(Warning: It’s complicated)

SPEAR is free software which can invert the spectrum, (but doing that usually does not sound musical).