«Straighten Up!» by codepool

on 27 Apr'17 22:17 in effectautotunepitch correction

Migration from the old SourceForge wiki.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 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.
// by nonprivate April 2009
// best used with headphones
// execute one by one...

s = Server.local.boot;
b = 200;		// no. of control bus to use for pitch control
(
	SynthDef("straightenUp",
		{ |baseFreq = 100|
	
		var in, freq, hasFreq, out;
		in = Mix.new(SoundIn.ar([0,1]));
		# freq, hasFreq = Pitch.kr(in, ampThreshold: 0.02, median: 7);
		out = PitchShift.ar(in, 0.08, (baseFreq / freq), 0.0, 0.0);
		Out.ar(0,[out, out])
		}
	).send(s);
)

s.sendMsg("/s_new", "straightenUp", n = s.nextNodeID, 1, 0);

s.sendMsg("/n_map", n, "baseFreq", b);

(
	c = NoteOnResponder(
		{ |src,chan,note,vel|
		
		s.sendMsg("/c_set", b, note.midicps);
		
		},
		nil, // any source
		nil, // any channel
		nil, // any note
		nil // any vel
	);
	
)
raw 938 chars (focus & ctrl+a+c to copy)
reception
comments