Modulate one waveform/track with another (FM synthesis)

The problem is “S”.

A long time ago, Audacity used the symbol “S” to pass the selected audio to Nyquist. That was not very nice because “S” is also defined in Nyquist as 0.25. This was changed so that Audacity now uses the variable TRACK to pass the selected audio to Nyquist.

Two possible solutions when working with extremely old Nyquist code:

  1. Wherever the symbol “S” is used to pass the selected audio, replace “S” with “TRACK”.
    Example old code:
(defun fm (s-in)
   (let* ((s-in (lowpass8 s-in (* 0.2 *sound-srate*)))
         (s-in (lowpass8 s-in (* 0.2 *sound-srate*)))
         (map (integrate (db-to-linear (aref s-in 0)))))
      (snd-resamplev (aref s-in 1) *sound-srate* map)))

(fm s)

Example new code:

(defun fm (s-in)
   (let* ((s-in (lowpass8 s-in (* 0.2 *sound-srate*)))
         (s-in (lowpass8 s-in (* 0.2 *sound-srate*)))
         (map (integrate (db-to-linear (aref s-in 0)))))
      (snd-resamplev (aref s-in 1) *sound-srate* map)))

(fm *track*)
  1. Include the “;version 1” header to tell Nyquist that it is ancient code:
    Example with ;version 1 header:
;version 1

(defun fm (s-in)
   (let* ((s-in (lowpass8 s-in (* 0.2 *sound-srate*)))
         (s-in (lowpass8 s-in (* 0.2 *sound-srate*)))
         (map (integrate (db-to-linear (aref s-in 0)))))
      (snd-resamplev (aref s-in 1) *sound-srate* map)))

(fm s)

(Note that in these examples, the selection must be a stereo track)