/* Blip (aka buzz) generator uses close form summation formula to generate band-limited impulses (check pg. 160 of the D&J book for the cool math) */ ( SynthDef(\pulsetrain, {arg dur, freq, amp; var env, pulse, numharms; env = EnvGen.kr( Env([0, 1, 1, 0], [0.01, dur - 0.02, 0.01], \sin), doneAction: 2); // by baseing the number of harmonics on the Nyquist, the signal will be band-limited. numharms = (SampleRate.ir * 0.4) / freq; // Numharms should be an integer. .floor will truncate the value of numharms. pulse = Blip.ar(freq, numharms.floor, amp.dbamp); Out.ar(0, pulse * env); }).load(s); ) s = Server.internal.boot; FreqScope.new; z = s.scope(1); s.sendBundle(0.1, [\s_new, \pulsetrain, -1, 0, 0, \dur, 5, \freq, 1000, \amp, -24]); z.window.close;