Hi,
Here is the code Rory provided with little tweaks to update the syntax and scroll from left to right with no margin. I’m sure it can be improved, please let me know if you see how it could be improved, but it’s already working well!
<Cabbage>
form caption("Scrolling waveform") size(400, 300), colour(58, 110, 182), guiMode("queue"), pluginid("def1")
gentable bounds(2, 6, 393, 199), tableNumber(1), fill(0), channel("table1")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 64
nchnls = 2
0dbfs = 1
opcode ScrollTable, 0, aikiS
setksmps 1
aSig, iTable, kRate, iScrollPoint, SChannel xin
kSig = aSig
kCnt = 0
kIndex linseg 0, 8, ftlen(iTable), 0, ftlen(iTable)
if metro(kRate) == 1 then
tabw kSig, kIndex, 1
if kIndex == ftlen(iTable) then
while kCnt<ftlen(iTable) do
kSample tab kCnt+1, 1
tabw kSample, kCnt, 1
kCnt+=1
od
endif
endif
endop
instr drawGentable
cabbageSet "table1", "tableNumber", 1
endin
instr 1
a1 inch 1
a1 = oscili(1, 200)*tab(phasor:a(1), 2, 1)
;a1 follow2 a1, 0.01, 0.01
ScrollTable a1, 1, 32, 0, "table1"
;sig table update rate scroll point table channel
event "i", "drawGentable" , 0, 0.0008
outs a1, a1
endin
</CsInstruments>
<CsScore>
f2 0 1024 7 0 256 1 [256*3] 0
f1 0 256 7 0 256 0
;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>