generate type plugin can't do a process action?

Hello im trying to make my first plugin for audacity, for experimental uses im trying to create a sweep tone ( 180 Seconds ) from 150Hz to 30Hz and after do a fade Out to the tone generated

(setq TONE
  (scale-db 0 (fmosc 0 (pwev 150 180 30))));
(mult TONE (diff (const 1) (mult (ramp 1) (ramp 1))));

The problem is this code only create 1 second of sound and i need the seconds in pwev 150 180 30 function
Thank you for your help, a dont know what im doing wrong :confused:

If PWEV has a duration of 180 seconds (and therefore also FMOSC and TONE), then also CONST and RAMP must have durations of 180 seconds, because otherwise MULT and DIFF (in the second line) will stop computing after the end of CONST or RAMP:

(setq TONE (scale-db 0 (fmosc 0 (pwev 150 180 30))))
(mult TONE (diff (const 1 180) (mult (ramp 180) (ramp 180))))

Audacity Nyquist “generate” and “process” plugins have a different notion of WARP. In a “generate” plugin the default duration is 1.0 seconds, while in a “process” plugin (and also in the Audacity “Nyquist Prompt” window) the default duration is equal to the length of the Audacity selection. This means that in a “generate” plugin (OSC 60 2.0) produces a sinewave of two seconds, while in a “process” plugin (OSC 60 2.0) produces a sinewave two times as long as the selected part of the Audacity track. This is also true for all other Nyquist functions with an optional “duration” argument.

Tested with Audacity_1.3.14-alpha on Debian Linux.

  • edgar

Perhaps also worth mentioning that if you want to use “real” time in a “process” plug-in you can force the behaviour to be calculated in the default environment using (abs-env beh)

Using your code as an example, to run the code in the Nyquist Prompt you could write:

  (let ((dur 180))
    (setq TONE (scale-db 0 (fmosc 0 (pwev 150 dur 30))))
    (mult TONE (diff 1 (mult (ramp dur) (ramp dur))))))

Thank you!!!
Now i see the problem, i dont know what it was wrong because in a process plugin the fadeout function work good but in my generate pluging don’t

Thanks edgar-rft and steve :smiley: