all pieces are routed to mixer in live utility

main
mwinter 1 year ago
parent 502a0423ee
commit 4a6fabce8d

@ -47,7 +47,7 @@
"top": 240,
"left": 40,
"lock": false,
"id": "mixer/berger/pan",
"id": "mixer/hdp/pan",
"visible": true,
"interaction": true,
"comments": "",
@ -99,7 +99,7 @@
"top": 20,
"left": 40,
"lock": false,
"id": "mixer/berger/volume",
"id": "mixer/hdp/volume",
"visible": true,
"interaction": true,
"comments": "",
@ -151,7 +151,7 @@
"top": 290,
"left": 40,
"lock": false,
"id": "mixer/berger/mute",
"id": "mixer/hdp/mute",
"visible": true,
"interaction": true,
"comments": "",
@ -250,7 +250,7 @@
"top": 0,
"left": 0,
"lock": false,
"id": "mixer/berger/volume/master",
"id": "mixer/hdp/volume/master",
"visible": true,
"interaction": true,
"comments": "",
@ -595,9 +595,9 @@
"Berger": "berger",
"Robinson": "robinson",
"Penrose": "penrose",
"Ammann": "Ammann",
"Kari": "Kari",
"Jaendel": "Jaendel"
"Ammann": "ammann",
"Kari": "kari",
"Jaendel": "jaendel"
},
"mode": "tap",
"value": "",

@ -1,7 +1,7 @@
(
var createTransportPattern;
~bergerBusArray = 6.collect({Bus.audio(s, 1)});
~hdpBusArray = 16.collect({Bus.audio(s, 1)});
Event.addEventType(\osc, {
if (~addr.postln.notNil) {
@ -12,7 +12,7 @@ Event.addEventType(\osc, {
//create synth defs
~bergerCreateSynthsForLive = {arg b;
~bergerCreateSynthsForLive = {var b;
// this creates a different waveform for each sonification of each part
Buffer.freeAll(s);
b = 8.collect({var buf = Buffer.alloc(s, 512, 1); buf.sine1(1.0 / 5.collect({arg i; pow(i + 1, 5.0.rand + 1)}), true, true, true)});
@ -22,7 +22,7 @@ Event.addEventType(\osc, {
}).add;
};
~robinsonCreateSynthsForLive = {arg b;
~robinsonCreateSynthsForLive = {var b;
Buffer.freeAll(s);
b = 8.collect({var buf = Buffer.alloc(s, 512, 1); buf.sine1(1.0 / 5.collect({arg i; pow(i + 1, 5.0.rand + 1)}), true, true, true)});
@ -31,7 +31,7 @@ Event.addEventType(\osc, {
}).add;
};
~penroseCreateSynthsForLive = {arg b;
~penroseCreateSynthsForLive = {var b;
Buffer.freeAll(s);
b = 8.collect({var buf = Buffer.alloc(s, 512, 1); buf.sine1(1.0 / 5.collect({arg i; pow(i + 1, 5.0.rand + 1)}), true, true, true)});
@ -44,6 +44,43 @@ Event.addEventType(\osc, {
}).add;
};
~ammannCreateSynthsForLive = {var b;
Buffer.freeAll(s);
b = 6.collect({var buf = Buffer.alloc(s, 512, 1); buf.sine1(1.0 / 5.collect({arg i; pow(i + 1, 5.0.rand + 1)}), true, true, true)});
SynthDef(\ammann, {arg freq, amp, del = 5, gate = 1, sustain = 1, buf = 0, out = 0;
Out.ar(out, Osc.ar(Select.kr(buf, b), freq, 0, amp) * EnvGen.kr(Env.adsr(0.05, sustain, 0.5, 0.1), gate, 1, 0, 1, doneAction: 2));
}).add;
};
~kariCreateSynthsForLive = {
SynthDef(\kariEnsemble, {arg freq = 110, amp = 1, gate = 1, sustain = 1, dur = 1, out = 0;
Out.ar(out, SinOsc.ar(freq, 0, 0.1) *
pow(EnvGen.kr(Env.sine(sustain, amp / 5), gate, 1, 0, 1, doneAction: 2), 0.5) * 0.25);
}).add;
SynthDef(\kariBass, {arg freq = 110, amp = 1, gate = 1, sustain = 1, dur = 1, out = 0;
Out.ar(out, SinOsc.ar(freq, 0, 0.1) *
EnvGen.kr(Env.adsr(1, dur - 1.3, 0.25, 0.3, 1), gate, doneAction: 2) * 1);
}).add;
SynthDef(\kariNoise, {arg snd = 0, amp = 1, gate = 1, sustain = 1, dur = 1, out = 0;
Out.ar(out, Select.ar(snd, [WhiteNoise.ar(0.5), DC.ar(0), BrownNoise.ar(0.7)]) *
EnvGen.kr(Env.asr(dur, amp / 5, 3), gate, doneAction: 2) * 0.3);
}).add;
};
//sine tones for sonification
~jaendelCreateSynthsForLive = {
SynthDef(\jaendel, {arg freq, col, attack, sustain, decay, del = 5, gate = 1, pan = 0, pIndex = 0;
var env;
env = EnvGen.kr(Env.new([0, 1, 1, 0], [attack, sustain, decay], \sin), 1, 1, 0, 1, doneAction: 2);
//color is mapped to panning similar to the score which maps to different ways of playing the same note
Out.ar(pIndex * 2, SinOsc.ar(freq, 0, (((col >= 1) * (col <= 1)) + (col >= 3)).lag(0.3) * env * 0.05));
Out.ar(pIndex * 2 + 1, SinOsc.ar(freq, 0, (col >= 2).lag(0.3) * env * 0.05));
}).add;
};
//create patterns
~bergerCreatePatternsForLive = {arg seqs, group;
@ -53,7 +90,7 @@ Event.addEventType(\osc, {
//\buf, Pseq((i - ((0..(r.slice(nil, 2).flat.size - 1)) / 10).trunc.asInteger) % 8),
\group, group,
\buf, i,
\out, ~bergerBusArray[i],
\out, ~hdpBusArray[i],
//\freq, Pseq(55 * r[1]),
\freq, Pseq((55 * r[1]).cpsmidi.round(0.5).midicps),
\dur, Pseq(r[0]),
@ -69,6 +106,8 @@ Event.addEventType(\osc, {
pBinds = seqs[0].collect({arg r, i;
Pbind(\instrument, \robinson,
\buf, i,
\group, group,
\out, ~hdpBusArray[i],
\freq, Pseq(12.midicps * r.slice(nil, 1)),
\dur, Pseq(r.slice(nil, 0) * 0.25 * (3/4)),
\sustain, Pseq(r.slice(nil, 0) * 0.25 * (3/4)),
@ -83,6 +122,7 @@ Event.addEventType(\osc, {
Pbind(\instrument, \penrose_ins,
\group, group,
\buf, i,
\out, ~hdpBusArray[i],
//\freq, Pseq((24.midicps * r[1]).cpsmidi.round(0.5).midicps),
\freq, Pseq((24.midicps * r[1])),
\dur, Pseq(r[0] * 0.125),
@ -91,27 +131,107 @@ Event.addEventType(\osc, {
)
});
/*
finFades = seqs[2].collect({ arg r, i;
Pbind(\instrument, \penrose_fades,
\group, group,
\out, ~hdpBusArray[i],
\dur, Pseq(r * 0.125),
\subSeqLength, Pseq(r * 0.125),
\ins, i
)
});
*/
finSeqs /*++ finFades*/;
};
~ammannCreatePatternsForLive = {arg seqs, group;
var finSeqs;
finSeqs = seqs.collect({arg r, i;
Pbind(\instrument, \ammann,
//\buf, Pseq((i - ((0..(r.slice(nil, 2).flat.size - 1)) / 10).trunc.asInteger) % 8),
\group, group,
\buf, i,
\out, ~hdpBusArray[i],
\freq, Pseq((55 * r.slice(nil, 2).flatten).cpsmidi.round(0.5).midicps),
\dur, Pseq(r.slice(nil, 0).flat),
//this is a bit tricky it makes it so that each note goes to the next
//(ignoring the old sustain value)
//but the rests are kept to make it clear where the note falls in each measure
//for the transcriber
\sustain, Pseq(
[r.slice(nil, 0).flat.drop(1).clump(2).size.collect({Rest(1)}),
r.slice(nil, 0).flat.drop(1).clump(2).collect({arg item; item.sum})].flop.flat
),
//\sustain, Pseq(r.slice(nil, 1).flat ),
\amp, Pseq(r.slice(nil, 3).flat * 0.5)
)
});
finSeqs;
};
~kariCreatePatternsForLive = {arg dirs, group;
[
Pbind(\instrument, \kariNoise,
\group, group,
\out, 5,
\dur, Pseq(dirs[0].slice(nil, 1) * 1.2),
\snd, Pseq(dirs[0].slice(nil, 0))),
Pbind(\instrument, \kariBass,
\group, group,
\out, 6,
\dur, Pseq(dirs[1].slice(nil, 1) * 1.2),
\freq, Pseq((dirs[1].slice(nil, 0).collect({arg elem; [Rest(0), 36.midicps, 43.midicps][elem]})))),
] ++
dirs.drop(2).collect({arg row, i;
Pbind(\instrument, \kariEnsemble,
\group, group,
\out, i,
\dur, Pseq(row.slice(nil, 1) * 1.2),
//\sustain, Pseq(row.slice(nil, 1) * 1.2),
\freq, Pseq(row.slice(nil, 0).collect({arg val; if(val == 5, {Rest(0)}, {(60 + (val.trunc * 7)).midicps})})),
\amp, 1)})
};
~jaendelCreatePatternsForLive = {arg colors, version = 0 /*0 is full; 1 is reduced*/, startHarm = 1 /*must be odd*/, fund = 55, group;
//generate patterns
colors.collect({arg row, r;
var durUnit, del, eDur, start, stop, harms, fade, pIndex;
durUnit = 1 / 6; // 90 bpm
// 2 measures for full version, 1 for reduced version
del = if(version == 0, {(32 * (r % 16)) + (512 * (r / 16).asInteger)}, {(32 * (r % 8)) + (512 * (r / 8).asInteger)});
pIndex = if(version == 0, {(r % 16)}, {(r % 8)});
eDur = if(version == 0, {512 - 64}, {512 - 16}); // 32 - 4 measures for full version, 16 - 1 for reduced version
start = del - r; // this skews the tiling
stop = (start + eDur) - 1;
harms = ((0..(if(version == 0, {15}, {7}))) * 2).reverse + startHarm;
fade = if(version == 0, {64}, {64});
Pmono(\jaendel,
\group, group,
\pIndex, pIndex,
\dur, Pseq([Rest(del * durUnit), Pseq([durUnit], inf)]),
\freq, fund * harms[r % if(version == 0, {16}, {8})],
\col, Pseq([0, Pseq(row[start..stop])]),
\attack, fade * durUnit,
\sustain, (eDur - (fade * 2)) * durUnit,
\decay, fade * durUnit,
)
});
};
SynthDef(\mixer, {arg freq, gate = 1, sustain, amp, dur, out;
var nameSpaces, sigs;
sigs = [~bergerBusArray].collect({arg busArray, i;
sigs = [~hdpBusArray].collect({arg busArray, i;
var nameSpace, sig;
nameSpace = ['berger', 'sine', 'bass', 'hdust', 'sampler'][i];
nameSpace = ['hdp'][i];
sig = busArray.collect({arg bus, c; In.ar(bus, 1) * NamedControl.kr(\ ++ nameSpace ++ '_volume_' ++ c, 1, 0.1)});
sig = sig.collect({arg channel, c; Pan2.ar(channel, NamedControl.kr(\ ++ nameSpace ++ '_pan_' ++ c, i / (busArray.size - 1), 0.1) * 2 - 1)});
sig = sig.collect({arg channel, c; channel * NamedControl.kr(\ ++ nameSpace ++ '_mute_' ++ c, 1, 0.1)});
@ -129,7 +249,29 @@ SynthDef(\mixer, {arg freq, gate = 1, sustain, amp, dur, out;
var createTransportData, createTransportPattern, group, berger, mixer, measureLengths, seqs, transportData, playbackData, player;
createTransportData = {arg measureLengths;
measureLengths.collect({arg beats, measure; beats.asInteger.collect({arg beat; [measure + 1, beat + 1]})}).flatten;
measureLengths.collect({arg dur, measure;
var beats;
if(dur.round(0.5) % 1 == 0, {
dur.asInteger.collect({arg beat;
[measure + 1, beat + 1, 1]
})
}, {
var eigths, beatDurs;
eigths = (dur / 0.5).round(0.5).asInteger;
beatDurs = case
{eigths <= 3} {[dur]}
{eigths == 5} {[1, 1.5]}
{eigths == 7} {[1, 1, 1.5]}
{eigths == 9} {[1, 1, 1, 1.5]}
{eigths == 11} {[1, 1, 1, 1, 1.5]}
{eigths == 13} {[1, 1, 1, 1, 1, 1.5]}
{eigths == 15} {[1, 1, 1, 1, 1, 1, 1.5]};
beatDurs.collect({arg bDur, beat;
[measure + 1, beat + 1, bDur]
})
});
}).flatten;
};
createTransportPattern = {arg addr, transportData;
@ -137,14 +279,17 @@ createTransportPattern = {arg addr, transportData;
\type, \osc,
\addr, addr,
\path, "/playing",
\msg, Pseq(transportData, 1),
\dur, 1
\msg, Pseq(transportData.collect({arg item; [item[0], item[1]]}), 1),
\dur, Pseq(transportData.collect({arg item; item[2]}), 1),
);
};
~bergerCreateSynthsForLive.value;
~robinsonCreateSynthsForLive.value;
~penroseCreateSynthsForLive.value;
~ammannCreateSynthsForLive.value;
~kariCreateSynthsForLive.value;
~jaendelCreateSynthsForLive.value;
group = Group.new;
berger = Synth.tail(group, \berger);
@ -164,6 +309,18 @@ seqs = File.readAllString((~dir +/+ "music_data" +/+ "penrose.txt").standardizeP
measureLengths = seqs[1].sum.collect({4});
playbackData.add(\penrose -> [~penroseCreatePatternsForLive.value(seqs, group), createTransportData.value(measureLengths), measureLengths]);
seqs = File.readAllString((~dir +/+ "music_data" +/+ "ammann.txt").standardizePath).interpret;
measureLengths = seqs[0].collect({arg item; item[0].sum});
playbackData.add(\ammann -> [~ammannCreatePatternsForLive.value(seqs, group), createTransportData.value(measureLengths), measureLengths]);
seqs = File.readAllString((~dir +/+ "music_data" +/+ "kari.txt").standardizePath).interpret;
measureLengths = seqs[0].collect({arg item; item.last}).flatten;
playbackData.add(\kari -> [~kariCreatePatternsForLive.value(seqs, group), createTransportData.value(measureLengths), measureLengths]);
seqs = File.readAllString((~dir +/+ "music_data" +/+ "jaendel.txt").standardizePath).interpret;
measureLengths = 284.collect({4});
playbackData.add(\jaendel -> [~jaendelCreatePatternsForLive.value(seqs, 0, 1, 55, group), createTransportData.value(measureLengths), measureLengths]);
OSCdef(\mixer, {arg msg, time, addr, port;
msg.postln;
@ -172,14 +329,15 @@ OSCdef(\mixer, {arg msg, time, addr, port;
OSCdef(\transport, {arg msg, time, addr, port;
msg.postln;
if(msg[1].postln == 0, {
if(msg[1] == 0, {
//need some work here to make sure all synths are getting cutoff correctly
group.set(\release, 2);
group.set(\gate, 0);
player.stop;
}, {
var pbinds, transportData, measureLengths, patterns, stream, offset, offsetStream, terminationStream;
# pbinds, transportData, measureLengths = playbackData[msg[2]];
patterns = Ppar(pbinds.add(createTransportPattern.value(addr, transportData)));
patterns = Ppar(pbinds.postln.add(createTransportPattern.value(addr, transportData).postln));
stream = patterns.asStream;
offset = stream.fastForward(measureLengths.keep(msg[3].asInteger - 1).sum);
@ -194,7 +352,14 @@ OSCdef(\transport, {arg msg, time, addr, port;
)
~penroseMusic[1]
/*
TODOs:
- get synths to stop/cutoff correctly
- check and fix part ordering for each piece
- check and fix tempos for each piece
- make tempo variable
- set levels
*/
/*
~bergerCreateSynthsForLive.value;

@ -53,6 +53,9 @@ s.record(~dir +/+ ".." +/+ "recs" +/+ "penrose.wav", duration: (30 * 60));
~ammannTranscribe.value(~ammannMusic);
~visualize.value(~ammann.value(200, 200), 0, 0, name: "ammann")
s.record(~dir +/+ ".." +/+ "recs" +/+ "ammann.wav", duration: (30 * 60));
~ammannMusicFile = File((~dir +/+ "music_data" +/+ "ammann.txt").standardizePath, "w");
~ammannMusicFile.write(~ammannMusic.asCompileString);
~ammannMusicFile.close
~kariTiling = ~kari_culik.value(500, 500, 0, 0, true);
@ -63,6 +66,9 @@ s.record(~dir +/+ ".." +/+ "recs" +/+ "ammann.wav", duration: (30 * 60));
~kariTranscribe.value(~kariMusic);
~visualize.value(~kari_culik.value(200, 200, 0, 5, true), 0, 0, scale: 1, name: "kari");
s.record(~dir +/+ ".." +/+ "recs" +/+ "kari_culik.wav", duration: (30 * 60));
~kariMusicFile = File((~dir +/+ "music_data" +/+ "kari.txt").standardizePath, "w");
~kariMusicFile.write(~kariMusic.asCompileString);
~kariMusicFile.close
~jaendelTiling = ~jaendel.value(14, 0, 0, 0);
@ -73,6 +79,9 @@ s.record(~dir +/+ ".." +/+ "recs" +/+ "kari_culik.wav", duration: (30 * 60));
~jaendelTranscribe.value(~jaendelMusic);
~visualize.value(~jaendelTiling, 0, 0, name: "jaendel");
s.record(~dir +/+ ".." +/+ "recs" +/+ "jaendel_rao.wav", duration: 30 * 60);
~jaendelMusicFile = File((~dir +/+ "music_data" +/+ "jaendel.txt").standardizePath, "w");
~jaendelMusicFile.write(~jaendelMusic.asCompileString);
~jaendelMusicFile.close
//~~~~~~~~~crypto visualizer code

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save