// Frequency shifter using a hilbert transformer filter // this filter takes an input signal and returns two copies // of it out of phase by 90 degrees (pi/2 radians) ( SynthDef(\shifter, { arg dur=5, shift = 0.0, f0=100, amp = -6, numharms=10; var src, env; env = Line.kr(1, 1, dur, doneAction: 2); // harmonic source src = Blip.ar(f0, numharms, amp.dbamp); // we multiply hilbert's output by a cos and sin pair // of oscillators and add the result together Out.ar(0, Mix.ar(Hilbert.ar(src) * SinOsc.ar(shift, [ 0.5pi, 0.0 ]))) }).load(s) ) s = Server.internal.boot; FreqScope.new; z = s.scope(1); // with shift frequency 0 there is no change in the spectrum s.sendMsg(\s_new, \shifter, -1, 0, 0, \shift, 0, \f0, 200.0, \amp, -18, \numharms, 10); // 100 Hz shift s.sendMsg(\s_new, \shifter, -1, 0, 0, \shift, 100, \f0, 200.0, \amp, -18, \numharms, 10); // 82.842712474619 Hz shift (tritone) s.sendMsg(\s_new, \shifter, -1, 0, 0, \shift, 82.842712474619, \f0, 200.0, \amp, -18, \numharms, 10); // 200 Hz shift (octave) s.sendMsg(\s_new, \shifter, -1, 0, 0, \shift, 200.0, \f0, 200.0, \amp, -18, \numharms, 10);