«Guitar feedback emulation» by nathanielvirgo

on 26 Aug'11 14:35 in feedbackguitar

A simulation of holding an electric guitar up to the amplifier, creating feedback. Press the mouse button to activate the whammy bar :)

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
39
40
41
42
43
(
Ndef(\z, {

	// get fed back signal and add a little noise to get things going
	var sig = Ndef(\z).ar + WhiteNoise.ar(0.001!2);
	var a, k, delfreq, minfreqs, freqs, dry;
		
	// delay due to distance from amp - I chose 0.05s, or 20Hz
	delfreq = 20;
	sig = DelayN.ar(sig,1/10-ControlDur.ir,1/delfreq-ControlDur.ir);

	// guitar string frequencies - for some reason I had to pitch them down
	// a few octaves to get a good sound.
	// open strings
	//// freqs = (64+[0,5,10,15,19,24]).midicps/8;
	// e minor
	freqs = (64+[0,7,12,15,19,24]).midicps/4;
	
	// whammy bar modulates freqs:
	minfreqs = freqs*0.5;
	freqs = freqs*MouseButton.kr(1,0.75,4);
	
	// 6 comb filters emulate the strings' resonances
	sig = CombN.ar(sig!6,1/minfreqs,1/freqs,8).mean;

	// a little filtering... mouse Y controls amp
	sig = LPF.ar(sig,8000);
	sig = HPF.ar(sig*MouseY.kr(0,5),80);

	// and some not too harsh distortion - mouse X controls damping
	sig = RLPFD.ar(sig,MouseX.kr(200,10000,1)*[1,1.1],0.1,0.5);
	sig = sig + sig.mean;

	// and finally a spot of reverb
	dry = sig;
	10.do {
		d = 0.2.rand;
		sig = AllpassN.ar(sig,d,d,5);
	};
	(dry + sig)*0.125;

}).play;
)
descendants
«Baris» by anonymous (private)
«hkfotlkc» by anonymous (private)
«rrkotvmpbsl» by anonymous (private)
full graph
raw 1191 chars (focus & ctrl+a+c to copy)
reception
comments
eli.fieldsteel user 26 Aug'11 23:13

Thanks NV, your code looks and sounds consistently impressive.

freejazztampa user 13 Nov'11 02:56

class not defined?

rukano user 14 Nov'11 08:22

I think RLPFD is in the sc3-plugins (BhobUGens)