diff --git a/README.md b/README.md index 4d7b8d2..5c9232e 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,8 @@ Important : for best performance LJ is meant to run in a dedicated computer espe - Status update every 0.5 seconds : every etherdream DAC state, number of buffer points sent,... - "Optimisation" points automatically added, can be changed live for glitch art. Search "resampler" commands. - A compiled version for os x and linux of nannou.org etherdream+laser emulator is included. For more informations, like license see https://github.com/nannou-org/ether-dream -- Some fancy examples are available : 3D anaglyph, Laser Pong,... -- Midi and audio reactive, look midigen.py and fft3.py -- Webcam live face display (trckr). Openpose skeletons animations laser player. +- Webcam live face display (trckr). - Resolume OSC client. -- Another project (bhorpad) has been merged in LJ : so if you have a led matrix, like Launchpad mini or bhoreal, plug it and you may define, launch macros as pushing on leds or use them to display informations. - Artnet receiver plugin, another possibity to script LJ. - Ableton link time synchro support. - Maxwell laser synth emulation plugin. Work in progress @@ -431,12 +428,13 @@ and second line (/line1 or /redline1). Examples of "uicommand arg" : ![LJ Display](https://www.teamlaser.tk/lj/images/display.png) -Leds colors for each DACs +Leds colors for each DACs : + + +DAC IP is in LJ.conf but no connection to dac -> leds are red DAC state "stt" : -Laser not requested -> led is not lit - IDLE -> blue PREPARE -> cyan @@ -445,13 +443,12 @@ PLAYING -> green DAC answers (ack) : -replied ACK -> green +ACK -> green -replied FULL -> orange +FULL -> orange -replied INVALID -> yellow +INVALID -> yellow -no connection to dac -> leds are red (6) ![LJ](http://www.teamlaser.tk/lj/images/calig.png) \ No newline at end of file diff --git a/libs3/launchpad.json b/libs3/launchpad.json new file mode 100644 index 0000000..dcad066 --- /dev/null +++ b/libs3/launchpad.json @@ -0,0 +1,1082 @@ +{ +"OS": [ + { + "_comment": "OS Macros", + "name": "m11", + "color": 3, + "type": "button", + "code": "subprocess.call(['/usr/bin/open','/Applications/iTerm.app'])" + }, + { + "name": "m12", + "color": 3, + "type": "button", + "code": "subprocess.call(['/usr/bin/open','/Applications/Sublime Text.app'])" + }, + { + "name": "m13", + "color": 3, + "type": "button", + "code": "subprocess.call(['/usr/bin/open','/Applications/Firefox.app'])" + }, + { + "name": "m14", + "color": 3, + "type": "button", + "code": "subprocess.call(['/usr/bin/open','/Applications/Firefox.app'])" + }, + { + "name": "m15", + "color": 3, + "type": "button", + "code": "subprocess.call(['/usr/bin/open','/Applications/iTerm.app'])" + } +], + + + +"Maxwell1": [ + { + "_comment": "Maxwell1 First led line : Patchs ", + "name": "m11", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m12", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m13", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m14", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m15", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m16", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m17", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m18", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + + + { + "_comment": "Maxwell1 Second led line : Patchs", + "name": "m21", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m22", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m23", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m24", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m25", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m26", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m27", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m28", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + + + { + "_comment": "Maxwell1 Third led line : Patchs", + "name": "m31", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m32", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m33", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m34", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m35", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m36", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m37", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m38", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + + + { + "_comment": "Maxwell1 Fourth led line : ", + "name": "m41", + "color": 3, + "laser": 0, + "type": "button", + "code": "maxwellccs.PPatch" + }, + { + "name": "m42", + "color": 3, + "laser": 0, + "type": "button", + "code": "maxwellccs.NPatch" + }, + { + "name": "m43", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Reload" + }, + { + "name": "m44", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Load" + }, + { + "name": "m45", + "color": 18, + "init": 0, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m46", + "color": 18, + "init": 1, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m47", + "color": 127, + "init": 0, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + { + "name": "m48", + "color": 127, + "init": 1, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + + + { + "_comment": "Maxwell1 5th led line", + "name": "m51", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/translator/X/lfo/switch" + }, + { + "name": "m52", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/rotator/X/lfo/switch" + + }, + { + "name": "m53", + "color": 19, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "maxwellccs.L" + }, + { + "name": "m54", + "color": 19, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "maxwellccs.R" + + }, + { + "name": "m55", + "color": 18, + "init": 2, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m56", + "color": 18, + "init": 3, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m57", + "color": 127, + "init": 2, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + { + "name": "m58", + "color": 127, + "init": 3, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + + + { + "_comment": "Maxwell1 6th led line : ", + "name": "m61", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + + "code": "/translator/Y/lfo/switch" + }, + { + "name": "m62", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/rotator/Y/lfo/switch" + }, + { + "name": "m63", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/left/X/inversion" + }, + { + "name": "m64", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/right/X/inversion" + }, + { + "name": "m65", + "color": 18, + "init": 0, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m66", + "color": 18, + "init": 1, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m67", + "color": 127, + "init": 0, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + { + "name": "m68", + "color": 127, + "init": 1, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + + + { + "_comment": "Maxwell1 7th led line ", + "name": "m71", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/translator/Z/lfo/switch" + }, + { + "name": "m72", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/rotator/Z/lfo/switch" + }, + { + "name": "m73", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/left/Y/inversion" + }, + { + "name": "m74", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/right/Y/inversion" + }, + { + "name": "m75", + "color": 18, + "init": 2, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m76", + "color": 18, + "init": 3, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m77", + "color": 127, + "init": 2, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + { + "name": "m78", + "color": 127, + "init": 3, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + + + { + "_comment": "Maxwell1 Last led line", + "name": "m81", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Launchpad" + }, + { + "name": "m82", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Bhoreal" + }, + { + "name": "m83", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Beatstep" + }, + { + "name": "m84", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.c4" + }, + { + "name": "m85", + "color": 3, + "laser": 0, + "type": "button", + "code": "maxwellccs.BPLayer" + }, + { + "name": "m86", + "color": 3, + "laser": 0, + "type": "button", + "code": "maxwellccs.BNLayer" + }, + { + "name": "m87", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.PSong" + }, + { + "name": "m88", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.NSong" + } + +], + + + +"Maxwell2": [ + { + "_comment": "Maxwell2 First led line : Patchs ", + "name": "m11", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m12", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m13", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m14", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m15", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m16", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m17", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m18", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + + + { + "_comment": "Maxwell2 Second led line : Patchs", + "name": "m21", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m22", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m23", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m24", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m25", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m26", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m27", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m28", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + + + { + "_comment": "Maxwell2 Third led line : Patchs", + "name": "m31", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m32", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m33", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m34", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m35", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m36", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m37", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + { + "name": "m38", + "color": 127, + "laser": 0, + "type": "button", + "code": "patch" + }, + + + { + "_comment": "Maxwell2 Fourth led line : ", + "name": "m41", + "color": 3, + "laser": 0, + "type": "button", + "code": "maxwellccs.PPatch" + }, + { + "name": "m42", + "color": 3, + "laser": 0, + "type": "button", + "code": "maxwellccs.NPatch" + }, + { + "name": "m43", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Reload" + }, + { + "name": "m44", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Load" + }, + { + "name": "m45", + "color": 18, + "init": 0, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m46", + "color": 18, + "init": 1, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m47", + "color": 127, + "init": 0, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + { + "name": "m48", + "color": 127, + "init": 1, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + + + { + "_comment": "Maxwell2 5th led line", + "name": "m51", + "color": 19, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "maxwellccs.L" + + }, + { + "name": "m52", + "color": 19, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "maxwellccs.R" + }, + { + "name": "m53", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/translator/X/lfo/switch" + }, + { + "name": "m54", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/rotator/X/lfo/switch" + }, + { + "name": "m55", + "color": 18, + "init": 2, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m56", + "color": 18, + "init": 3, + "choices": "m45,m46,m55,m56", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/X/curvetype" + }, + { + "name": "m57", + "color": 127, + "init": 2, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + { + "name": "m58", + "color": 127, + "init": 3, + "choices": "m47,m48,m57,m58", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/X/curvetype" + }, + + + { + "_comment": "Maxwell2 6th led line : ", + "name": "m61", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/left/X/inversion" + + + }, + { + "name": "m62", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/right/X/inversion" + }, + { + "name": "m63", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/translator/Y/lfo/switch" + }, + { + "name": "m64", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/rotator/Y/lfo/switch" + }, + { + "name": "m65", + "color": 18, + "init": 0, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m66", + "color": 18, + "init": 1, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m67", + "color": 127, + "init": 0, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + { + "name": "m68", + "color": 127, + "init": 1, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + + + { + "_comment": "Maxwell2 7th led line ", + "name": "m71", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/left/Y/inversion" + }, + { + "name": "m72", + "color": 127, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/osc/right/Y/inversion" + }, + { + "name": "m73", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/translator/Z/lfo/switch" + }, + { + "name": "m74", + "color": 21, + "laser": 0, + "type": "buttontoggle", + "init": -2, + "code": "/rotator/Z/lfo/switch" + }, + { + "name": "m75", + "color": 18, + "init": 2, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m76", + "color": 18, + "init": 3, + "choices": "m65,m66,m75,m76", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/left/Y/curvetype" + }, + { + "name": "m77", + "color": 127, + "init": 2, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + { + "name": "m78", + "color": 127, + "init": 3, + "choices": "m67,m68,m77,m78", + "laser": 0, + "type": "buttonmulti", + "code": "/osc/right/Y/curvetype" + }, + + + { + "_comment": "Maxwell2 Last led line", + "name": "m81", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Launchpad" + }, + { + "name": "m82", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Bhoreal" + }, + { + "name": "m83", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.Beatstep" + }, + { + "name": "m84", + "color": 2, + "laser": 0, + "type": "button", + "code": "maxwellccs.C4" + }, + { + "name": "m85", + "color": 64, + "laser": 0, + "type": "button", + "code": "maxwellccs.Empty" + }, + { + "name": "m86", + "color": 64, + "laser": 0, + "type": "button", + "code": "maxwellccs.Empty" + }, + { + "name": "m87", + "color": 64, + "laser": 0, + "type": "button", + "code": "maxwellccs.Empty" + }, + { + "name": "m88", + "color": 64, + "laser": 0, + "type": "button", + "code": "maxwellccs.Empty" + } + +] + +} diff --git a/libs3/link.cpython-36m-x86_64-linux-gnu.so b/libs3/link.cpython-36m-x86_64-linux-gnu.so new file mode 100644 index 0000000..070fd06 Binary files /dev/null and b/libs3/link.cpython-36m-x86_64-linux-gnu.so differ diff --git a/plugins/aurora/live.py b/plugins/aurora/live.py new file mode 100644 index 0000000..2fb5e8d --- /dev/null +++ b/plugins/aurora/live.py @@ -0,0 +1,169 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# -*- mode: Python -*- + + +''' + +livecode +v0.1.0 + +Anaglyphed rotating livecode (for red and green glasses) + +This scene uses the drawing functions provided by LJ in lj23.py + +LICENCE : CC + +by Sam Neurohack + + +''' +#import sys +#import os +#from OSC3 import OSCServer, OSCClient, OSCMessage +#import redis +import math +import time +import numpy as np +from scipy import signal +from datetime import datetime, timedelta + + + +# +# Math functions +# + + +def ssawtooth(samples,freq,phase): + + samparray = [0] * samples + t = np.linspace(0+phase, 1+phase, samples) + for ww in range(samples): + samparray[ww] = signal.sawtooth(2 * np.pi * freq * t[ww]) + return samparray + +def slivecode(samples,freq,phase): + + samparray = [0] * samples + t = np.linspace(0+phase, 1+phase, samples) + for ww in range(samples): + samparray[ww] = signal.livecode(2 * np.pi * freq * t[ww]) + return samparray + +def ssine(samples,freq,phase): + + t = np.linspace(0+phase, 1+phase, samples) + for ww in range(samples): + samparray[ww] = np.sin(2 * np.pi * freq * t[ww]) + return samparray + + +def slinear(samples, min, max): + + samparray = [0] * samples + linearinc = (max-min)/samples + for ww in range(samples): + if ww == 0: + samparray[ww] = min + else: + samparray[ww] = samparray[ww-1] + linearinc + #print('linear min max', min, max) + #print ('linear',samparray) + return samparray + +def slinearound(samples, min, max): + + samparray = [0] * samples + linearinc = (max-min)/samples + for ww in range(samples): + if ww == 0: + samparray[ww] = round(min) + else: + samparray[ww] = round(samparray[ww-1] + linearinc) + #print('linear min max', min, max) + #print ('linear',samparray) + return samparray + + +# * 11.27 : to get value from 0 to 127 +def lin2squrt(value): + return round(np.sqrt(value)*11.27) + +def squrt2lin(value): + return round(np.livecode(value/11.27)) + + +def curved(value): + return round(np.sqrt(value)*11.27) + + +def Proj(x,y,z,angleX,angleY,angleZ): + + rad = angleX * math.pi / 180 + cosa = math.cos(rad) + sina = math.sin(rad) + y2 = y + y = y2 * cosa - z * sina + z = y2 * sina + z * cosa + + rad = angleY * math.pi / 180 + cosa = math.cos(rad) + sina = math.sin(rad) + z2 = z + z = z2 * cosa - x * sina + x = z2 * sina + x * cosa + + rad = angleZ * math.pi / 180 + cosa = math.cos(rad) + sina = math.sin(rad) + x2 = x + x = x2 * cosa - y * sina + y = x2 * sina + y * cosa + + + """ Transforms this 3D point to 2D using a perspective projection. """ + factor = fov / (viewer_distance + z) + x = x * factor + centerX + y = - y * factor + centerY + return (x,y) + + +# +# Main +# + + +x0 = 200 +y0 = 200 + + +anglepos = 0 +startime = datetime.now() +z = 0 + + +def Code(LAY): + + dots = [] + xcenter = math.sin(math.radians(anglepos)) + ycenter = math.cos(math.radians(anglepos)) + + if anglepos + 1 < 361: + anglepos += 1 + else: + anglepos = 0 + + for angle in slinear(20, 0, 380): + #for counter in range(0,380): + + t = timedelta.total_seconds(datetime.now() - startime) + x = math.sin(math.radians(angle)) + y = math.cos(math.radians(angle)) + dots.append(Proj(x,y,z,0,math.sin(math.radians(angle)),0)) + + # lj.PolyLineOneColor(Form, c = Liveform.color , layer = Liveform.layer, closed = Liveform.closed) + lj.rPolyLineOneColor(dots, c = LAY['color'], layer = LAY['number'], closed = False, xpos = xcenter * x0, ypos = ycenter * y0, resize = 1, rotx = math.sin(math.radians(angle)), roty = 0 , rotz = math.sin(math.radians(angle))) + + + diff --git a/server/install.sh b/server/install.sh index f5b3fbf..8d9d2d2 100755 --- a/server/install.sh +++ b/server/install.sh @@ -1,17 +1,18 @@ #!/bin/bash sudo apt upgrade -sudo apt install htop -sudo apt install syncthing -#sudo apt install python-pip sudo apt install python3-pip -sudo apt install git sudo apt install redis-server -sudo apt install screen -sudo apt install tmux -#pip install numpy -#pip install scipy -#pip install python-rtmidi -#pip install mido +# for dedicated computer after fresh linux install. todo : ask if needed. +#sudo apt install git +#sudo apt install syncthing +#sudo apt install htop +#sudo apt install screen +#sudo apt install tmux +#sudo apt install nginx +#sudo apt install supervisor +#sudo apt install ssh +# todo one day : modify correct path in syncthing.conf +#sudo cp syncthing.conf to /etc/supervisor/conf.d/ pip3 install scipy pip3 install numpy #pip install pygame==1.9.2 @@ -23,11 +24,8 @@ sudo apt install libasound2-dev sudo apt install libjack-dev pip3 install python-rtmidi pip3 install mido -sudo apt install nginx -sudo apt install supervisor -sudo apt install ssh -sudo cp syncthing.conf to /etc/supervisor/conf.d/ git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && sudo ./setup.py install +# todo : ask for computer ip and run updateUI.py cd /tmp sudo apt install portaudio19-dev sudo apt install cmake diff --git a/server/install.sh.darwin b/server/install.sh.darwin new file mode 100644 index 0000000..fbee059 --- /dev/null +++ b/server/install.sh.darwin @@ -0,0 +1,66 @@ +#!/bin/bash +brew upgrade +brew install htop +#brew install syncthing +#brew install python-pip +brew install python3-pip +brew install git +brew install redis +brew install screen +brew install tmux +#pip install numpy +#pip install scipy +#pip install python-rtmidi +#pip install mido +pip3 install scipy +pip3 install numpy +#pip install pygame==1.9.2 +#pip3 install pygame==1.9.2 +pip3 install redis +pip3 install pysimpledmx +pip3 install DMXEnttecPro +#brew install libasound2-dev +#brew install libjack-dev +pip3 install python-rtmidi +pip3 install mido +#brew install nginx +#brew install supervisor + +#sudo cp syncthing.conf to /etc/supervisor/conf.d/ +git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && sudo ./setup.py install +cd /tmp +brew install portaudio19-dev +brew install cmake +git clone https://github.com/Ableton/link.git +cd link +git submodule update --init --recursive +mkdir build +cd build +cmake .. +cmake --build . + + +# +# Ableton link +# + + +cd /tmp/ +git clone --recursive https://github.com/gonzaloflirt/link-python.git +cd link-python +mkdir build +cd build +cmake .. + +# After cmake.. to build for non-apple python but brew style python : +# +# change in /tmp/link-python/build/CMakeCache.txt + +#//Path to a program. +#PYTHON_EXECUTABLE:FILEPATH=/usr/local/bin/python3 + +#//Path to a library. +#PYTHON_LIBRARY:FILEPATH=/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib + + +cmake --build . diff --git a/updateUI.py b/updateUI.py index e93f22a..969378e 100644 --- a/updateUI.py +++ b/updateUI.py @@ -7,11 +7,12 @@ LJ UI IP updater v0.8.1 ''' #wwwIP = "192.168.2.78" #wwwIP = "aurora.teamlaser.fr" -wwwIP = "192.168.2.43" +wwwIP = "192.168.1.48" import os, sys ljpath = r'%s' % os.getcwd().replace('\\','/') +python2 = (2, 6) <= sys.version_info < (3, 0) def Updatewww(file_name): @@ -22,24 +23,25 @@ def Updatewww(file_name): for line in a: - #print line - if (2, 6) <= sys.version_info < (3, 0) == True: + if python2 == True: # python2 if "var LJ = " in line > -1: p=a.index(line) #so now we have the position of the line which to be modified a[p]=" var LJ = 'ws://"+wwwIP+":9001/'\n" - #print p, line, a[p] + #print(p, line, a[p]) else: # python3 - if "var LJ = " in line == True: + IPline = ("var LJ = " in line) + if IPline == True: + p=a.index(line) #so now we have the position of the line which to be modified a[p]=" var LJ = 'ws://"+wwwIP+":9001/'\n" - #print p, line, a[p] + #print(p, line, a[p]) f.seek(0) f.truncate() #ersing all data from the file @@ -56,10 +58,5 @@ Updatewww(ljpath+"/www/LJ.js") Updatewww(ljpath+"/www/trckr/trckrcam1.html") Updatewww(ljpath+"/www/simu.html") Updatewww(ljpath+"/www/align.html") -Updatewww(ljpath+"/www/gen0.html") -Updatewww(ljpath+"/www/aur0.html") -Updatewww(ljpath+"/www/aur0s.html") -Updatewww(ljpath+"/www/aur1.html") Updatewww(ljpath+"/www/auralls.html") Updatewww(ljpath+"/www/index.html") - diff --git a/www/LJ.js b/www/LJ.js index 6d6dee4..3f00fc1 100644 --- a/www/LJ.js +++ b/www/LJ.js @@ -4,7 +4,7 @@ // LJ websocket address. IP will be updated at LJ startup according to LJ.conf wwwIP - var LJ = 'ws://192.168.2.43:9001/' + var LJ = 'ws://192.168.1.48:9001/' // diff --git a/www/README.md b/www/README.md new file mode 100644 index 0000000..f3ed726 --- /dev/null +++ b/www/README.md @@ -0,0 +1,96 @@ +clmtrackr +====== + +[![npm version](https://img.shields.io/npm/v/clmtrackr.svg)](https://www.npmjs.com/package/clmtrackr) + +![tracked face](https://auduno.github.io/clmtrackr/examples/media/clmtrackr_03.jpg) + +**clmtrackr** is a javascript library for fitting facial models to faces in videos or images. It currently is an implementation of *constrained local models* fitted by *regularized landmark mean-shift*, as described in [Jason M. Saragih's paper](http://dl.acm.org/citation.cfm?id=1938021). **clmtrackr** tracks a face and outputs the coordinate positions of the face model as an array, following the numbering of the model below: + +[![facemodel_numbering](https://auduno.github.io/clmtrackr/examples/media/facemodel_numbering_new_small.png)](https://auduno.github.io/clmtrackr/examples/media/facemodel_numbering_new.png) + +[Reference](http://auduno.github.io/clmtrackr/docs/reference.html) - [Overview](https://www.auduno.com/2014/01/05/fitting-faces/) + +The library provides some generic face models that were trained on [the MUCT database](http://www.milbo.org/muct/) and some additional self-annotated images. Check out [clmtools](https://github.com/auduno/clmtools) for building your own models. + +For tracking in video, it is recommended to use a browser with WebGL support, though the library should work on any modern browser. + +For some more information about Constrained Local Models, take a look at Xiaoguang Yan's [excellent tutorial](https://sites.google.com/site/xgyanhome/home/projects/clm-implementation/ConstrainedLocalModel-tutorial%2Cv0.7.pdf?attredirects=0), which was of great help in implementing this library. + +### Examples ### + +* [Tracking in image](https://auduno.github.io/clmtrackr/examples/clm_image.html) +* [Tracking in video](https://auduno.github.io/clmtrackr/examples/clm_video.html) +* [Face substitution](https://auduno.github.io/clmtrackr/examples/facesubstitution.html) +* [Face masking](https://auduno.github.io/clmtrackr/examples/face_mask.html) +* [Realtime face deformation](https://auduno.github.io/clmtrackr/examples/facedeform.html) +* [Emotion detection](https://auduno.github.io/clmtrackr/examples/clm_emotiondetection.html) +* [Caricature](https://auduno.github.io/clmtrackr/examples/caricature.html) + +### Usage ### + +Download the minified library [clmtrackr.js](https://github.com/auduno/clmtrackr/raw/dev/build/clmtrackr.js), and include it in your webpage. + +```html +/* clmtrackr libraries */ + +``` + +The following code initiates the clmtrackr with the default model (see the [reference](http://auduno.github.io/clmtrackr/docs/reference.html) for some alternative models), and starts the tracker running on a video element. + +```html + + +``` + +You can now get the positions of the tracked facial features as an array via ```getCurrentPosition()```: + +```html + +``` + +You can also use the built in function ```draw()``` to draw the tracked facial model on a canvas : + +```html + + +``` + +See the complete example [here](https://auduno.github.io/clmtrackr/examples/example.html). + +### Development ### + +First, install [node.js](http://nodejs.org/) with npm. + +In the root directory of clmtrackr, run `npm install` then run `npm run build`. This will create `clmtrackr.js` and `clmtrackr.module.js` in `build` folder. + +To test the examples locally, you need to run a local server. One easy way to do this is to install `http-server`, a small node.js utility: `npm install -g http-server`. Then run `http-server` in the root of clmtrackr and go to `https://localhost:8080/examples` in your browser. + +### License ### + +**clmtrackr** is distributed under the [MIT License](http://www.opensource.org/licenses/MIT) diff --git a/www/align.html b/www/align.html index 9f74bbb..1d5ee3d 100644 --- a/www/align.html +++ b/www/align.html @@ -604,9 +604,7 @@ + +

Modelviewer

+ +

Load a model from a file:

+ + + + + diff --git a/www/trckr/modelviewer_spca.html b/www/trckr/modelviewer_spca.html new file mode 100644 index 0000000..57de3a4 --- /dev/null +++ b/www/trckr/modelviewer_spca.html @@ -0,0 +1,209 @@ + + + + PDM Modelviewer + + + + + + + +

Modelviewer

+ +

Load a model from a file:

+ + + + + diff --git a/www/trckr/trckrcam1.html b/www/trckr/trckrcam1.html index 0a5d65e..96d79a9 100644 --- a/www/trckr/trckrcam1.html +++ b/www/trckr/trckrcam1.html @@ -378,8 +378,8 @@