deep-symmetry / afterglow Goto Github PK
View Code? Open in Web Editor NEWA live-coding lighting controller, building on the Open Lighting Architecture with Clojure and bits of Overtone.
License: Eclipse Public License 2.0
A live-coding lighting controller, building on the Open Lighting Architecture with Clojure and bits of Overtone.
License: Eclipse Public License 2.0
I'm getting the following error when running the code in the readme:
CompilerException java.lang.NoClassDefFoundError: Could not initialize class afterglow.core__init
(defproject example "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[afterglow "0.1.4"]]
:main ^:skip-aot example.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
I am however able to run the examples if I clone the afterglow repo and then run.
I don't get this error when using other libraries such as overtone.midi. I'm quite new to clojure so I may be missing something obvious. I'm working on OS X Yosemite.
Thanks, looks like a great project and would love to get experimenting with it!
The new ability to save cue variables in the web interface and on the Push needs to be added to the online documentation, along with screen shots and photos.
I'm trying to understand, how to implement the most simple fixture in Afterglow. I have my-show.clj, which is copy-paste from your latest README.md example file.
I'm stuck on the line " ;; TODO: Replace this to patch in an actual fixture in your show".
First try. Copy-paste from https://github.com/brunchboy/afterglow/blob/master/src/afterglow/examples.clj
(show/patch-fixture! :torrent-1 (blizzard/torrent-f3) universe 1
:x (tf/inches 44) :y (tf/inches 51.75) :z (tf/inches -4.75)
:y-rotation (tf/degrees 0))
Not working :(
java.lang.RuntimeException: No such namespace: adj, compiling:(/Users/dandaka/projects/lights/my-show.clj:43:33)
Second try. Reading the docs https://github.com/brunchboy/afterglow/blob/master/doc/fixture_definitions.adoc
Doesn't help at all, because almost no examples there. I have big troubles with Closure syntax right now. And there is no "simple and working code to copy-paste" to experiment on.
Third try. File https://github.com/brunchboy/afterglow/blob/master/src/afterglow/fixtures.clj#L65
Same story, can't copy-paste and modify. No idea, what is that exactly.
What would be cool to see. Simplest fixtures to work with. For example, I have RGB LED light on universe 1 on 1,2,3 DMX channels. If I could copy-paste code needed for them to work, it would save lots of time for newbee users like me.
Thank you 👍
Just wanted to share some thoughts about this:
If this happens, remember that you need to have all of your MIDI devices hooked up before you start Afterglow, because of limitations in the Java MIDI implementation. Try quitting and restarting Afterglow. If that doesn’t help, you will need to troubleshoot your MIDI setup.
In live performance mode one of my devices (shitty Novation Nocturn, which every sane person should avoid) got "disconnected" from my laptop. Reconnecting the device didn't solved the problem, since Java doesn't seem to care to hotlinking devices. I have tough choice between restarting Afterglow (and lose the show for like 5 seconds) or lose MIDI control. Latest was more important, so I restarted.
But you can see, that this could pretty bad issue with big shows, that have no such option as losing all the lights.
I think I could workaround this by creating a Max patch, which will be always "connected". But solving one issue by bringing more components into a play is a pretty shit solution, IMO. More components → bigger chance of failure.
The var-map
argument given to cues’ effect-creation functions is mentioned but it needs a complete explanation, and examples of how cues/apply-merging-var-map
can make it more convenient to work with effects that have optional keyword arguments.
I use (core/init-logging)
to start logging. When I forget to launch olad, I don't get any errors (except web interface). Don't you think it should be included in REPL output? Since its an essential component of Afterglow.
Can't find any way to see evaluate value of a Dynamic parameter. Is there any?
Trying to follow your tutorial. Everything works fine until command
afterglow.examples=> (show/add-effect! :color blue-cue)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: blue-cue in this context, compiling:(/private/var/folders/m7/qj5nmqfx353fbx1scql8hkqw0000gn/T/form-init105587552260443348.clj:1:1)
Is there anything I'm missing? Or is it a bug?
I am super new to Clojure.
Create a function that tales a file (defaulting to looking in the log directory for relative paths) and a show. Calling the function loads the content of the file as the current values of all saved cue variables, and the file gets automatically rewritten whenever they are changed.
The extrinsic Euler angle approach for describing fixture rotations was not flexible enough to support the awkward angle at which we hang our Blade RGBW fixtures, so I had to add a relative-rotations
list option. In the process I added, for full programmatic flexibility, a :rotation
option where you calculate and pass in the transformation matrix yourself. These need to be explained in the documentation.
Latest Macbooks (and many more devices) aren't capable of full support of 3D graphics. Current implementation of a Visualiser in 3D isn't working [in my case], browser/REPL hang up with little FPS on 20 fixtures.
Still there is a need to develop and test shows without physical access to devices.
A simple 2D visualisation tool. Plain simple HTML blocks, which are draggable around. They are changing colors with respect to DMX values.
Something like this http://mzabriskie.github.io/react-draggable/example/
Inside every block there is an ID of it
Position in 2D could be remembered for future launches, but its completely optional
Maybe its easy to implement with existing 3D visualisation. With more people using your library, it could be a very useful feature.
I was looking for scenes/chases and could not find documentation, until I found this:
I think they are so important, that deserve at least their own H2 heading (maybe even a page).
If you wish, I could make a pull request with little restructure.
Some lights have dimmers. Some don't. Since you have to control all the lights at the same time, you have following options:
What is your usual solution in these cases? I have seen you don't control all dimmers and colors at the same time. So you have to activate multiple cues to achieve a desired effect?
I have following problem when starting MIDI sync from network MIDI session. Despite the fact, that Afterglow sees messages, it doesn't want to start sync.
https://gist.github.com/dandaka/dd5963c5c700ca3ff7ea
Source is here:
https://github.com/dandaka/lights-experiment/blob/master/src/lights/my_show.clj#L169
If this is a problem from other libraries, plz let me know, where to look.
I have a cue, that is standard sparkle effect
(ct/set-cue! (:cue-grid *show*) 0 7
(cues/cue :sparkle (fn [_] (fun/sparkle (show/all-fixtures)
:chance :sparkle-chance
:fade-time :sparkle-fade))
:held true
:priority 100
:short-name "Sparkle all"
))
https://github.com/dandaka/lights-experiment/blob/master/src/lights/my_show.clj#L392-L399
Also I have a MIDI binding to it
(show/add-midi-control-to-cue-mapping "Automap MIDI" 10 :control 51 0 7)
When I fast release and press again, cue is not activating. I think it is because effect itself has time to finish.
Not a big problem at all, just letting you know. Maybe there are some workarounds or general thoughts.
https://github.com/brunchboy/afterglow/blob/master/doc/effects.adoc#layering-effects
I use colors from default example. Like this:
(global-color-cue "red" 0 0 :include-color-wheels? true)
I want to create a simple transformation, based on already active effect (red color on all fixtures). For example, change hue to +50 (or lightness to -50). I guess I should add another effect with :priority, so they will start to work with each other. Can't find any example with 2+ effects working at the same time.
Going after build-saturation-transformation
source is not returning any results in 2+ hours :)
In the low-level rendering loop, channel effects were the first implemented, and their assigners carry only the universe and channel number to be affected. This unfortunately means that they cannot use spatial parameters, since there is no head from which to derive spatial information. Change them to also carry head information (and make sure there are no other effect types which still lack it).
While in there, change the target identifiers from the current approach of a keyword that gets split apart to derive information to a simple tuple containing the pieces of information needed. I wasn’t experienced enough a Clojurist to think of that approach when I first wrote this. But thankfully it’s all internal, and these changes will not affect anyone.
Here is a log
https://gist.github.com/dandaka/c03adcd0b8b7db9b0a63
Here is latest code with fixtures definition
https://github.com/dandaka/lights-experiment/blob/master/src/lights/my_show.clj#L121-L128
What am I doing wrong?
I have an active MIDI over Network session
I have physical connection to a MIDI controller (Traktor Kontrol Z1)
When I use knobs on Traktor Kontrol Z1, which are using channel 1, I can detect them with (afterglow.midi/identify-mapping)
lights.my-show=> (afterglow.midi/identify-mapping)
(afterglow.midi/identify-mapping)
{:command :control-change, :channel 0, :note 1, :velocity 55, :device {:name "Traktor Kontrol Z1 Input", :description "Traktor Kontrol Z1 Input"}}
lights.my-show=> (afterglow.midi/identify-mapping)
(afterglow.midi/identify-mapping)
nil
I can see them coming http://take.ms/VRD9x
I have changed midi-net messages to channel 1, and they are detected with Afterglow (no restart)
lights.my-show=> (afterglow.midi/identify-mapping)
(afterglow.midi/identify-mapping)
{:command :control-change, :channel 0, :note 1, :velocity 105, :device {:name "midi-net", :description "Network midi-net"}}
I try to reset metronome from this tutorial
https://github.com/brunchboy/afterglow/blob/master/doc/metronomes.adoc#metronomes
First example is now working as expected:
lights.my-show=> (:metronome my-show)
(:metronome my-show)
nil
Is it me or Afterglow?
I'm thinking about using oscillators with user input and MIDI input. General idea is to mix, say, sine-generated values with sound intensity. One simple way is to achieve this is to use :max
parameter of (afterglow.effects.params/build-oscillated-param oscillator)
.
But music/show has another dimension — time, which is interesting to use.
I'm thinking about this kind of oscillators:
The third one is a bit tricky to design. I have showed 0.5x beat case. To use floats in this case ("make me a sine every 0.4 beat) Afterglow has to "collect" them.
What do you think of it? Are this types achievable with current Afterglow?
Right now, new metronome snapshots are created whenever working with alternate metronomes, which means they represent slightly different times than when the effect is supposed to be taking place. To solve this I need to build a way to use one metronome snapshot to create a snapshot from a different metronome that represents the same point in time, and use that mechanism inside build-oscillated-param
, as noted in the TODO at the top of the function.
I take example from #21:
https://github.com/brunchboy/afterglow/blob/master/doc/effects.adoc#variable-effects
My src is here:
https://github.com/dandaka/lights-experiment/blob/master/src/lights/my_show.clj
> (light-sine)
Lights are pulsing with sine
> (afterglow.show/set-variable! :main-hue 120)
Hue changes to green.
Press on a button with following code:
(ct/set-cue! (:cue-grid *show*) 0 0
(cues/cue :color-var (fn [_](afterglow.effects/scene
"Hue Red"
(fn [_] (var-fx/variable-effect @var-binder :main-hue 0))
)
)))
Afterglow fails with this https://gist.github.com/dandaka/098b1180924b21dc2632
We gather, but its not currently exposed on the webpage yet, slot data for the active personality when people run the model collector ( https://github.com/OpenLightingProject/ola/blob/master/tools/rdm/ModelCollector.py ). Here is some example data, or run it against the dummy responders for more:
You could use this to generate a rough fixture profile for devices.
Alternatively you could look at converting QLC+ personalities: https://github.com/mcallegari/qlcplus/tree/master/resources/fixtures
Right now*
First time user is starting your example. He has to understand, how fixtures are working. And it is not and easy task.
Otherwise he thinks, that tool is not working.
Should be
On first start of the show, use all DMX channels in Universe 1 to change their values in time. User gets immediate feedback, that tool is working.
This will allow, for example, a dimmer oscillator cue to have the oscillator type be a cue variable; the map would have entries containing the four oscillator types, with keys being the name to present in the UI (both on the web and on the Push) when that option is selected. The web would use dropdown menus, the Push an overlay letting you scroll through the values. This would save a lot of space on the cue grid (and conceptually in show operators’ heads, perhaps).
I want to use sparke with heads, that don't support colors, but they do support dimmer. Is it possible to use on such fixtures? I guess not.
What I understand from reading the docs is that sparke creates "random" flashes, while strobe creates "rhythmic" ones.
I think "sparkle" type of strobe could be a better alternative.
Where can I read about? I see messages in my Virtual output and they are giving positive feedback.
I have a few groups of fixtures. I want to use different color effect on different fixtures.
1st try
(show/add-effect! :color (afterglow.effects.color/color-effect
"Plain red" (create-color "red") (show/fixtures-named "back-odd")))
(show/add-effect! :color (afterglow.effects.color/color-effect
"Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
2nd try
(defn separate-colors
"Asign different colors to different fixtures. Experiment."
[]
(afterglow.effects/scene "Different colors"
(show/add-effect! :color (afterglow.effects.color/color-effect
"Plain red" (create-color "red") (show/fixtures-named "back-odd")))
(show/add-effect! :color (afterglow.effects.color/color-effect
"Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
)
)
Result in both cases → only blue light, no red. Fixtures that supposed to be red are black.
What is the proper way to assign different effect to different fixtures?
localhost:16000 works fine
localhost:16000/console works fine
http://localhost:16000/show/1 gives 500
Error: 500
Something very bad has happened!
We've dispatched a team of highly trained gnomes to take care of the problem.
Log is here:
https://gist.github.com/dandaka/7fa57567b524065d1a14
Is it possible to use cue to launch custom function? I have looked through documentation, can't find any example yet. All examples I see attach 1 effect, which is asking for more.
beat-ratio
to make animation slower or faster:(defn light-sawtooth
"Change light according to sawtooth osc"
[beat-ratio]
(let [light-param (params/build-oscillated-param
(oscillators/sawtooth-beat :beat-ratio beat-ratio :down? true) :max :max-lightness)]
(show/add-effect! :color (global-color-effect
(params/build-color-param :h :main-hue :s 100 :l light-param)))
)
)
I want to launch this function with different parameters from Cue Grid. One effect is not enough, since I have few groups of fixtures. And it is nice to control all these groups from one button in Cue Grid.
I have main-hue
variable, and all other functions and effects are linked to it. No need to specify color on each effect, more flexibility. And its possible to control show color from external sources (say MIDI).
(afterglow.show/set-variable! :main-hue 0)
Whenever Afterglow detects a coordinated stream of messages on controllers 0 through 4 which are consistent with beat-phase information from this Traktor mapping, it offers that MIDI input device as a source of Traktor beat-phase synchronization, and if it is synchronizing a metronome with the MIDI clock messages on that port, will also synchronize the beats.
I am trying:
(afterglow.midi/sync-to-midi-clock)
(afterglow.midi/sync-to-midi-clock)
IllegalArgumentException No MIDI clock sources were found. afterglow.midi/sync-to-midi-clock (midi.clj:551)
Also webinterface doesn't show anything. When I start clock send from Traktor, I can sync via clock. But without beat phase correction.
After some experience building and using dynamic parameters, this interface seems to just complicate matters. The code would be easier to understand and work with if all parameters took a head argument for their evaluation and resolution functions, which could be nil
if there is no head available, and they simply make use of it when they can and it is available.
Create a function similar to the one for persisting cue variables, which appends to a chosen file Clojure code which can re-create a macro whenever the user defines one. Rather than auto-loading, this file is for people to scan and choose to incorporate pieces they like into their show definitions whenever they have created a particularly neat macro.
(afterglow.effects.params/build-step-param)
has only :interval key, that could be set to beat (x1) or phrase (x16). Everything else is impossible.
User supplies :interval-ratio similar to oscillators. So he gets all kinds of step parameters.
I am guessing right now, how to find these values:
:pan-center, :pan-half-circle, :tilt-center and :tilt-half-circle
I think there is some process, how to figure them out experimentally. If there is one, it would be good to document it.
My guess is that I have to
Is that a correct guess?
I follow this guideline
https://github.com/brunchboy/afterglow/blob/master/doc/effects.adoc#layering-effects
I want to use transform-colors function to change colors in current show.
lights.my-show=> (color-fx/transform-colors (show/all-fixtures) :priority 1000)
(color-fx/transform-colors (show/all-fixtures) :priority 1000)
#afterglow.effects.Effect{:name "Transform Colors", :active-fn #object[afterglow.effects$always_active 0x3ba17151 "afterglow.effects$always_active@3ba17151"], :gen-fn #object[afterglow.effects.color$transform_colors$fn__16361 0x2d035551 "afterglow.effects.color$transform_colors$fn__16361@2d035551"], :end-fn #object[afterglow.effects$end_immediately 0x6d6ae297 "afterglow.effects$end_immediately@6d6ae297"]}
Nothing changes in the show. I have a guess, that this function can be used only with cue. Is that correct?
I guess this from following example:
(ct/set-cue! (:cue-grid *show*) 2 7
(cues/cue :transform-colors (fn [_] (color-fx/transform-colors
(show/all-fixtures)))
:priority 1000))
Is there any way to test transform-colors without creating a cue?
nREPL server started on port 62114 on host 127.0.0.1 - nrepl://127.0.0.1:62114
REPL-y 0.3.7, nREPL 0.2.10
Clojure 1.8.0-RC4
Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-468-11M4833
my-show loaded.
lights.my-show=> (cues/add-midi-control-to-cue-mapping "quneo" 0 :note 36 0 7)
(cues/add-midi-control-to-cue-mapping "quneo" 0 :note 36 0 7)
ClassNotFoundException javax.sound.midi.MidiDeviceReceiver java.net.URLClassLoader$1.run (URLClassLoader.java:202)
lights.my-show=> (cues/add-midi-control-to-cue-mapping "quneo" 0 :note 36 0 7)
(cues/add-midi-control-to-cue-mapping "quneo" 0 :note 36 0 7)
NoClassDefFoundError uk/co/xfactorylibrarians/coremidi4j/CoreMidiReceiver uk.co.xfactorylibrarians.coremidi4j.CoreMidiDestination.getReceiver (CoreMidiDestination.java:173)
Also please note, that same command gives two different errors.
I want to:
This looks promising
https://github.com/brunchboy/afterglow/blob/master/doc/parameters.adoc#variable-parameters
But example doesn't make any sense now. And without debug (#31) its hard to experiment.
My end goal is to control beat-ration with MIDI, which is working well with existing dynamic parameters. I need to have some fn to round() and square it.
I want to make some changes to Web UI of Afterglow. I can't find Afterglow in my project folder (as was expected from Node/Bower experience). Do I need to use Clojars for it?
I have found sources, but could not find way to launch them.
I want to reset a show metronome, when cue is pressed. I follow your examples from #30
(ct/set-cue! (:cue-grid *show*) 7 7
(cues/cue :set-main-hue
(fn [_] (afterglow.effects.scene
"Reset beat"
(afterglow.rhythm/metro-start (:metronome *show*) 1)))
:held true))
Another try:
(ct/set-cue! (:cue-grid *show*) 7 7
(cues/cue :set-main-hue
(fn [_] (reset-beat))))
No luck. I got, that cues and scenes are working with effects. What to do in cases, when code is not an effect?
To control dimmers from Live by sending MIDI notes/CCs.
:front-1-note
oscillates between digits 0 and 1 (MIDI note). I add a cue with code:
https://github.com/dandaka/lights-experiment/blob/master/src/lights/my_show.clj#L458-L467
Web interface has this button. All other cues in this row are working correctly. This button deselects whole row.
This also not working:
(show/add-effect! :condition (afterglow.effects/conditional-effect "Enabled?" (params/build-variable-param :front-1-note)
(dimmer-effect 255 (show/fixtures-named "front") :add-virtual-dimmers? true :htp? false)
))
What do I miss?
afterglow.effects/conditional-effect
syntax(params/build-variable-param :front-1-note)
This works fine:
(def light-param (params/build-oscillated-param
(oscillators/sawtooth-beat :beat-ratio 4 :down? true) :max :max-lightness))
(defn light-sawtooth
"Change light according to sawtooth osc"
[]
(show/add-effect! :color (global-color-effect
(params/build-color-param :h :main-hue :s 100 :l light-param))))
This is not working:
; Osc beat ratio
(afterglow.show/set-variable! :osc-beat-ratio 4)
(def light-param (params/build-oscillated-param
(oscillators/sawtooth-beat :beat-ratio :osc-beat-ratio :down? true) :max :max-lightness))
(defn light-sawtooth
"Change light according to sawtooth osc"
[]
(show/add-effect! :color (global-color-effect
(params/build-color-param :h :main-hue :s 100 :l light-param))))
I was experimenting with sine-beat. I have experienced it went more than 1.0. And I see what I think is a bug. Please check, your graph is going from -0.5 to 1.5. But documentation is telling, that it goes from 0 to 1.0.
https://github.com/brunchboy/afterglow/blob/master/doc/oscillators.adoc#sine-oscillators
It would be nice to be able to create cue macros on the push by pressing the Duplicate button, which would go into an overlay that let you select running cue-based effects and which would light only the free grid pads; as soon as you touched one of those, the selected effects would be saved as a macro on it. You could cancel by pressing Duplicate again (or perhaps by hitting a grid cell with no effects selected). The available grid pads should only be dimly lit until at least one effect is selected. Naming would just be “Macro P1” and so on because there is no keyboard.
I create a new cue
(ct/set-cue! (:cue-grid *show*) 0 17
(cues/cue :color (fn [_] (afterglow.effects/scene
"Blue and red"
(show/add-effect! :color-back-odd (afterglow.effects.color/color-effect
"Plain red" (create-color "red") (show/fixtures-named "back-odd")))
(show/add-effect! :color-back-even (afterglow.effects.color/color-effect
"Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
))))
This code in context https://github.com/dandaka/lights-experiment/blob/master/src/lights/my_show.clj#L428
When I click on this cue in web interface, Afterglow start to send lots of errors:
Log: https://gist.github.com/dandaka/adba9374fc8ca2541063
This code is working:
(afterglow.effects/scene
"Blue and red"
(show/add-effect! :color-back-odd (afterglow.effects.color/color-effect
"Plain red" (create-color "red") (show/fixtures-named "back-odd")))
(show/add-effect! :color-back-even (afterglow.effects.color/color-effect
"Plain Blue" (create-color "blue") (show/fixtures-named "back-even")))
)
In the web UI, if you drag the metronome slider, the tempo is updated. But if you just click in the track somewhere, while the handle jumps there, the tempo is not updated. There must be another event which needs to be handled in the JavaScript.
Simon Newton made an excellent suggestion on the #openlighting
channel on irc.freenode.org
yesterday evening: I should pull out the OLA communication layer into its own project, so other Clojure developers who want to talk to olad
for their own purposes can do so without having to pull in all the other pieces of Afterglow.
This would be a big win for Afterglow too, because generating and compiling the Java classes that make up the Protobuf communication layer take the majority of the build time, and they have not changed since the beginning of the project.
Once this is done, the Open Lighting project would like to announce the new Clojure library on their mailing list, so be sure to let Simon know.
There are two new functions in afterglow.effects.params
which allow the use of dynamic Java3D Transform3D
parameters to adjust aim and direction parameters; these can be used to combinatorially combine other effects, and deserve documentation once I am done rushing to build cues and chases for the Neural Kinetics show.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.