«waveset resynthesis effect» by LFSaw

on 15 Mar'16 10:49 in resynthesismetawavesets

A WaveSet resynthesis engine to be used within the MeTA framework

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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// this uses RTWaveSet and MeTA
// http://3dmin-code.org/instrument-sketching/MeTA
// http://3dmin-code.org/instrument-sketching/RTWaveSets // closed source for now


// the data resource
// goes into 3_helperNdefs/wsData.scd
m.helpers[\wsData] = RTWaveSetData(server: m.server);


// waveset recorder
// goes into 3_efx/aux/wsAux.scd
Ndef(\ws).addSpec(\active, ControlSpec(0, 1, 'linear', 1, 0));
Ndef(\ws).addSpec(\leak,   ControlSpec(0.9, 1, 'exp', 0, 0));

m.aux[\ws] = Ndef(\ws, {
	var in = \in.ar(0!m.config.numChans).sum;
	in = LeakDC.ar(in, \leak.kr(0.995));
	RTWaveSetAnalysis.ar(m.helpers[\wsData], in, \active.kr(1))//.poll
});


// goes into 3_generators/wsResynth.scd
Ndef(\ws); // return value

(
Ndef(\wsResynth).ar(2);

// specs
// useful ranges  for controls
Ndef(\wsResynth).addSpec(\trig, [0.5, 100, \exp]);
Ndef(\wsResynth).addSpec(\rateIdx, [0, 5, \lin, 1]);
Ndef(\wsResynth).addSpec(\gSize, [1, 40, \lin, 1]);
Ndef(\wsResynth).addSpec(\repeat, [1, 10, \lin, 1]);
Ndef(\wsResynth).addSpec(\lpFreq, [100, 20000, \exp]);
Ndef(\wsResynth).addSpec(\amp, [0, 1]);             // amplitude
Ndef(\wsResynth).addSpec(\on, [0, 1, \lin, 1]);     // on/off

Ndef(\wsResynth, {
	var snd;
	var pan;

	// slow automated panning
	pan = LPF.kr(BrownNoise.kr, 1);


	snd = RTWaveSetPlayerTriggered.ar(

		// data input
		m.helpers[\wsData],

		// regular trigger,
		// rate changed each time rChange is called from the language
		// 5 * (0.125, 0.25 .. 2) // << possible rates
		// slowly adapting from previous level within 5 seconds
		Impulse.ar(
			\trig.kr(5) 
			* TRand.kr(0.125, 2, \rChange.tr(0))
			  .round(0.125).lag(5)
		),

		// just the last index
		RTWaveSetSelector.ar(m.helpers[\wsData]),

		// playback rate fixed to a bunch of values 
		// [0.125, 0.25, 0.5, 0.75, 1, 2] that are slightly off
		Select.kr(\rateIdx.kr(4), [0.125, 0.25, 0.5, 0.75, 1, 2]) 
		* LFNoise0.kr(0.2).range(0.95, 1.05),

		// group size between 1..40
		\gSize.kr(1),

		// repeat between 1..10
		\repeat.kr(1));

	// oh yeah, this is my personal phase-panning
	snd = m.utils[\phasePan].value(snd, pan);

	// turn-on-the-sound-mechanism
	(snd * \amp.kr(1)).tanh * \on.kr(0, 0.2);

}).play;

);


////////////// MAPPING ///////////////////////

// on/off
Ndef(\wsResynth).addHalo(\offFunc, {
	Ndef(\wsResynth).set(\on, 0);
});

Ndef(\wsResynth).addHalo(\onFunc, {
	Ndef(\wsResynth).set(\on, 1);
});


// knobs used to set rate, groupSize and repeat
Ndef(\wsResynth).addHalo(\sndA, {|value|
	Ndef(\wsResynth).setUni(\rateIdx, value)
});
Ndef(\wsResynth).addHalo(\sndB, {|value|
	Ndef(\wsResynth).setUni(\gSize, value)
});
Ndef(\wsResynth).addHalo(\pan, {|value|
	Ndef(\wsResynth).setUni(\repeat, value)
});

// button triggers new arbitrary rate
Ndef(\wsResynth).addHalo(\fcs, {|value|
	Ndef(\wsResynth).set(\rChange, 1.postln)
});
raw 2937 chars (focus & ctrl+a+c to copy)
reception
comments