From d4d32d861028ea220843e05dee174cf82f342587 Mon Sep 17 00:00:00 2001 From: mwinter Date: Mon, 5 Jun 2023 18:33:26 +0200 Subject: [PATCH] fast forward in playback working --- openstagecontrol/hdp.config | 1 + openstagecontrol/mixer_transport.json | 14 +++++++------- supercollider/live_utilities.scd | 28 ++++++++++++++++++--------- supercollider/main.scd | 2 +- 4 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 openstagecontrol/hdp.config diff --git a/openstagecontrol/hdp.config b/openstagecontrol/hdp.config new file mode 100644 index 0000000..8b82d21 --- /dev/null +++ b/openstagecontrol/hdp.config @@ -0,0 +1 @@ +{"send":["127.0.0.1:57120"],"custom-module":"/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem_source/openstagecontrol/custom_module_hdp.js","load":"/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem_source/openstagecontrol/mixer_transport.json"} \ No newline at end of file diff --git a/openstagecontrol/mixer_transport.json b/openstagecontrol/mixer_transport.json index 1459f91..3658424 100644 --- a/openstagecontrol/mixer_transport.json +++ b/openstagecontrol/mixer_transport.json @@ -347,7 +347,7 @@ "ignoreDefaults": false, "bypass": true, "onCreate": "", - "onValue": "if(value === 1){\n send(false, \"/transport\", 1);\n} else {\n send(false, \"/transport\", 0);\n}" + "onValue": "if(value === 1){\n send(false, \"/transport\", 1, get(\"measure\"), get(\"beat\"));\n} else {\n send(false, \"/transport\", 0, get(\"measure\"), get(\"beat\"));\n}" }, { "type": "panel", @@ -417,7 +417,7 @@ "alphaFillOn": "auto", "lineWidth": "auto", "borderRadius": "auto", - "padding": "auto", + "padding": 0, "html": "", "css": ":host {\n font-size: 120rem;\n}", "align": "center", @@ -426,13 +426,13 @@ "numeric": false, "validation": "", "maxLength": "", - "value": 10, + "value": 1, "default": "", "linkId": "", "address": "auto", "preArgs": "", "typeTags": "", - "decimals": 2, + "decimals": 0, "target": "", "ignoreDefaults": false, "bypass": false, @@ -502,16 +502,16 @@ "align": "center", "unit": "", "asYouType": false, - "numeric": false, + "numeric": true, "validation": "", "maxLength": "", - "value": 10, + "value": 1, "default": "", "linkId": "", "address": "auto", "preArgs": "", "typeTags": "", - "decimals": 2, + "decimals": 0, "target": "", "ignoreDefaults": false, "bypass": false, diff --git a/supercollider/live_utilities.scd b/supercollider/live_utilities.scd index dcf30f5..2bb89ef 100644 --- a/supercollider/live_utilities.scd +++ b/supercollider/live_utilities.scd @@ -41,7 +41,7 @@ Event.addEventType(\osc, { \type, \osc, \addr, addr, \path, "/playing", - \msg, Pseq(seqs[0][6].collect({arg beats, measure; beats.asInteger.collect({arg beat; [measure + 1, beat + 1]})}).flatten;, 1), + \msg, Pseq(seqs[0][6].collect({arg beats, measure; beats.asInteger.collect({arg beat; [measure + 1, beat + 1]})}).flatten, 1), \dur, 1 ); @@ -69,12 +69,16 @@ SynthDef(\mixer, {arg freq, gate = 1, sustain, amp, dur, out; ( -var group, berger, mixer, player; +var group, berger, mixer, measureDurs, player; + +~bergerCreateSynthsForLive.value; group = Group.new; berger = Synth.tail(group, \berger); mixer = Synth.tail(group, \mixer); +measureDurs = ~bergerMusic[0][6]; + OSCdef(\mixer, {arg msg, time, addr, port; msg.postln; mixer.set((msg[1] ++ '_' ++ msg[2] ++ '_' ++ msg[3]), msg[4]) @@ -82,16 +86,22 @@ OSCdef(\mixer, {arg msg, time, addr, port; OSCdef(\transport, {arg msg, time, addr, port; msg.postln; - if(msg[1] == 0, { + if(msg[1].postln == 0, { group.set(\release, 2); group.set(\gate, 0); player.stop; }, { - var patterns = ~bergerCreatePatternsForLive.value(~bergerMusic, group, addr); - player = Pfset(pattern: patterns, cleanupFunc: { - addr.sendMsg("/transport", 0); - }); - player = player.play + var patterns, stream, offset, offsetStream, terminationStream; + patterns = ~bergerCreatePatternsForLive.value(~bergerMusic, group, addr); + + stream = patterns.asStream; + offset = stream.fastForward(measureDurs.keep(msg[2].asInteger.postln - 1).sum.postln).postln; + + offsetStream = Routine({offset.wait}); + terminationStream = Routine({addr.sendMsg("/transport", 0)}); + + player = EventStreamPlayer(offsetStream ++ stream ++ terminationStream); + player.play; }); }, \transport); @@ -102,4 +112,4 @@ OSCdef(\transport, {arg msg, time, addr, port; ~patterns = ~bergerCreatePatternsForLive.value(~bergerMusic); ~patterns.play ~bergerMusic[0][6].collect({arg beats, measure; beats.asInteger.collect({arg beat; [measure + 1, beat + 1]})}).flatten; -*/ \ No newline at end of file +*/ diff --git a/supercollider/main.scd b/supercollider/main.scd index 3a538c1..e81974f 100644 --- a/supercollider/main.scd +++ b/supercollider/main.scd @@ -2,7 +2,7 @@ ~seed = 11735; ~dir = thisProcess.nowExecutingPath.dirname; -PathName.new(~dir).files.do({arg path; if((path.fileName != "main.scd") && (path.fileName != "installation_control.scd") && (path.fileName != "visualize_legacy.scd"), {path.fileName.loadRelative})}); +PathName.new(~dir).files.do({arg path; if((path.fileName != "main.scd") && (path.fileName != "installation_control.scd") && (path.fileName != "visualize_legacy.scd") && (path.fileName != "live_utilities.scd"), {path.fileName.loadRelative})}); ~bergerTiling = ~berger.value(500, 500, true);