«OceanTracker» by Scott L Simon

on 10 Jan'19 09:25 in synthesismappingmetering

Experiments in metering and mapping a synth using sendreply.kr and Level-Indicator.

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
114
115
116
117
118
119
120
121
//this block evaluate first.  Synth add and arrays initialize...

(
~ocean = Array.new(8);
~oceanz = Array.new(8);


SynthDef.new(\ocean,{

	var sig, mod;
	sig = BrownNoise.ar(0.15!2);
	mod = SinOsc.kr(0.2, 3pi/2).exprange(0.001,1);
	sig = sig * mod;
	sig = sig +(GVerb.ar(sig, 200,5) * 0.2);
	SendReply.kr(Impulse.kr(20), '/ocean', mod, 1);
	SendReply.kr(Impulse.kr(20), '/ocean2', sig, 1);
	Out.ar(0, sig);
}).add;
)



//the OSC defs to read the sendReplies and put them into the array.  Evaluate this...

(
OSCdef.new(\tracker,{
	arg msg;
	//~ocean.postln;
	~ocean.add( msg[3]);

	if(~ocean.size>=8,{
			~ocean.pop;
		});

		~ocean.addFirst(msg[3]);

}, '/ocean');




OSCdef.new(\tracker2,{
	arg msg;
	//~oceanz.postln;
	~oceanz.add( msg[3]);

	if(~oceanz.size>=8,{
			~oceanz.pop;
		});

		~oceanz.addFirst(msg[3]);

}, '/ocean2');
)

//start the synth.
x = Synth(\ocean);

//evaluate the GUI / metering.  Shows 2 rows of metering one of the Sine wave as an envelope and the other the Noise as it is scaled.

(
var indicators, indicators2, updateIndicators, updateIndicators2, test;



// create window
var window = Window.new("OceanData",360@420).front.onClose_({ updateIndicators.stop });
q = window.addFlowLayout; // add flowLayout

// create and customize 8 Level indicators

indicators = Array.fill(8, {LevelIndicator(window,40@200)});
q.nextLine;
indicators2 = Array.fill(8, {LevelIndicator(window,40@200)});

indicators.do { arg item;
  item.warning_(0.8).critical_(0.9).background_(Color.green(0.4)).drawsPeak_(true);
	item.meterColor = Color.blue(0.9,0.4);
};

indicators2.do { arg item;
	item.warning_(0.8).critical_(0.9).background_(Color.white(0.1,0.5)).drawsPeak_(true);
};

// update the indicators with a routine
updateIndicators = fork{loop{
indicators.do{ arg item, i; {

var value = ~ocean[i];  // read value
item.value_(value);
item.peakLevel_(value);

}.defer();  // schedule in the AppClock
};
0.1.wait;
}};

updateIndicators2 = fork{loop{
  indicators2.do{ arg item, i; {

    var value = ~oceanz[i]*5;

    item.value_(value);
    item.peakLevel_(value);

  }.defer();  // schedule in the AppClock
  };

  0.1.wait;
}};

//get rid of everything at the same time.
CmdPeriod.doOnce({ window.close });
window.onClose_({ x.free });

/*CmdPeriod.doOnce({ window.close });
window.onClose_({ CmdPeriod.run});*/
)

/*Fieldsteel's Synthdef used - with a couple of additions.
Some of the metering modded from Koutsomichalis.*/
raw 2565 chars (focus & ctrl+a+c to copy)
reception
comments