{
   "labels" : [
      "utility",
      "convenience",
      "pitch",
      "pitch tracking"
   ],
   "is_private" : null,
   "id" : "1-4UW",
   "code" : "SynthDef(\\pitchTrack, {\r\n\tvar soundin = SoundIn.ar(0);\r\n\tvar zc = ZeroCrossing.ar(soundin);\r\n\t// var pt = Pitch.kr(soundin);\r\n\t// var tt = Tartini.kr(soundin);\r\n\tSendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]);\r\n}).add;\r\n\r\n~pitchTrack = {\r\n\tif(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, {\r\n\t\t~pitchTrackSynth = Synth(\\pitchTrack);\r\n\t\t~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth);\r\n\t}, {\r\n\t\t~pitchTrackSynth.free;\r\n\t\t~pitchTrackSynth = nil;\r\n\t\t\"Pitch tracker stopped.\".postln;\r\n\t});\r\n};\r\n\r\n~pitchTrackOSCFunc = {\r\n\tOSCFunc({\r\n\t\t| msg |\r\n\t\t(\"Pitch:\"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln;\r\n\t}, '/pitchTrackUtil');\r\n};\r\n\r\n~pitchTrackOSCFunc.();\r\n\r\nCmdPeriod.add({~pitchTrackOSCFunc.();});",
   "name" : "pitch tracker utility",
   "author" : "defaultxr",
   "description" : "This is a small utility i wrote to make it easy to detect the pitch of incoming audio (i.e. your voice into your mic). I recommend binding the execution of \"~pitchTrack.();\" to a keyboard shortcut in your editor/IDE. It's incredibly convenient to just input a hotkey and instantly see information about the current frequency and MIDI note number for the incoming audio. Because of how i've written ~pitchTrack, you can use the same hotkey to halt the pitch tracker synth as well. This utility makes it much easier to write melodies if you don't have perfect pitch.",
   "ancestor_list" : []
}
