Skip to content

Instantly share code, notes, and snippets.

@hlolli
Created September 26, 2017 22:21
Show Gist options
  • Save hlolli/ecf158d0292d7267a9c1979948aff9ec to your computer and use it in GitHub Desktop.
Save hlolli/ecf158d0292d7267a9c1979948aff9ec to your computer and use it in GitHub Desktop.
;; Iain McCurdy's Shredulator as i-rate UDO
opcode shred,aa,aaiiiiiiiiiii
aL,aR,\
iMaxDelay,iTransPose,iTransRand,\
iDepth,iRate,iFeedback,iWidth,iwet,\
iFFTindex,iGain,iPrePost xin
iFFTsizes[] fillarray 128,256,512,1024,2048,4096 ;arrayofFFTsizevalues
iFFTsize = iFFTsizes[iFFTindex-1] ;retrieveFFTsizevaluefromarray
fsigInL pvsanal aL,iFFTsize,iFFTsize/4,iFFTsize,1 ;FFTanalyseaudio
fsigInR pvsanal aR,iFFTsize,iFFTsize/4,iFFTsize,1 ;FFTanalyseaudio
fsigFB pvsinit iFFTsize ;initialisefeedbacksignal
fsigMixL pvsmix fsigInL,fsigFB ;mixfeedbackwithinput
fsigMixR pvsmix fsigInR,fsigFB ;mixfeedbackwithinput
iHandle1,kTime pvsbuffer fsigMixL,i(iMaxDelay) ;createacircularfsigbuffer
kDly1 randomh 0,iMaxDelay*iDepth,iRate,1 ;delaytime
iTranspose1_2 random iTransPose-(2*iTransPose*iTransRand),iTransPose
fsigOut pvsbufread kTime-kDly1,iHandle1 ;readfrombuffer
fsigGran pvsgain fsigOut,1-iGain
fScale pvscale fsigGran,semitone(iTranspose1_2)
fsigFB pvsgain fScale,iFeedback ;createfeedbacksignalfornextpass
if iPrePost == 1 then
aDly pvsynth fsigGran ;resynthesisereadbufferoutput
else
aDly pvsynth fScale ;resynthesisereadbufferoutput
endif
aMix1 ntrpol aL,aDly,iwet ;dry/wetaudiomix
iHandle2,kTime pvsbuffer fsigMixR,iMaxDelay ;createacircularfsigbuffer
kDly2 randomh 0,iMaxDelay*iDepth,iRate,1 ;delaytime
iTranspose2_2 random iTransPose-(2*iTransPose*iTransRand),iTransPose
fsigOut pvsbufread kTime-kDly2,iHandle2 ;readfrombuffer
fsigGran pvsgain fsigOut,1-iGain
fScale pvscale fsigGran,semitone(iTranspose2_2)
fsigFB pvsgain fScale,iFeedback ;createfeedbacksignalfornextpass
if iPrePost == 1 then
aDly pvsynth fsigGran ;resynthesisereadbufferoutput
else
aDly pvsynth fScale ;resynthesisereadbufferoutput
endif
aMix2 ntrpol aR,aDly,iwet ;dry/wetaudiomix
xout aMix2+aMix1*(1-iWidth),aMix2*(1-iWidth)+aMix1
endop
instr 1
a1 poscil 0.65, p4
aL, aR shred a1, a1, 0.1, 1.5, 0.6, 2, 5, 0.3, 0.5, 1, 2, 0.2, 0
outs aL, aR
endin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment