Straighten Up!

Sing whatever pitch you like into the microphone, but have the output conform to the key you press on your connected MIDI keyboard, like a very low-rent Autotune.

(back to Code Pool)

// by nonprivate April 2009 // best used with headphones // execute one by one...

s = Server.local.boot; b = 200;		// no. of control bus to use for pitch control (	SynthDef("straightenUp", { |baseFreq = 100| var in, freq, hasFreq, out; in = Mix.new(SoundIn.ar([0,1])); # freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7); out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0); Out.ar(0,[out, out]) }	).send(s); )

s.sendMsg("/s_new", "straightenUp", n = s.nextNodeID, 1, 0);

s.sendMsg("/n_map", n, "baseFreq", b);

(	c = NoteOnResponder( { |src,chan,note,vel| s.sendMsg("/c_set", b, note.midicps); },		nil, // any source nil, // any channel nil, // any note nil // any vel ); )

test edit