(
SynthDef("Harm", {|offSet1, offSet2, output, osc1, osc2, mix, pitch1, pitch2, fader|
var sound = SoundIn.ar;
var pitch = Tartini.kr(sound)[0];
var amp = Amplitude.ar(sound);
pitch = Median.kr(5, pitch); // smooth
pitch = pitch.min(10000).max(10); // limit
pitch1 = pitch.cpsmidi.round + 40;
pitch2 = pitch.cpsmidi.round + 60;
pitch1 = pitch1.midicps;
pitch2 = pitch2.midicps;
osc1 = Saw.ar(pitch1, amp * 2); // resynthesise
osc2 = Pulse.ar(pitch2, 0.2, amp * 2);
mix = Mix.ar([osc1, osc2]);
fader = XFade2.ar(sound, mix, -0.5);
output = FreeVerb.ar(fader, 0.3, 0.1, 0.9); // bit of reverb just to taste
Out.ar(0, output);
}).memStore;
)
x = Synth("Harm");
Here Im using Tartini to determine the pitch of the input, then using fairly roundabout method converting it to two lots of midi notes, adding to it to increase the pitch then sending it to some oscillators and finally mixing it back with the original input. If you change the numbers that I've added to the pitches here,
pitch1 = pitch.cpsmidi.round + 40;
pitch2 = pitch.cpsmidi.round + 60;
you should be able to change the 'harmony'.
There may be a better method to shift the synthesised pitches, I'm not sure but this does seem to work.
It sort of sound okay with some guitar or vocal input, but really bad with anything more complex.
Hé dude ca fait un moment que tu ne postes plus, j'éspère que le blog n'est pas mort... C'est pas comme ci ca courait les rues des blog sur supercollider.
ReplyDeleteBye