Ah, nevermind. Turns out there’s a k-rate version of phasor which makes things very simple. I’ve always been using the a-rate version
Here’s one way to achieve this:
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1")
hslider bounds(88, 64, 150, 50) channel("gain") range(0, 1, 0, 1, 0.001)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
kres phasor 1
cabbageSetValue "gain", kres
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>