Shepard tone 2

Shorter version of Shepard tone

Log in to post a comment.

/*
// Using adsr envelopes
// Start synths in sequence (takes a while to start)
loop( () => {
    for(let i=0; i<5; i++) {
        sine.play( (tick) => (40 + tick), {env:adsr, attack:30, release:30});
        sleep(12);
    }
});
*/

const tri = synth.def( (phase,env) => Math.asin(Math.sin(2*Math.PI*phase)) * env.value);

// Using manually-defined envelopes by setting options.amp to be a function of tick
for(let i=0; i<5; i++) {
    tri.play( (t) => (40 + (t + 12*i)%60),
               {env:one, amp: (t) => Math.sin(Math.PI*(t+12*i)/60)**4} );
}