Compare commits
No commits in common. "ddb3b2ca36b0e67dce2f1d49e3f2f845c98d0739" and "2109e102a5a9fe2dfbca0b23ec5e6c8a47194903" have entirely different histories.
ddb3b2ca36
...
2109e102a5
|
|
@ -1 +1 @@
|
||||||
# Remembering Clive Wearing
|
# Lamentations I: Remembering Clive Wearing
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
|
|
||||||
#include <TimerOne.h> // Include Timer1 library
|
|
||||||
|
|
||||||
// Pin outputs for the 18 lights
|
|
||||||
int AC_pin_offsets[18] = {22, 24, 26, 28, 30, 23, 25, 27, 29, 32, 34, 36, 38, 31, 33, 35, 37, 39};
|
|
||||||
int freq = 50; // 50 for EU and 60 for US
|
|
||||||
int dims[18]; // dimmer values
|
|
||||||
unsigned char clock_tick; // variable for Timer1
|
|
||||||
char incomingByte;
|
|
||||||
int val = 0;
|
|
||||||
int light = 0;
|
|
||||||
int delim = 0;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(115200);
|
|
||||||
for(int i = 0; i < 18; i++){
|
|
||||||
dims[i] = 215;
|
|
||||||
pinMode(AC_pin_offsets[i], OUTPUT);
|
|
||||||
};
|
|
||||||
attachInterrupt(0, zero_crosss_int, RISING);
|
|
||||||
Timer1.initialize(1000000 / (freq * 2) / 256); // 8 bit control
|
|
||||||
Timer1.attachInterrupt(timerIsr); // attach the service routine here
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is the dimmer
|
|
||||||
void timerIsr() {
|
|
||||||
clock_tick++;
|
|
||||||
for(int i = 0; i < 18; i++) {
|
|
||||||
if (dims[i] == clock_tick) {
|
|
||||||
digitalWrite(AC_pin_offsets[i], HIGH); // triac on
|
|
||||||
delayMicroseconds(10); // triac On propogation delay (for 60Hz use 8.33, for 50Hz use 10)
|
|
||||||
digitalWrite(AC_pin_offsets[i], LOW); //triac off
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// function to be fired at the zero crossing to dim the light
|
|
||||||
void zero_crosss_int() {
|
|
||||||
clock_tick=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
if (Serial.available() > 0) { // something came across serial
|
|
||||||
while(1) {
|
|
||||||
incomingByte = Serial.read();
|
|
||||||
if(incomingByte == -1) {break;};
|
|
||||||
if(incomingByte < 0) {val = 256 + incomingByte;} else {val = incomingByte;};
|
|
||||||
if(val == 253) {delim = 1; continue;};
|
|
||||||
if(val == 254) {delim = 0; continue;};
|
|
||||||
if(delim == 0) light = val;
|
|
||||||
if(delim == 1) dims[light] = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -9,18 +9,14 @@ No GUI, just keycodes:
|
||||||
<ctrl + r> = run synth, <ctrl + p> = pause synth
|
<ctrl + r> = run synth, <ctrl + p> = pause synth
|
||||||
<ctrl + s> = trigger start / fade in, <ctrl + e> = trigger end / fade out, <ctrl + t> = trigger wake
|
<ctrl + s> = trigger start / fade in, <ctrl + e> = trigger end / fade out, <ctrl + t> = trigger wake
|
||||||
|
|
||||||
When ~arduino == 1 (true), the app assumes that an arduino is reachable, otherwise errors will be thrown
|
|
||||||
|
|
||||||
When automate == 1 (true), the trigger keys are disabled and the following lists in the SynthDef are used:
|
When automate == 1 (true), the trigger keys are disabled and the following lists in the SynthDef are used:
|
||||||
startTimes, wakeTimes, and endTimes
|
startTimes, wakeTimes, and endTimes
|
||||||
|
|
||||||
This launches the synth in a paused state to give the user time to put the visuals in full screen.
|
This launches the synth in a paused state to give the user time to put the visuals in full screen.
|
||||||
To start the synth, <ctrl + r> must be executed
|
To start the synth, <ctrl + r> must be executed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var dir = thisProcess.nowExecutingPath.dirname;
|
|
||||||
var automate = 1;
|
var automate = 1;
|
||||||
~arduino = 1;
|
var dir = thisProcess.nowExecutingPath.dirname;
|
||||||
~fadeInTrigBus = Bus.control(s); ~wakeTrigBus = Bus.control(s); ~fadeOutTrigBus = Bus.control(s);
|
~fadeInTrigBus = Bus.control(s); ~wakeTrigBus = Bus.control(s); ~fadeOutTrigBus = Bus.control(s);
|
||||||
"remembering_clive_wearing_visuals.scd".loadRelative(true, {
|
"remembering_clive_wearing_visuals.scd".loadRelative(true, {
|
||||||
"remembering_clive_wearing_synthdef.scd".loadRelative(true, {
|
"remembering_clive_wearing_synthdef.scd".loadRelative(true, {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
(
|
(
|
||||||
// VISUALS
|
// VISUALS
|
||||||
// Init vars and window
|
// Init vars and window
|
||||||
var projectionWin, arduino_port, osc_func, brightness = {0} ! 27, refresh_func;
|
var projectionWin, scoreWin, osc_func, run = true, blend = {0} ! 27;
|
||||||
projectionWin = Window.new("Remembering Clive Wearing", Rect(500, 500, 750, 500)).front;
|
projectionWin = Window.new("Lamentations I: Remembering Clive Wearing", Rect(500, 500, 750, 500)).front;
|
||||||
projectionWin.background = Color.black;
|
projectionWin.background = Color.black;
|
||||||
|
|
||||||
// Keybinds (these can be change if conflicting with system keybinds)
|
// Keybinds (these can be change if conflicting with system keybinds)
|
||||||
|
|
@ -13,7 +13,7 @@ projectionWin.view.keyDownAction = { |doc, char, mod, unicode, keycode, key|
|
||||||
// <esc> = exit full screen
|
// <esc> = exit full screen
|
||||||
{mod == 0 && key == 16777216} {projectionWin.endFullScreen}
|
{mod == 0 && key == 16777216} {projectionWin.endFullScreen}
|
||||||
// <ctrl + r> = run synth
|
// <ctrl + r> = run synth
|
||||||
{mod == 262144 && key == 82} {refresh_func.fork(AppClock); ~flicker.run}
|
{mod == 262144 && key == 82} {~flicker.run}
|
||||||
// <ctrl + p> = pause synth
|
// <ctrl + p> = pause synth
|
||||||
{mod == 262144 && key == 80} {~flicker.run(false)}
|
{mod == 262144 && key == 80} {~flicker.run(false)}
|
||||||
// <ctrl + s> = start / fade in
|
// <ctrl + s> = start / fade in
|
||||||
|
|
@ -24,11 +24,8 @@ projectionWin.view.keyDownAction = { |doc, char, mod, unicode, keycode, key|
|
||||||
{mod == 262144 && key == 84} {~wakeTrigBus.set(1)}
|
{mod == 262144 && key == 84} {~wakeTrigBus.set(1)}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Connect arduino; edit first arg / port to match index or name of port: SerialPort.listDevices
|
|
||||||
if(~arduino == 1, { arduino_port = SerialPort("/dev/ttyACM0", 115200)}, {});
|
|
||||||
|
|
||||||
// Get control signals from SynthDef
|
// Get control signals from SynthDef
|
||||||
osc_func = OSCFunc.new({arg msg, time; brightness[msg[2]] = msg[3]; },'/tr', s.addr);
|
osc_func = OSCFunc.new({arg msg, time; blend[msg[2]] = msg[3]},'/tr', s.addr);
|
||||||
|
|
||||||
// Draw the window
|
// Draw the window
|
||||||
projectionWin.drawFunc = {
|
projectionWin.drawFunc = {
|
||||||
|
|
@ -46,28 +43,12 @@ projectionWin.drawFunc = {
|
||||||
Pen.addOval(innerSquare);
|
Pen.addOval(innerSquare);
|
||||||
Pen.fillRadialGradient(innerSquare.center, innerSquare.center,
|
Pen.fillRadialGradient(innerSquare.center, innerSquare.center,
|
||||||
(innerSquare.width / 16), (innerSquare.width / 2),
|
(innerSquare.width / 16), (innerSquare.width / 2),
|
||||||
Color.black.blend(Color.new255(255, 214, 170, 255), pow(brightness[(i * 9) + j], 0.5)),
|
Color.black.blend(Color.new255(255, 214, 170, 255), pow(blend[(i * 9) + j], 0.5)),
|
||||||
Color.black);
|
Color.black);
|
||||||
} ! 9 } ! 2
|
} ! 9 } ! 2
|
||||||
};
|
};
|
||||||
projectionWin.refresh;
|
projectionWin.refresh;
|
||||||
|
|
||||||
|
|
||||||
// Refresh function
|
// Refresh function
|
||||||
refresh_func = { while { true } {
|
{ while { run } { projectionWin.refresh; 30.reciprocal.wait; } }.fork(AppClock);
|
||||||
// updateProjection
|
|
||||||
projectionWin.refresh;
|
|
||||||
|
|
||||||
if(~arduino == 1, {
|
|
||||||
// set min and max Brightness between 0 and 1 depending on wattage of light
|
|
||||||
// it is best to keep the min slightly higher than 0 to keep the light from turning completely off
|
|
||||||
{|i| var minBrightness = 0.15, maxBrightness = 0.65;
|
|
||||||
arduino_port.put(i);
|
|
||||||
arduino_port.put(253);
|
|
||||||
arduino_port.put(((((brightness[i] * (maxBrightness - minBrightness)) + minBrightness) - 1).abs * 256).asInteger);
|
|
||||||
arduino_port.put(254);
|
|
||||||
} ! 18 }, {});
|
|
||||||
|
|
||||||
// delay
|
|
||||||
30.reciprocal.wait; } };
|
|
||||||
)
|
)
|
||||||
Loading…
Reference in a new issue