// title: 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. // code: SynthDef(\pitchTrack, { var soundin = SoundIn.ar(0); var zc = ZeroCrossing.ar(soundin); // var pt = Pitch.kr(soundin); // var tt = Tartini.kr(soundin); SendReply.kr(Impulse.kr(1), '/pitchTrackUtil', [zc, zc.cpsmidi]); }).add; ~pitchTrack = { if(~pitchTrackSynth.isNil or: { ~pitchTrackSynth.isRunning.not }, { ~pitchTrackSynth = Synth(\pitchTrack); ~pitchTrackNW = NodeWatcher.register(~pitchTrackSynth); }, { ~pitchTrackSynth.free; ~pitchTrackSynth = nil; "Pitch tracker stopped.".postln; }); }; ~pitchTrackOSCFunc = { OSCFunc({ | msg | ("Pitch:"+msg[3].round.asString.padLeft(5)+msg[4].round.asString.padLeft(3)).postln; }, '/pitchTrackUtil'); }; ~pitchTrackOSCFunc.(); CmdPeriod.add({~pitchTrackOSCFunc.();});