pouët.net

Go to bottom

Live Coding Compo Framework

category: code [glöplog]
Pandur and my DJ/VJ set at demobit used a simple midi setup to deliver a clock signal from Traktor to his machine. Despite a bit of lag it worked very well. There were two situations in which manually reset the midi clock in Traktor to be tight with the visuals again. But that was it.

I think Alkama and Ableton artists won't run into any issues at all.

@Lug00ber - what's your experience with CDJ sets? It seems to me that your tracks are also properly analyzed and gridded. How much real hassle has it been for you in the past to keep a constant pace? Or: how well do CDJs react to changing tempo?

Like I wrote in the Revision thread:

I think both, FFT shizzle as well as a Midi Clock and maybe an easy to use clock divider would open a lot of possibilities for the coder to focus on making more use of synced visuals.
added on the 2018-04-06 15:38:19 by rp^frstl rp^frstl
Has anyone managed to get this to compile with visual studio 2017? or failing that, have access to an older version of visual studio in order to compile this?
added on the 2018-04-11 23:39:29 by Crypt Crypt
Haven't tried 2017 but 2015 should build it fine.
added on the 2018-04-12 01:35:05 by Gargaj Gargaj
Quote:
@Lug00ber - what's your experience with CDJ sets? It seems to me that your tracks are also properly analyzed and gridded. How much real hassle has it been for you in the past to keep a constant pace? Or: how well do CDJs react to changing tempo?

CDJs/Rekordbox doesn't really handle drifting that well, so for tracks that drift (played by humans or made with sequencers that drift) you have to manually stay on top of things. There is an option for dynamic bpm when analyzing tracks, but I don't think it's precise enough. The analyzing feature also don't do that well with transients, so the grid typically needs manual adjustment after analyzing in Rekordbox to be precise.

Note that the built in analyzing feature in the CDJs is not good enough here. Even for the 2000 NXS2 it's wildly imprecise, sometimes just plain wrong (anything more exciting than standard four to the floor untz-untz seem to throw it into disarray).

To keep a constant tempo I'd have to use tracks that don't drift, and use the sync feature on the CDJs (I normally don't). Also can't have Okkie start the compo before I'm actually good to to, to avoid what happened in the semi final between Flopine and Cupe (I was just dicking around playing some ~100 bpm tracks because Steltek needed a test signal for one of the computers, and hadn't prepared enough tracks in that range to play 25 minutes in that tempo :P).


CDJs don't have MIDI output, but some of the Pioneer mixers have (5 pin DIN, standard MIDI). For that to work you need to have CDJs and a newer Pioneer mixer all connected via Ethernet. I have never tested it, so I wouldn't know what information goes out from the MIDI port.

Getting information directly from the CDJs via Ethernet is an option, but the Pioneer PRO DJ-link protocol is proprietary. There has been some work done by independent developers to document it: DJ Link Packet Analysis
You essentially set up a computer to act as a "fake" CDJs, tricking other CDJs/DJMs on the network to send information to it. There is a Java implementation available.
added on the 2018-04-12 02:24:47 by lug00ber lug00ber
I put out a new release and two things are worth mentioning:
1. I changed the code around to LJ's suggestion that saving the shader to file is done _after_ the rendering, i.e. if a broken shader crashes the driver, it won't get saved thus driving the situation into an infinite loop crash until someone manually un-breaks the shader.
2. There's been a "postExitCmd" config option in the recent few releases that runs a shell command once the tool exits; I originally added this option for organizers to be able to rig the setup in a way that when the round ends, the shader gets copied or uploaded to somewhere safe, because I do believe having the shaders available for download post-party is important (I know Flashy has been complaining about this), but there didn't seem to be an effort to get this done and they just get lost and/or archived "via video" which feels lackluster. So I'm making an explicit note here that this option exists and you can set up a shell/PowerShell command to copy stuff over the network, upload to http, whatever.
added on the 2018-04-22 22:46:57 by Gargaj Gargaj
the 1st point should be fixed in Shadertoy too...
added on the 2018-04-23 09:29:52 by pohar pohar
I am using Bonzomatic_W64_DX11.exe from 20180422 (the one you posted above), and i don´t get the 2.) working ?! :/
Here´s my json:
Code: { "window":{ /* default window size / state, if there's a setup dialog, it will override it */ "width":1280, "height":1024, "fullscreen":true, "font":{ "file":"ProFontWindows.ttf", "size":24, }, "rendering":{ "fftSmoothFactor": 0.9, }, "textures":{ "texChecker":"textures/checker.png", "texNoise":"textures/noise.png", "texTex1":"textures/tex1.jpg", "texTex2":"textures/tex2.jpg", "texTex3":"textures/tex3.jpg", "texTex4":"textures/tex4.jpg", }, "gui":{ "outputHeight": 100, "opacity": 192, "texturePreviewWidth": 100, }, "postExitCmd":"copy_to_dropbox.bat" }

And here´s my "copy_to_dropbox.bat", which works when started manually:
Code: set hr=%TIME:~0,2% if %hr% leq 9 set hr=0%hr:~1,1% set mydate=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%-%hr%%TIME:~3,2%%TIME:~6,2% copy shader.dx11.hlsl C:\Dropbox\code\BonzomaticShaders\%mydate%.shader.dx11.hlsl

Any Idea what´s wrong here? I end Bonzomatic via Alt-F4, as Shift-ESC doesn´t have any functionality on my System.
Do i need to catch the argument (filename) in order to make this work or sth alike? Or is it, as i am assuming, just running the .bat in my Windows-OS-Environment and so i don´t have to care about the arguments bonzomatic drops onto the bat?
First off you should remove the comment from the JSON because it will stop it from parsing :)
added on the 2018-04-23 13:58:27 by Gargaj Gargaj
There's also a } missing before "font"
added on the 2018-04-23 13:58:57 by Gargaj Gargaj
Alright, did not know about the comments!
There was "}," missing indeed, copypasted your window-settings from github and forgot a line it seems, haha!
It´s working now! :)
Quote:
Blueberry, do you think your right to a fair competition would be totally screwed, if the beat sync didn't work perfectly all the time?

Not at all. As long as the beat sync works reasonably well most of the time, it doesn't matter if it gets confused and needs to resync now and then. The competition is so chaotic already, so the beat sync would not at all need to be perfectly stable.

Quote:
I think it's not just I and Blueberry, but many other shader coders would gladly welcome having a float value that resets at every beat or bar.

To be clear, this is specifically not what I want. I want a continuously increasing (or decreasing, doesn't matter) value which hits integers on the beats. This is no more difficult to implement (assuming that the beats are already detected/predicted) and is vastly more useful. It gives a "global" view of the beat sequence, so you can have animations that stretch across several beats.
added on the 2018-04-24 19:39:46 by Blueberry Blueberry
Hey everyone, lamer noob chiming in :) I watched the revision 2018 and 2017 shader compos recently and became pretty interested in this program (despite not knowing really anything about shader coding lol) and I have a few questions:

1. How do you get the FFT parameter to work? Is there an option in the config file that lets you tell it where the process that has the sound you want to use is? Or does it have to come from a specific place?

2. Do you know of any good sites that give good shader tutorials for HLSL (whether it be demo related or not)? I can only use the DX11 version and can't use the opengl version right now sadly since I don't have a computer at the moment, only a phone :( And the only computers I can use aren't mine so of course there is no hope of installing ogl 4.1 drivers (though I think they are old enough to where 4.1 isn't even an option anyway so I guess it doesn't really matter :D) On a side note, I was able to find a pretty decent GLSL live shader coding app for Android called "shader editor" which is (mostly) Shadertoy compatible so that's good for me I guess.

3. This isn't really a program specific question but... which do you guys think is better HLSL or GLSL? I noticed in the shader compo everyone used GLSL, is that because it's faster, quicker to write, has more features, etc? Is it because only glsl is allowed? I would love to hear you guys thoughts :)
added on the 2018-04-25 06:28:24 by Phenyx Phenyx
1. The sound is pulled in from your default recording device in your OS, which is usually either Line In or Mic.
2. I personally like https://thebookofshaders.com/; it's GLSL by syntax but most of HLSL and GLSL is just naming differences.
3. Neither of them are "better" to be honest, they're essentially the same. What differs is the programming environment they get used in; when it comes to livecoding, GLSL compilation is a bit faster.
added on the 2018-04-25 10:07:21 by Gargaj Gargaj
Quote:
GLSL compilation is a bit faster

depending on the language constructs used it might become a bit much faster than HLSL(considering that in the context of live coding everything > 1000ms is pretty annoying already), that being said switching from HLSL to GLSL is easy.
added on the 2018-04-25 14:31:23 by LJ LJ
Quote:
which do you guys think is better HLSL or GLSL?

GLSL, because HLSL's modulo function sucks :)
https://stackoverflow.com/questions/7610631/glsl-mod-vs-hlsl-fmod
added on the 2018-04-25 15:25:16 by yx yx
yx:
Ain´t that just a matter of not going negative? Just adding some amount always worked here, as in:
Code: p=fmod(p+1000.,2.)-1.;

adding them 1000 gets rid of the problem, as long as you don´t translate a 1000 in one direction that is of course...in which case you simply add some bigger value!

Phenyx:
I still like my HLSL!
Most demosceners code in OpenGL (as it seems) anyway, so using GLSL comes naturally to them! ;)
There may be some longer compile-times as LJ pointed out, but i don´t even realize any long recompile-times yet in Bonzomatic!
But as LJ also said: there´s only some few differences in the syntax, so switching between the two is very easy!

"frac" vs "fract"
"lerp" vs "mix"
"float3" vs "vec3"
and maybe some of the texture-lookups and such are different, but all in all it almost reads the same, hehe.
Quote:
GLSL compilation is a bit faster

Code:D3DCompile(source, sizeof(source), NULL, NULL, NULL, entryPoint, profile, D3DCOMPILE_SKIP_VALIDATION | D3DCOMPILE_SKIP_OPTIMIZATION, 0, &shaderBlob, &errorBlob);


And fast is your HLSL compilation :)
added on the 2018-04-26 00:21:16 by xTr1m xTr1m
Hi shadercoders!

I just thought I should announce I am currently working on a Windows screensaver based off the Bonzomatic code. It will be able to randomly cycle between your fragment shaders stored in a folder.

It currently displays shaders fine but it has trouble opening files for some reason. If I double click the .scr file it can load files but when Windows runs the screensaver y clicking preview or when it triggers the screensaver after an idle timeout then it can't load files and instead uses the default Bonzomatic tunnel shader. I wonder why...
added on the 2018-04-26 08:37:17 by nightfox nightfox
Ugh on doing some error checking...

File reads get a no such file error and file writes get a permission denied error. Maybe Windows is stopping file operations... Hope not or this project will have to be put on the shelf
added on the 2018-04-26 13:06:13 by nightfox nightfox
Is it normal that Bonzomatic keeps crashing for no apparent reason? Or is my graphics-card dying?
I just changed a 9 to 12 and it crashed, reloading let me see my shader with the 12-setting for 3 seconds until it crashed again. Thats just one of many times this happened by now! ;)
The 12 is just for a translation of an object in y-direction, there´s no way this could crash a shader normally! ;)
I haven´t managed to "repair" a once crashed shader yet. once it crashed, i can remove my last put lines with an external editor, and it may work again afterwards...but strangely once i re-add similar code it crashes again! If i then start from scratch in a newly generated file, type the same code it works! But i am loosing 10-15 mins each time this happens!
It´s really the same code i used dozens of times already, as i am starting from scratch every 25 mins to practice! Sometimes the same code just crashes...and i triple-checked, theres nothing different to the exact same code i used before without problems for days, no typos etc! ;)

Sorry, i guess it´s nothing about Bonzomatic itself, but my GFX-card is dying on me, but had to ventilate my anger somehow here i guess! ;)

BTW: is there some line for that .json that lets me set the vSync-flag to enabled permanently? It´s a first-world-problem, but it annoys the hell out of me having to set it each time it has crashed once again! I would hate loosing time to that in a compo, already having lost time due to a crash! :/
Hmm, thinking about it, now that i cooled down a bit...
...i started omitting dots in order to type faster, as in "float3(1,2,3)" vs "float3(1.,2.,3.)" ...in DirectX11 obviously.
I know this was a big problem back in time compiler-wise, but it works now without the dots.

Could that be the problem yielding me those crashes? It started crashing once i started doing so atleast!
Seems i found the bug...
...had nothing to do with Bonzomatic!

I found some pixels taking way too many calculations...
...fixed that with some Iteration-Counter/Bailout!
-> no more crashes!

Damn, this annoyed the hell out of me! I even uninstalled Nvidia Experience and 3DVision-Drivers, as they turned out to be bugging my system before, haha!

Now my basecode is even more to type and i am a slow typer with many typos inbetween (mostly thanks to way too sensible gamer-keyboard,haha) ...i really need to speed that up somehow...time to get a new coder-keyboard maybe!
Quote:
1. I changed the code around to LJ's suggestion that saving the shader to file is done _after_ the rendering, i.e. if a broken shader crashes the driver, it won't get saved thus driving the situation into an infinite loop crash until someone manually un-breaks the shader.


This behaviour needs sandboxing/fixing. And perhaps encore async.
added on the 2018-05-01 00:41:42 by superplek superplek
this feature is meant to work for crashes at shader-compile-time if i got it right!
and i love it! ;)
if your shader crashes bonzomatic while it is running this won´t work, obviously -> how to decide if a shader is running correctly and won´t produce a crash at some point of time so you can consider it safe to save it?!
What happened to me,though, is that i fixed a shader outside of bonzomatic, put a new uncompilable error in there and so bonzomatic decided to start from scratch with the standard-plasma, as it wasn´t compilable...overwriting my shader while at it...and as it crashed before (so no Alt-F4 with copy_to_dropbox.bat being executed) i lost my shader. Thinking about it, i should have checked my trashcan maybe, haha! ;)

login

Go to top