Someone asked earlier how to make a sound repeat at some labels. The solution there was to use a tool plug-in. If you can generate the sound within Nyquist, you can also do, just with the present Audacity a label-driven “Ni” synth.
First Makes some labels that say “pitch:XX”. You can actually gen this “score” from Ny too, e.g. type at the prompt:
(quote ((1.47447 2.92571 "pitch:60") (2.21751 3.1463 "pitch:70") (2.65868 4.60916 "pitch:80")))
The labels overlap on purpose in the above example.
Then here comes the Ni synth:
;version 4 ;type generate (defun pitch-from-label (str) (eval-string (string-left-trim "pitch:" str))) ; not much error checking here ;; Audacity ignores the initial shift, so must add a s-rest ;; shift-time won't work here (defun note-snd (beg end pitch) (seq (s-rest beg) (pluck (pitch-from-label pitch) (- end beg)))) (defun note-snd-from-label (lbl) (apply #'note-snd lbl)) (setq lbls (second (first (aud-get-info "Labels")))) (setq snd-list (mapcar #'note-snd-from-label lbls)) ;; sim is a macro, so we can't use apply (eval (cons 'sim snd-list))
Result of running that:
You can replace pluck with osc to see that the note spans are correct (they are), but you’d need to add something like velocity param besides pitch for nicer overlaps of sine waves (no clipping).
Nyquist has even nicer STK instruments than just pluck, e.g. clarinet, but they have somewhat weird “breath” parameters that I haven’t figured out how to use just yet.
Also you can’t use sampler with type generate, since there’s no easy way to read a sound sample and return sound that doesn’t overwrite it, i.e. with type process, so no easy way make the output go to some other sound track. One could probably come up with some scratch trick to select two tracks, one with the sample, and one as the target to be written, but it’s annoying, especially having to deal with different lengths. I’ll try to make something nicer with my return to new track Audacity patch, which is basically working now, just needs some code cleanup for a PR.