{
   "labels" : [
      "effect",
      "autotune",
      "pitch correction"
   ],
   "is_private" : null,
   "id" : "1-570",
   "code" : "// 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.\r\n// by nonprivate April 2009\r\n// best used with headphones\r\n// execute one by one...\r\n\r\ns = Server.local.boot;\r\nb = 200;\t\t// no. of control bus to use for pitch control\r\n(\r\n\tSynthDef(\"straightenUp\",\r\n\t\t{ |baseFreq = 100|\r\n\t\r\n\t\tvar in, freq, hasFreq, out;\r\n\t\tin = Mix.new(SoundIn.ar([0,1]));\r\n\t\t# freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);\r\n\t\tout = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);\r\n\t\tOut.ar(0,[out, out])\r\n\t\t}\r\n\t).send(s);\r\n)\r\n\r\ns.sendMsg(\"/s_new\", \"straightenUp\", n = s.nextNodeID, 1, 0);\r\n\r\ns.sendMsg(\"/n_map\", n, \"baseFreq\", b);\r\n\r\n(\r\n\tc = NoteOnResponder(\r\n\t\t{ |src,chan,note,vel|\r\n\t\t\r\n\t\ts.sendMsg(\"/c_set\", b, note.midicps);\r\n\t\t\r\n\t\t},\r\n\t\tnil, // any source\r\n\t\tnil, // any channel\r\n\t\tnil, // any note\r\n\t\tnil // any vel\r\n\t);\r\n\t\r\n)",
   "name" : "Straighten Up!",
   "author" : "codepool",
   "ancestor_list" : [],
   "description" : "Migration from the old SourceForge wiki."
}
