Audacity Support Forum / Audacity and Nyquist / Nyquist Reference Manual / Nyquist Examples and Tutorials

Sequence Example

Sound examples: ringpat-1.ogg - ringpat-2.ogg


A sequence of notes is often specified by a "note list," consisting of times, durations, other transformations, and a parameterized behavior to generate the sound. The following is an example:

   (defun ringpat1 () 
     (scale 0.8 
       (sim
         (scale 0.6 (at 0.0 (ring 0.6 45 2)))
         (scale 0.5 (at 0.2 (ring 0.8 40 1.5)))
         (scale 0.8 (at 0.6 (ring 1 44 1)))
         (scale 0.7 (at 0.8 (ring 1.2 32 0.8))) 
       )))

Notice that there are 4 sounds. The sounds are shifted in time using the at transformation, and all four sounds are combined using the sim construction. Because of the time shifts, the sounds do not take place simultaneously, but they may overlap somewhat.

Durations are specified by the first parameter to ring, so no stretch transformations are used here. Each sound is individually scaled.

To play this sound, you need the ring function from Vinal Scratch Tutorial. Then you can type:

   (play (ringpat1))

- Sound example: ringpat-1.ogg

Try the following combination, which plays a short and long version of ringpat1 at about the same time:

   (play (sim
           (scale 1.0 (at 0.0 (ringpat1)))
           (scale 0.7 (at 0.05 (stretch 1.5 (ringpat1)))) ))

- Sound example: ringpat-2.ogg


Audacity Support Forum / Audacity and Nyquist / Nyquist Reference Manual / Nyquist Examples and Tutorials