«Subtractive Synthesis Demo with QuNeo - Patch 1» by Bruno Ruviaro

on 23 Sep'13 06:06 in subtractive synthesisquneowhite noise

QuNeo pads play filtered white noise. Midinote becomes center frequency of a Band Pass Filter.

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// ************************************
// Subtractive Synthesis Demo (QuNeo)
// Patch 1 - Filtered Noise
// Bruno Ruviaro, 2013-07-26
// ************************************

/*

Pads play "notes" made of filtered white noise.
(midinote becomes center frequency of a BPF).

Long Slider controls filter's bandwidth ('Q').

Vertical Sliders control ADSR envelope.

*/


s.waitForBoot({

	var padsArray, rqBus, ampAdjustmentBus, att = 0.01, dec = 0.3, sus = 1, rel = 1, quneoChannel;

	quneoChannel = 11;
	padsArray = Array.newClear(64);
	rqBus = Bus.control(s, 1).set(0.001);
	ampAdjustmentBus = Bus.control(s, 1).set(20);

	// MIDIIn.connectAll;

	MIDIdef.freeAll;

	~toQuNeo = MIDIOut.newByName("QUNEO-QUNEO MIDI 1", "QUNEO-QUNEO MIDI 1");

	MIDIdef.noteOn(
		key: \noteOn,
		func: {arg vel, note;
			var padNumber = note - 36; // starting from 0
			var padNote = padNumber + 60; // middle C for first pad
			padsArray[padNumber] = Synth("noise-quneo", [
				\freq, padNote.midicps,
				\amp, vel/127,
				\rq, rqBus.asMap,
				\ampAdjust, ampAdjustmentBus.asMap,
				\att, att,
				\dec, dec,
				\sus, sus,
				\rel, rel;
		])},
		noteNum: (36..99),
		chan: quneoChannel);

	MIDIdef.noteOff(
		key: \noteOff,
		func: {arg vel, note;
			var padNumber = note - 36;
			padsArray[padNumber].release},
		chan: quneoChannel);

	MIDIdef.cc(
		key: \adsr,
		func: {arg val, ccnum;
			case
			{ccnum==6} {att = val.linlin(0, 127, 0.01, 4)}
			{ccnum==7} {dec = val.linlin(0, 127, 0.05, 2)}
			{ccnum==8} {sus = val.linlin(0, 127, 0.10, 1)}
			{ccnum==9} {rel = val.linlin(0, 127, 0.05, 4)};
			[att, dec, sus, rel].round(0.01).postln},
		ccNum: (6..9),
		chan: quneoChannel); // Vertical Sliders
	~toQuNeo.control(0, 1, 0.3.linlin(0.01, 4, 0, 127));
	~toQuNeo.control(0, 2, 0.3.linlin(0.05, 2, 0, 127));
	~toQuNeo.control(0, 3, 1.linlin(0.1, 1, 0, 127));
	~toQuNeo.control(0, 4, 1.linlin(0.05, 4, 0, 127));

	MIDIdef.cc(
		key: \rqslider,
		func: {arg val, ccnum;
			var newVal = val.linexp(0, 127, 0.0001, 0.2);
			rqBus.value = newVal;
			ampAdjustmentBus.value = val.linexp(0, 127, 100, 1);
			("RQ is "++newVal.round(0.0001)).postln},
		ccNum: 10, // Long Slider
		chan: quneoChannel);

	~toQuNeo.control(0, 6, 1); // init Long Slider

	SynthDef("noise-quneo", {arg freq = 1000, amp = 0.1, rq = 0.001, att = 0.01, dec = 0.3, sus = 1, rel = 1, gate = 1, ampAdjust = 1;
		var snd, env;
		env = EnvGen.kr(Env.adsr(att, dec, sus, rel), gate: gate, doneAction: 2);
		snd = BPF.ar(WhiteNoise.ar(amp), freq, Lag.kr(rq, 1));
		snd = snd * env * Lag.kr(ampAdjust, 1);
		Out.ar(0, [snd, snd]);
	}).add;

}); // end of block
raw 2705 chars (focus & ctrl+a+c to copy)
reception
comments