Increment frequency automatically


I started with audacity and I would like to generate a sound in the following form: Sine wave frequency f0 for 10s, then 5s silence then sine wave frequency f0 + 50 Hz and then silence 5s then sine wafe frequency f0+100 Hz etc… Is it possible to do this with Audacity, if so how?

Thank you in advance,

There is a “TestTone” plugin from which does something similar,
but the frequency increases logarithmically rather than linearly in equal steps, (see attached) …

I’m sure is is possible to create your custom sweep using Nyquist code, there are examples on t’internet …

Try running this code in the “Nyquist Prompt” effect:

  1. Open Audacity
  2. Tracks menu > Add New > Audio Track
  3. Select part of the track (click and drag on the audio track)
  4. Effect menu > Nyquist Prompt
  5. Copy and paste the code below into the Nyquist Prompt text window
  6. Click the “OK” button.
;; The first 6 code lines can be edited as required.
;; Anything after a semicolon is a comment and does nothing.

(setq f0 200)             ; 200 hz
(setq hz-increase 50)     ; frequency increase per tone
(setq hz-max 1000)        ; maximum tone frequency
(setq tone-duration 3)    ; 3 seconds tone duration
(setq pause-duration 1.5) ; 1.5 second pause between tones
(setq amp 0.8)            ; output amplitude 0 to 1
;; End of user settings

  (do* ((hz (+ f0 hz-increase) (+ hz hz-increase))
        (total-dur tone-duration (+ total-dur tone-duration pause-duration))
        (output (osc (hz-to-step f0) tone-duration)))
       ((>= hz hz-max) (mult amp output))
    (setf output (sim
      (at-abs (+ total-dur pause-duration)
        (osc (hz-to-step hz) tone-duration))))))

Steve was a little bit faster. Anyway, here’s another implementation with arbitrary amplitudes for start and end.

  f-0 200.0
  interval 50.0
  f-n 600
  tone-dur 10.0
  pause-dur 5.0
  amp-0 0.8
  amp-n 0.2)
(setf repetitions (truncate (/ (- f-n f-0) interval)))
(setf amp-interval (/ (- amp-n amp-0) (float repetitions)))

  (seqrep (n (1+ repetitions))
          (set-logical-stop (scale (+ amp-0 (* n amp-interval)) 
             (osc (hz-to-step (+ f-0 (* n interval))) tone-dur)) 
          (+ tone-dur pause-dur))))

Thank you, it works perfect !