Programming tutorials

209 views
Skip to first unread message

Joe Citizen

unread,
Jun 22, 2018, 9:34:44 PM6/22/18
to Lightjams
Hi everyone,

I wonder if I'm the only noob here struggling to understand the math / programming/ logic aspects of LJ. I really l like this program - I think it's really amazing, but I struggle with learning the basics of the math. I've done a bit of Max/MSP so it's not a complete mystery, but I was wondering if anyone has any recommendations in terms of where I can go to find out about the logic of the actual logic? I think that sometimes those people who find math easy have difficulty in understanding that some of us don't really get how the value, comma, value, comma, brackets thing works. Does anyone have any suggestions please? 

Thanks in advance,

Joe

sightsoundcookeville

unread,
Jun 22, 2018, 9:45:10 PM6/22/18
to ligh...@googlegroups.com
Use the math, but start small.

You can watch your math work in real time with the graph in the lower right hand corner.

One step at a time. Don't just write the whole equation. Write a piece, make sure it works in the graph, make it more complex and repeat. Sometimes I write 5 lines worth, it doesn't work, so I start over.

Dont get frustrated. 

There are infinite ways to do the right thing in Lightjams, when you find the one that works for you the rest will fall into place.

Equations let you cheat, but you won't see the real rewards until you're pretty into it. 

What are you trying to create? 

--
You received this message because you are subscribed to the Google Groups "Lightjams" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightjams+...@googlegroups.com.
To post to this group, send email to ligh...@googlegroups.com.
Visit this group at https://groups.google.com/group/lightjams.
For more options, visit https://groups.google.com/d/optout.

Joe Citizen

unread,
Jun 22, 2018, 9:47:52 PM6/22/18
to Lightjams
Thanks for the reply - it is pretty frustrating! I'm tring to create the 'look of rain' i.e. have sources that do their thing in a downwards movement, and when they get the the edge don't loop back again, but redo from the top again.. 

sightsoundcookeville

unread,
Jun 22, 2018, 9:50:13 PM6/22/18
to ligh...@googlegroups.com
Use a saw wave for y position. 

Joe Citizen

unread,
Jun 22, 2018, 9:52:24 PM6/22/18
to Lightjams
Now I just feel dumb - thank you. I thought I'd tried this already, but I guess not.

Most appreciated.

Joe

sightsoundcookeville

unread,
Jun 22, 2018, 9:53:05 PM6/22/18
to ligh...@googlegroups.com
You can create that with the Gui, but in code you can attach the speed to music volume or just get weird with it

sightsoundcookeville

unread,
Jun 22, 2018, 9:54:51 PM6/22/18
to ligh...@googlegroups.com
It's okay it be dumb sometimes, happens to all of us. It's only giving up and death that causes failure. 

Joe Citizen

unread,
Jun 22, 2018, 9:56:08 PM6/22/18
to Lightjams
New question - how can I introduce a delay between each cylce?

sightsoundcookeville

unread,
Jun 22, 2018, 10:03:32 PM6/22/18
to ligh...@googlegroups.com
This is where you could use dozens of techniques, hence why no straightforward tutorial exists.

Spaced our how?

If you tied the intensity of different sources to different frequencies it would modulate to the audio in. 

If you're a midi drummer you would tie the intensities to different drums.

Ive got a way to build stuff to SMTPE timecode but there's some explanation. 

Maybe another sine wave in the intensity slot at the same time frame or a multiple of it. 

Whatever you use, save your work, push the nuclear button and thy getting weird with it. That's when the best stuff happens. 

Mathieu

unread,
Jun 22, 2018, 10:25:15 PM6/22/18
to Lightjams
One way might be to multiply the sawtooth so that it goes over 100%. In this case, since the source cannot go outside the grid, it will be stuck at the bottom for some time.

Try this formula:

100-sawtooth(3)*2

*2 means multiply by 2. So change it to change the length of the pause.

Joe Citizen

unread,
Jun 22, 2018, 10:25:36 PM6/22/18
to Lightjams
Really appreciate your responses, and appear to be having a parallel conversation with the indefatigable Mathieu. I'm just wanting to do it in terms of timing e.g. if the loop runs for 2 seconds, how do I introduce a timed pause before the wave starts again? (in this case at the top of the grid). My weirdness is introduced externally via environmental sensors. I've come from film, so I'm interested in old fashioned animated effects, which I'll weirdify through colour and saturation..

Joe Citizen

unread,
Jun 22, 2018, 10:26:44 PM6/22/18
to Lightjams
Dang - took too long to respond and Mathieu got in before me!

Joe Citizen

unread,
Jun 22, 2018, 10:33:37 PM6/22/18
to Lightjams
Serious weirdness! This only works if I resize the grid - it's 'pausing' by running off laterally in one direction or the other..

sightsoundcookeville

unread,
Jun 22, 2018, 10:35:31 PM6/22/18
to ligh...@googlegroups.com
As usual, Mathieu has the most simple and elegant way.

I would use some sort of latch function to hold the source until a trigger. 

Joe Citizen

unread,
Jun 22, 2018, 10:38:13 PM6/22/18
to Lightjams
Sorry, I don't understand what you mean by this? I know I can use a specific Midi note to trigger things, but what's a latch?

Joe Citizen

unread,
Jun 22, 2018, 10:41:52 PM6/22/18
to Lightjams
Sorry just looked at the comand line page - it's storing a value..?

sightsoundcookeville

unread,
Jun 22, 2018, 10:44:43 PM6/22/18
to ligh...@googlegroups.com
Yeah, function stuff. Might want to work your way up to that one. Mathieu's idea is much easier. 

Joe Citizen

unread,
Jun 22, 2018, 10:51:45 PM6/22/18
to Lightjams
Ha. That's the trouble - learn by doing, and need the next step in order to scaffold learning. Really appreciate your replies - thank you.

sightsoundcookeville

unread,
Jun 22, 2018, 11:11:00 PM6/22/18
to ligh...@googlegroups.com
I'm thinking midi trigger.

Try fadeout.exp(onbeat(music.1)) in the y position. Then do weird math stuff with music.1

Joe Citizen

unread,
Jun 22, 2018, 11:20:07 PM6/22/18
to Lightjams
Hmmn. Where 1=? time? midi note? What does this expression actually mean? fade out exponentially then?when? a beat is received do 'something'? where 1 = time? Like this is the hard part...

I've been using a nanopad to listen to notes (it's just a stand-in for when I receive data values 0-127). At the moment I'm listening for note values to create hue or intensity changes.. So using this as an example, how would what you're thinking about work? 

Joe Citizen

unread,
Jun 23, 2018, 1:19:08 AM6/23/18
to Lightjams
Mathieu, what does the (3) in this argument mean please? And how do invert it? i.e. it's running mainly from centre to the left - how do I make it towards the right? or more random?

Joe Citizen

unread,
Jun 23, 2018, 1:35:19 AM6/23/18
to Lightjams
I'm figuring it out - the (3) represents the time - but because I'm working inside a triangle, it's slightly *odd*. The thing to do is as sightsoundcookeville suggests - be able to alter the available time based on incoming values... is that where 'if' comes in? If (midi value) [how do I do that??] then alter time by relationship to midi value...?

Joe Citizen

unread,
Jun 23, 2018, 2:17:42 AM6/23/18
to Lightjams
So .. what does the 100 stand for? (100% of the time? 100% of the grid?) the bracketed value is time for the cycle to complete. The * is a multiplier, but the multiplier, which you describe as length of pause, but what is it actually? Repeat the (time value) cycle by (this amount of time) before the beginning of the operation (cycle)... because.. by having a larger grid I've 'pushed' the cycle over 100% - therefore the 100 doesn't represent the size of the grid, but the percentage size of the cycle?? And by having a larger grid it's 'completing' the rest of the operation before it starts the cycle again..? And because it's a sawtooth it pulses from 0 to 100% and back to 0%.. I think..

So ideally I want to have variation within the 'down path' of the sawtooth (from 0 to 100%), whilst retaining the overall sawtooth path. And this variation would ideally be triggered by midi pressure. So.. I'm wanting a range inside say.. 10% to 90% of the downward path, of which I'd like the midi pressure to hold its value momentarily, reverse momentarily, and end it's held value range.. (I think this will allow my animated rain to 'bounce').

So I reallise this is really dumb question, but basically these are wave shapes..? and all that's really going on is the logic operation 'runs' the parameters of the wave shapes?? using time, percentage of wave, um.. and stuff?

Joe Citizen

unread,
Jun 23, 2018, 2:59:53 AM6/23/18
to Lightjams

Kind of an experiment.. now how do I hold a value so it goes flat at that value for a specifable amount of time..?

Joe Citizen

unread,
Jun 23, 2018, 3:06:58 AM6/23/18
to Lightjams
Actually the thing to do would be able to update the original time value 100-sawtooth(Q)*2, where Q is a variable based on Midi pressure.. Sorry, lots of questions... and I'm in NZ so ahead of the rest of the world by 12 hours ;)

Mathieu

unread,
Jun 23, 2018, 7:37:29 AM6/23/18
to Lightjams
To use a MIDI control as the time parameter for the sawtooth function, you can do:

100-sawtooth(20/midi.control(1, 10))*2

midi.control(1,10) is the midi CC value (0-100%) of channel 1 and control 10. 

Joe Citizen

unread,
Jun 24, 2018, 12:24:14 AM6/24/18
to Lightjams
Thank you for this Mathieu. Got lots to learn..
Reply all
Reply to author
Forward
0 new messages