Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WTB Datason Simple
(
Tdef(\player, {
var dt = (8*60)/10000;
var x = Synth(\additiveNoise, [\amp, 0.4]);
// var x = Synth(\additiveSon, [\amp, 0.4]);
// var x = Synth(\ampSon, [\amp, 1, \dt, dt * 2, \root, 60, \noteDist, 0.11, \lpFreq, 8000, \bumpy, 0.2]);
// var x = Synth(\ampSonTrig, [\amp, 1, \dt, dt * 2, \root, 200.cpsmidi, \noteDist, 1, \lpFreq, 10000, \bumpy, 0.5]);
s.sync;
4.do{
q.normalisedStripped.flop.do{|row|
// convert to 0..1
row = row / 4.8 + 0.5;
s.openBundle;
x.setn(
\freqs, row.collect{|val, i| q.freqSpecs[q.headers.wtb[i]].map(val)},
\fbs, row.collect{|val, i| q.fbs[q.headers.wtb[i]]} * 0.9,
\amps, row.drop(1),
);
x.set(\trig, 1);
s.closeBundle(s.latency);
dt.wait;
};
};
x.release;
}).play
)
Tdef(\player).play

// frequency ranges ( q.freqSpecs = ( \time: [100, 200, \exp],

\avg_hl_temp_E: [200, 800, \exp],
\avg_ll_temp_E: [200, 800, \exp],
\hl_temp_E: [200, 800, \exp],

\vent_petals_F: [800, 1600, \exp],
\vent_side_F: [800, 1600, \exp],

\hl_temp_F: [200, 800, \exp],

\vent_petals_G: [800, 1600, \exp],
\vent_side_G: [800, 1600, \exp],

\vent_petals_H: [800, 1600, \exp],
\vent_side_H: [800, 1600, \exp],

\hl_temp_H: [200, 800, \exp],

\ektron_E: [1600, 3200, \exp],
\ektron_air_temp_E: [200, 800, \exp],
\soil_temp_E: [200, 800, \exp],

\ektron_F: [1600, 3200, \exp],
\ektron_air_temp_F: [200, 800, \exp],
\soil_temp_F: [200, 800, \exp],

\ektron_G: [1600, 3200, \exp],
\ektron_air_temp_G: [200, 800, \exp],
\soil_temp_G: [200, 800, \exp],

\ektron_H: [1600, 3200, \exp],
\ektron_air_temp_H: [200, 800, \exp],
\soil_temp_H: [200, 800, \exp]

).collect(_.asSpec);

// presence q.fbs = ( \time: 0.1,

\avg_hl_temp_E: 1,
\avg_ll_temp_E: 1,
\hl_temp_E: 1,
\hl_temp_F: 1,
\soil_temp_E: 1,
\soil_temp_F: 1,
\soil_temp_G: 1,
\soil_temp_H: 1,
\hl_temp_H: 1,
\ektron_air_temp_E: 1,
\ektron_air_temp_F: 1,
\ektron_air_temp_G: 1,
\ektron_air_temp_H: 1,

\vent_petals_F: 0.5,
\vent_side_F: 0.5,
\vent_petals_G: 0.5,
\vent_side_G: 0.5,
\vent_petals_H: 0.5,
\vent_side_H: 0.5,
\ektron_E: 0.1,
\ektron_F: 0.1,
\ektron_G: 0.1,
\ektron_H: 0.1,

);

q.amps = ( \time: 0.1,

\avg_hl_temp_E: 0.25,
\avg_ll_temp_E: 0.25,
\hl_temp_E: 1,
\hl_temp_F: 1,
\hl_temp_H: 1,

\soil_temp_E: 1,
\soil_temp_F: 1,
\soil_temp_G: 1,
\soil_temp_H: 1,

\ektron_air_temp_E: 1,
\ektron_air_temp_F: 1,
\ektron_air_temp_G: 1,
\ektron_air_temp_H: 1,

\vent_petals_F: 0.5,
\vent_side_F: 0.5,
\vent_petals_G: 0.5,
\vent_side_G: 0.5,
\vent_petals_H: 0.5,
\vent_side_H: 0.5,

\ektron_E: 0.4,
\ektron_F: 0.4,
\ektron_G: 0.4,
\ektron_H: 0.4,

) )

(
q.seedData = thisThread.randData;
thisThread.randSeed = 20180907;
SynthDef(\additiveSon, {
var freqs = \freqs.kr(0!q.strippedData.size);
var snd = Splay.ar(
SinOscFB.ar(
VarLag.kr(
freqs,
\dt.kr(0)
),
\fbs.kr(0!q.strippedData.size),
mul: AmpComp.kr(freqs)
)
);
var env = EnvGen.kr(Env.adsr(1, 0, 1, 1), gate: \gate.kr(1), doneAction: 2);
Out.ar(0, snd * env * \amp.kr(0, 5));
}).add;
SynthDef(\additiveNoise, {
var freqs = \freqs.kr(0!q.strippedData.size) * 2;
var snd = Splay.ar(
BPF.ar(
PinkNoise.ar(
\amps.kr(0!q.strippedData.size) * AmpComp.kr(freqs),
),
VarLag.kr(
freqs,
\dt.kr(0)
),
0.02
).postln
);
var env = EnvGen.kr(Env.adsr(1, 0, 1, 1), gate: \gate.kr(1), doneAction: 2);
Out.ar(0, snd * env * \amp.kr(0, 5) * 8);
}).add;
SynthDef(\ampSon, {
var freqs, amps, snd, seed, env, filter;
var numPartials = q.strippedData.size;
// constant freqs, n octaves >> parch scale?
freqs = (Array.iota(numPartials) * \noteDist.kr(1) + \root.kr(50)).midicps.scramble;
amps = \amps.kr(0!numPartials);
snd = VarSaw.ar(freqs,
rand(1.0)!numPartials,
width: \fbs.kr(0!q.strippedData.size),
mul: AmpComp.ir(freqs) * amps
);
snd = Splay.ar(snd);
env = EnvGen.kr(Env.asr(1, 1, 1, 1), gate: \gate.kr(1), doneAction: 2);
snd = LPF.ar(snd, \lpFreq.kr(4000));
snd = snd * \amp.kr(0.1);
filter = JPverb.ar(snd, 2, 0.2, 1.2);
snd = SelectX.ar(0.2, [snd, filter]);
Out.ar(0, snd * env);
}).add;
SynthDef(\ampSonTrig, {
var freqs, amps, snd, seed, env, trig, filter, bumps;
var numPartials = q.strippedData.size;
// constant freqs, n octaves >> parch scale?
freqs = (Array.iota(numPartials) * \noteDist.kr(1) + \root.kr(50)).midicps.scramble;
amps = \amps.kr(0!numPartials);
trig = \trig.tr(0);
snd = VarSaw.ar(freqs,
rand(1.0)!numPartials,
width: \fbs.kr(0!q.strippedData.size),
mul: AmpComp.ir(freqs) * amps
);
snd = Splay.ar(snd);
env = EnvGen.kr(Env.asr(0, 1, 2, 1), gate: \gate.kr(1), doneAction: 2);
bumps = snd * EnvGen.kr(Env.perc(0.001, \dt.kr(0.1)), gate: trig);
snd = SelectX.ar(\bumpy.kr(0.1), [snd, bumps]);
snd = LPF.ar(snd, \lpFreq.kr(4000));
snd = snd * \amp.kr(0.1);
filter = JPverb.ar(snd, 2, 0.2, 1.2);
snd = SelectX.ar(0.2, [snd, filter]);
Out.ar(0, snd * env);
}).add;
// end controlled random
thisThread.randData = q.seedData;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment