~track = "/Users/lcoogan/Music/Musicians/Xiu Xiu/01-xiu_xiu-sad_pony_guerilla_girl-sge.opus".standardizePath; ~bpm=116.6; ~track = "/Users/lcoogan/Music/Musicians/Broadcast/broadcast - tender buttons (2005)/05 - Tears in the Typing Pool.opus".standardizePath; ~bpm=145.1; ~looplen = 480/~bpm; b = Buffer.cueSoundFile(s, ~track, 0, 2); x = { DiskIn.ar(2, b) }.play; // Now the thing that will attempt to separate them out again (inc a buffer for it to use): ~loopbuf = Buffer.alloc(s, 1000, 513); ( y = { |which=1, active=1, thresh=1| var son = In.ar(0); var chain = FFT(LocalBuf(1024), son); chain = PV_ExtractRepeat(chain, ~loopbuf, ~looplen, memorytime:30, which:which, thresh:thresh); ReplaceOut.ar(0, Select.ar(active, [son, IFFT(chain)]).dup); }.play(x, addAction: \addAfter); ) y.set(\which, 0) // focus on the nonrepeating bit y.set(\which, 1) // focus on the repeating bit y.set(\active, 0) // back to normal y.set(\active, 1) // filter it again y.set(\which, 0, \thresh, 1.5) // trying a higher threshold y.free; x.free; b.close