Hi,
I’m in the process of creating a Shepard’s tone patch. I’m aware that Eli Fieldsteel and others have done this, but I wanted to do it myself as an exercise for learning sc. My version seems to work well enough, except for small clicks whenever the cycle restarts. Patch is below. Any guidance would be greatly appreciated!
SynthDef.new(\Shepard, {
arg speed = 0.2, fund = 300;
var lowMidFreq, highMidFreq, lowMidAmp, highMidAmp, lowMid, highMid, sig;
lowMidFreq = fund*(LFSaw.ar(speed, 1).range(0.5,1));
highMidFreq = fund*(LFSaw.ar(speed, 1).range(1,2));
lowMidAmp = LFSaw.ar(speed, 1).range(0, 1)* AmpComp.ar(lowMidFreq);
highMidAmp = LFSaw.ar(speed, 1).range(1, 0)* AmpComp.ar(highMidFreq);
lowMid = SinOsc.ar(lowMidFreq)*lowMidAmp;
highMid = SinOsc.ar(highMidFreq)*highMidAmp;
sig = ((lowMid+highMid)/3)!2;
Out.ar(0, sig);
}).add;)
I’ve also tried subbing out LFSaw for SawDPW and a version that uses Impulse and Phasor. With LFSaw the clicks are not present at first but slowly creep in and become worse and worse. With SawDPW, the clicks are less audible, but are always there. With Phasor the clicks are always there and even worse than LFSaw. Changing the rate to LFSaw.kr and AmpComp.kr, and low-passing the Amplitude functions also both make things worse.