Nyquist Humour

<>

Congratulations

To be strictly correct, you have one more “)” at the end than there should be. If you use the “Debug” button it should show you an error message to that effect.

Another way to do the same thing is:

``````(list (list 2.0 "test"))
``````

If you’re using Audacity 1.3.x, try this:

``````(list (list 1 8 ":=)"))
``````

<>

That’s a fun effect, but you may not have noticed that the (stretch-abs 1 x) at the end doesn’t actually do anything.

<>

As I said - in your code (stretch-abs 1 x) does not do anything.

If you remove (stretch-abs …) from the “regular” and “defun” code, they produce the same result as the “TerminatorX” code.

To make your “setq”/“TerminatorX” code the same as the other two, the sum/sim code needs to be inside the (stretch-abs 1 …) function.

Laying out your code to make it a bit more readable:

``````(setq x
(sum s
(at 0.5 (sum (cue s)
(at 0.5 (sum (cue s)
(at 0.5 (sum (cue s)
(at 0.5 (sum (cue s)
(at 0.5 (cue s))
))
))
))
))
)
)
``````

“x” is your new sound.
If the length of the original sound “s” is L, then the length of “x” is
L + (L/2) + (L/2) + (L/2) + (L/2) + (L/2) = 3.5(L)

(stretch-abs 1 …) does not stretch the sound to 1 second, it maps each unit of logical time maps to 1 unit of real time.

probably easier to see with (stretch-abs 2 …)
(stretch-abs 2 …) does not stretch the sound to 2 seconds, it maps each unit of logical time maps to 2 unit of real time.

As it says in the manual:

(stretch-abs factor beh)
Evaluates beh with warp set to a linear time transformation where each unit of logical time maps to factor units of real time. The effect is to stretch the nominal behavior of beh (under the default global environment) by factor.

http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/part6.html#index410

So in your code, the logical time is 3.5(L), and mapping each unit of logical time to one unit of real time will produce a length of 3.5(L). You will see no change.
Also, (stretch …) and (stretch-abs …) should be applied to behaviours and not sounds, so strictly (though in this case it doesn’t make any difference) I think your code should be (stretch-abs 1 (cue x)).

If we take the examples that use “defun”,
(stretch-abs …) is applied to the function, which means that each “0.5” in the (at 0.5 …) functions get mapped to 0.5 seconds.

Taking your code, but modified to (stretch-abs 1 (your_code))
then again, each “0.5” will be 0.5 seconds, so the final length will be:
L + 0.5 + 0.5 + 0.5 + 0.5 + 0.5 = L + 2.5

``````(stretch-abs 1
(sum s
(at 0.5 (sum (cue s)
(at 0.5 (sum (cue s)
(at 0.5 (sum (cue s)
(at 0.5 (sum (cue s)
(at 0.5 (cue s))
))
))
))
))
)
)
``````

<>

No, quite the reverse. It means that the internal structure is very short/simple, just one sound.

From the manual:

(snd-print-tree sound)
Prints an ascii representation of the internal data structures representing a sound.

http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/manual/part6.html#index172

Try running this:

``````(setq mysound
(mult 0.4
(sim
(osc 60)
(osc 40)
)))

(SND-PRINT-TREE mysound)
``````

The debug output will indicate the two sound sources that make up “mysound”