form caption("SVG FFT") size(600, 300), colour(60, 60, 60), guiMode("queue") pluginId("def1")
image bounds(0, 0, 600, 300), channel("fftGrid"), colour(0,0,0,0)
image bounds(0, 0, 600, 300), channel("fftImage1"), colour(0,0,0,0)
image bounds(0, 0, 600, 300), channel("fftImage2"), colour(0,0,0,0)
-n -d -+rtmidi=NULL -M0 -m0d
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
opcode rgbString, S,iii
iR, iG, iB xin
SColourString sprintf {{rgb(%d, %d, %d)}}, iR, iG, iB
xout SColourString
endop
opcode svgFFT, 0,Sk[]iiii
SChannel, kData[], iUpdateRate, iR, iG, iB xin
iBounds[] cabbageGet SChannel, "bounds"
kIndex = 0
kLen lenarray kData
if metro(iUpdateRate) == 1 then
SPath strcpyk {{
}}
SPath strcatk SPath, sprintfk("", iBounds[2], iBounds[3], iBounds[3])
cabbageSet 1, SChannel, "svgElement", SPath
endif
endop
opcode svgGrid, 0, Sii
SChannel, iNumRows, iNumCols xin
iBounds[] cabbageGet SChannel, "bounds"
iCnt init 0
SPath init ""
while iCnt < iNumRows do
SPath strcat SPath, sprintf({{
}}, 0, (iBounds[3]/iNumRows)*iCnt, iBounds[2], (iBounds[3]/iNumRows)*iCnt)
iCnt +=1
od
iCnt = 0
while iCnt < iNumCols do
SPath strcat SPath, sprintf({{
}}, (iBounds[2]/iNumCols)*iCnt, 0, (iBounds[2]/iNumCols)*iCnt, iBounds[3])
iCnt +=1
od
cabbageSet SChannel, "svgElement", SPath
endop
instr 1
svgGrid "fftGrid", 20, 10
kData1[] init 1026
kData2[] init 1026
aNoise randi 1, sr/2
aSig butterbp aNoise, abs(jspline:k(10000, .1, 1)), abs(jspline:k(1000, .4, 2))
aSig balance aSig, aNoise
fSig1 pvsanal aSig, 1024,256,1024, 1
fSig2 pvsanal aSig*.5, 1024,256,1024, 1
kFrame1 pvs2array kData1, fSig1
kFrame2 pvs2array kData2, fSig2
svgFFT "fftImage1", kData1, 10, 147, 200, 60
;svgFFT "fftImage2", kData2, 10, 147, 250, 160
outs aSig, aSig
endin
i1 0 [60*60*24*7]