sr = 96000
ksmps = 10
nchnls = 1
0dbfs = 1
opcode warp,0,iiiiiii
inumbins, iampin, ifreqin, iampout,ifreqout,iwarpfunction, icount xin
; start with an empty table
iclear ftgen 0, 0, inumbins, -2, 0
tablecopy iampout, iclear
tablecopy ifreqout, iclear
;perform a do-while loop cycling through the table
;copying data from original index to new index
kindex = 0
loop:
;read the warp or remapping function
kwarp table kindex, iwarpfunction
;read original data from original index points
kAmp table kindex, iampin
kFreq table kindex, ifreqin
;read the amplitude of the output table at destination index
kAmpTest table kwarp, iampout
;read from the count table to determine the number of repeats
kcount table kwarp, icount
;Add one increment to the count table and divide 1 by this value
;to determine a value for averaging the amplitude sum later
kaverage = 1/(kcount+1)
tablew kaverage, kwarp, icount
;If no repeated indexes are found then simply write the value
if (kcount = 0) then
tablew kFreq, kwarp, ifreqout
tablew kAmp, kwarp, iampout
;else, if the new amplitude value is larger than the old one
;use the freq value & add the new amp value to the old one
elseif (kAmp>kAmpTest) then
tablew kFreq, kwarp, ifreqout
tablew kAmp+kAmpTest, kwarp, iampout
elseif (kAmp 0) then ; only proc when frame is ready
;the UDO reference is placed here to Frequency warp the PVS data
warp iNumBins, iampin, ifreqin, iampout, ifreqout, iwarpfunction, icount
; read data back to fsrc
pvsftr fsig1, iampout, ifreqout
;note that iamp and ifreq have been replaced by iampout and ifreqout
endif
aout1 pvsynth fsig1
outs aout1
endin
i 1 0 20
e
Version: 3
Render: Real
Ask: Yes
Functions: ioObject
Listing: Window
WindowBounds: 0 62 801 140
CurrentView: io
IOViewEdit: On
Options: -b128 -A -s -m167 -R
ioView background {32125, 41634, 41120}