[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] Hearing KeyTrack



Nice to hear what KeyTrack thinks:

d=Buffer.read(s,"/Users/nickcollins/Desktop/ML/training_wav/78.wav")
b = Buffer.alloc(s,4096,1); //for sampling rates 44100 and 48000

(
{

var in, fft, resample, chord, rootnote, sympath;
var key, transientdetection;

in= PlayBuf.ar(1,d.bufnum,BufRateScale.kr(d.bufnum),1,0,1);

fft = FFT(b.bufnum, in);

key=KeyTrack.kr(fft, 2.0, 0.5);
key.poll;
key = Median.kr(101, key); // Remove outlier wibbles

chord = if(key<12, #[0,4,7], #[0,3,7]);
rootnote = if(key<12, key, key-12) + 60;

sympath = SinOsc.ar((rootnote + chord).midicps, 0, 0.4).mean;

Out.ar(0,Pan2.ar(in, -0.5) + Pan2.ar(sympath, 0.5));
}.play
)