adding audio click and fixing major bug for no 60 bpm tempo

main
mwinter 1 year ago
parent 05e64cdefa
commit bb805a9a48

@ -58,7 +58,7 @@
"visible": true,
"interaction": true,
"comments": "",
"width": "90%",
"width": "86%",
"height": "70%",
"expand": "false",
"colorText": "auto",
@ -106,13 +106,13 @@
{
"type": "panel",
"top": 0,
"left": "90%",
"left": "86%",
"lock": false,
"id": "@{parent.variables.piece}/mixer/hdp/master_panel",
"visible": true,
"interaction": true,
"comments": "",
"width": "10%",
"width": "7%",
"height": "100%",
"expand": "false",
"colorText": "auto",
@ -217,7 +217,7 @@
"visible": true,
"interaction": true,
"comments": "",
"width": "90%",
"width": "86%",
"height": "15%",
"expand": "false",
"colorText": "auto",
@ -269,7 +269,7 @@
"visible": true,
"interaction": true,
"comments": "",
"width": "90%",
"width": "86%",
"height": "15%",
"expand": "false",
"colorText": "auto",
@ -311,6 +311,111 @@
"onValue": "",
"widgets": [],
"tabs": []
},
{
"type": "panel",
"top": 0,
"left": "93%",
"lock": false,
"id": "@{parent.variables.piece}/mixer/hdp/click_panel",
"visible": true,
"interaction": true,
"comments": "",
"width": "7%",
"height": "100%",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"css": "",
"colorBg": "auto",
"layout": "default",
"justify": "start",
"gridTemplate": "",
"contain": true,
"scroll": true,
"innerPadding": true,
"tabsPosition": "top",
"variables": "@{parent.variables}",
"traversing": false,
"value": "",
"default": "",
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": "",
"widgets": [
{
"type": "fader",
"top": 0,
"left": 0,
"lock": false,
"id": "mixer/@{parent.variables.piece}/volume_click",
"visible": true,
"interaction": true,
"comments": "",
"width": "100%",
"height": "100%",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"css": "",
"design": "default",
"knobSize": "auto",
"horizontal": false,
"pips": false,
"dashed": false,
"gradient": [],
"snap": false,
"spring": false,
"doubleTap": false,
"range": {
"min": 0,
"max": 1
},
"logScale": false,
"sensitivity": 1,
"steps": "",
"origin": "auto",
"value": 0.75,
"default": 1,
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": "",
"onTouch": ""
}
],
"tabs": []
}
],
"tabs": []

@ -10,14 +10,19 @@ appEnvironment.push;
s.waitForBoot({
var hdpBusArray,
bergerCreateSynthsForLive, robinsonCreateSynthsForLive, penroseCreateSynthsForLive, ammannCreateSynthsForLive, kariCreateSynthsForLive, jaendelCreateSynthsForLive,
var hdpBusArray, clickBus, clickBufPrimary, clickBufSecondary,
bergerCreateSynthsForLive, robinsonCreateSynthsForLive, penroseCreateSynthsForLive, ammannCreateSynthsForLive, kariCreateSynthsForLive, jaendelCreateSynthsForLive, clickCreateSynthForLive,
bergerCreatePatternsForLive, robinsonCreatePatternsForLive, penroseCreatePatternsForLive, ammannCreatePatternsForLive, kariCreatePatternsForLive, jaendelCreatePatternsForLive,
createTransportData, createTransportPattern, dir, group, berger, mixer, measureLengths, seqs, transportData, playbackData, tempoClock, player;
createTransportData, createTransportPattern, createClickPattern, dir, group, berger, mixer, measureLengths, seqs, transportData, playbackData, tempoClock, player;
Buffer.freeAll(s);
c = Condition.new;
dir = thisProcess.nowExecutingPath.dirname;
hdpBusArray = 32.collect({Bus.audio(s, 1)});
clickBus = Bus.audio(s, 1);
Event.addEventType(\osc, {
if (~addr.postln.notNil) {
@ -31,7 +36,7 @@ s.waitForBoot({
//create synth defs
bergerCreateSynthsForLive = {var b;
// this creates a different waveform for each sonification of each part
Buffer.freeAll(s);
//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)});
SynthDef(\berger, {arg freq, amp = 0.2, del = 5, gate = 1, sustain = 1, buf = 0, out = 0;
@ -40,7 +45,7 @@ s.waitForBoot({
};
robinsonCreateSynthsForLive = {var b;
Buffer.freeAll(s);
//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)});
SynthDef(\robinson, {arg freq, amp = 0.2, del = 5, gate = 1, sustain = 1, buf = 0, out = 0;
@ -49,7 +54,7 @@ s.waitForBoot({
};
penroseCreateSynthsForLive = {var b;
Buffer.freeAll(s);
//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)});
SynthDef(\penrose_ins, {arg freq, amp = 0.2, del = 5, gate = 1, sustain = 1, buf = 0, out = 0;
@ -62,7 +67,7 @@ s.waitForBoot({
};
ammannCreateSynthsForLive = {var b;
Buffer.freeAll(s);
//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;
@ -98,6 +103,22 @@ s.waitForBoot({
}).add;
};
//sampler for click track
clickCreateSynthForLive = {
clickBufPrimary = Buffer.read(s, dir +/+ "music_data" +/+ "primary_click.wav");
clickBufSecondary = Buffer.read(s, dir +/+ "music_data" +/+ "secondary_click.wav");
SynthDef(\click, {arg measure = 0, beat = 0, dur = 1, sustain = 1, gate = 1, out = 0, primaryBufNum = 0, secondaryBufNum = 1;
var primaryClick, secondaryClick, sig;
primaryClick = PlayBuf.ar(1, primaryBufNum, BufRateScale.kr(primaryBufNum), 1, SampleRate.ir * BufRateScale.kr(primaryBufNum) * (measure % 100));
//primaryClick = PlayBuf.ar(1, primaryBufNum, BufRateScale.kr(primaryBufNum));
secondaryClick = PlayBuf.ar(1, secondaryBufNum, BufRateScale.kr(secondaryBufNum), 1);
sig = Select.ar(beat > 0, [primaryClick, secondaryClick]);//* EnvGen.kr(Env.cutoff(0.001, 1), doneAction: 2);
EnvGen.kr(Env.sine(sustain), gate, doneAction: 2);
Out.ar(out, sig);
}).add;
};
//create patterns
bergerCreatePatternsForLive = {arg seqs, group;
@ -244,6 +265,20 @@ s.waitForBoot({
});
};
createClickPattern = {arg transportData, group;
Pbind(\instrument, \click,
\group, group,
//\msg, Pseq(8.collect({arg i; ["-", (i % 4) + 1]}) ++ transportData.collect({arg item; [item[0], item[1]]}), 1),
//\dur, Pseq(8.collect({arg i; 1}) ++ transportData.collect({arg item; item[2]}), 1),
\measure, Pseq(8.collect({arg i; 2}) ++ transportData.collect({arg item; item[0]}) - 1, 1),
\beat, Pseq(8.collect({arg i; 2}) ++ transportData.collect({arg item; item[1]}) - 1, 1),
\dur, Pseq(transportData.collect({arg item; item[2]}), 1),
\sustain, 1,
\primaryBufNum, clickBufPrimary,
\secondaryBufNum, clickBufSecondary,
\out, clickBus
);
};
SynthDef(\mixer_old, {arg freq, gate = 1, sustain, amp, dur, out;
var nameSpaces, sigs;
@ -262,19 +297,21 @@ s.waitForBoot({
}).add;
SynthDef(\mixer, {
var sig;
var sig, click;
sig = hdpBusArray.collect({arg bus, index; In.ar(bus, 1) * NamedControl.kr(\volume_ ++ index, 0.75, 0.1)});
sig = sig.collect({arg channel, index; Pan2.ar(channel, NamedControl.kr(\pan_ ++ index, 0.5, 0.1) * 2 - 1)});
sig = sig.collect({arg channel, index; channel * NamedControl.kr(\mute_ ++ index, 1, 0.1)});
sig = Mix.ar(sig) * pow(NamedControl.kr(\volume_master, 0.75, 0.5), 2);
Out.ar(0, sig)
click = In.ar(clickBus, 1);// * NamedControl.kr(\volume_click, 0.75, 0.1);
Out.ar(0, sig);
Out.ar(2, click);
}).add;
s.sync(c);
dir = thisProcess.nowExecutingPath.dirname;
s.sync(c);
createTransportData = {arg measureLengths;
measureLengths.collect({arg dur, measure;
@ -318,6 +355,7 @@ s.waitForBoot({
ammannCreateSynthsForLive.value;
kariCreateSynthsForLive.value;
jaendelCreateSynthsForLive.value;
clickCreateSynthForLive.value;
group = Group.new;
berger = Synth.tail(group, \berger);
@ -370,7 +408,7 @@ s.waitForBoot({
var pbinds, transportData, measureLengths, patterns, stream, offset, offsetStream, terminationStream;
# pbinds, transportData, measureLengths = playbackData[msg[2]];
//patterns = Ppar(pbinds.postln.add(createTransportPattern.value(addr, transportData).postln));
patterns = Ptpar([0, createTransportPattern.value(addr, transportData), 9, Ppar(pbinds)]);
patterns = Ptpar([0, createTransportPattern.value(addr, transportData), 1 * msg[5]/60.0, createClickPattern.value(transportData, group), 9 * msg[5]/60.0, Ppar(pbinds)]);
stream = patterns.asStream;
if(msg[3] == 1, {

Loading…
Cancel
Save