– original post –
Flora attempts to extend Graph to create a class called ArbitraryGraph that allows shapes with an arbitrary number of curve segments. Flora uses this to create multisegment envelopes (see Envelope.lua for those details).
I’m not sure if this is useful to you, but just wanted to point out another example that leverages @markeats super awesome code.
– new post on a new topic –
I am writing a new script that includes rerouting the norns’ connection graph and I’d like to share the results of my (somewhat meager) explorations.
Rerouting norns connections has been discussed in a couple of other places:
The secret sauce @dani_derks is referring to is found in @infinitedigits stonesoup script. This script forms much of the foundation for the script I’m writing. Combining @infinitedigits ‘secret sauce’ with the suggestion given by @zebra in the first quote above, I’ve been able to create a parameter that provides three options for how the audio connections to SuperCollider:in are connected:
- audio in + softcut output → supercollider
- audio in → supercollider
- softcut output → supercollider
Here's the code:
rerouting_audio = false
function route_audio()
clock.sleep(0.5)
local selected_route = params:get("audio_routing")
if rerouting_audio == true then
rerouting_audio = false
if selected_route == 1 then -- audio in + softcut output -> supercollider
--print(1)
os.execute("jack_connect crone:output_5 SuperCollider:in_1;")
os.execute("jack_connect crone:output_6 SuperCollider:in_2;")
os.execute("jack_connect softcut:output_1 SuperCollider:in_1;")
os.execute("jack_connect softcut:output_2 SuperCollider:in_2;")
elseif selected_route == 2 then --just audio in -> supercollider
--print(2)
os.execute("jack_connect crone:output_5 SuperCollider:in_1;")
os.execute("jack_connect crone:output_6 SuperCollider:in_2;")
os.execute("jack_disconnect softcut:output_1 SuperCollider:in_1;")
os.execute("jack_disconnect softcut:output_2 SuperCollider:in_2;")
elseif selected_route == 3 then -- just softcut output -> supercollider
--print(3)
os.execute("jack_disconnect crone:output_5 SuperCollider:in_1;")
os.execute("jack_disconnect crone:output_6 SuperCollider:in_2;")
os.execute("jack_connect softcut:output_1 SuperCollider:in_1;")
os.execute("jack_connect softcut:output_2 SuperCollider:in_2;")
end
end
end
params:add{
type = "option", id = "audio_routing", name = "audio routing",
options = {"in+cut->eng","in->eng","cut->eng"},
min = 1, max = 3, default = 1,
action = function(value)
rerouting_audio = true
clock.run(route_audio)
end
}
Also, anyone doing similar rewiring in a script should reset the connections to their defaults in the script’s cleanup function, like:
Cleanup
function cleanup ()
os.execute("jack_disconnect softcut:output_1 SuperCollider:in_1;")
os.execute("jack_disconnect softcut:output_2 SuperCollider:in_2;")
os.execute("jack_connect crone:output_5 SuperCollider:in_1;")
os.execute("jack_connect crone:output_6 SuperCollider:in_2;")
end
This code was just written in the past couple of hours and hasn’t yet been tested super extensively but it appears to do what I was intending.