franko / gsl-shell

GSL library shell based on LuaJIT2
http://franko.github.io/gsl-shell/
GNU General Public License v3.0
92 stars 12 forks source link

Livecoding fun #20

Open marcelvanherk opened 10 years ago

marcelvanherk commented 10 years ago

Hi Francesco,

not a bug at all, but try gsl shell from zerobrane studio with a script like this and live coding. It is incredibly powerful and fun to use. I hope to create some plugins soon for zbs to provide more control of graphing during live coding with help from Paul. Thinking of clone graph, etc.

Regards,

Marcel

-- create plot area if p==nil then p = graph.plot('radial scatter kernel (red) and radial integral (blue)') p:show() end

function kernel() return |r| r_(math.exp(-3.45_r^2)+math.exp(-0.033*r^2)/25.5) end

local fk = kernel() local fi = function(t) return num.integ(fk, 0, t) end local fi100= fi(100)

local ln1 = graph.fxline(|t| fk(t)/fi100, 0, 12) local ln2 = graph.fxline(|t| 0.73+0.26*fi(t)/fi100), 0, 12, 100)

p:clear() p:addline(ln1, 'red') p:addline(ln2, 'blue')

franko commented 10 years ago

Hi Marcel,

I'm glad if you are able to do interesting things using livecode. Unfortunately I don't know very well how liveconding works. Do you think you can explain in a simple way how the live coding is so much interesting ? May be you can illustrate me a typical/simplified workflow that you use with live coding.

I'm interested in the idea. I'm not actually completely satisfied with the simple workflow where you modify a script and run it again and again.

May be I can implement live coding natively in gsl shell if this is really interesting.

Francesco

marcelvanherk commented 10 years ago

Hi Francesco,

you start it from zbs0.40 with ctrl-f6 (select gsl-shell as interpreter of course), anything you type or changes in the script updates the graph immediately, dragging numbers with mouse gradually changes the graph as well.

Hope this helps.

Marcel


Van: Francesco [notifications@github.com] Verzonden: zondag 26 januari 2014 19:24 Aan: franko/gsl-shell CC: Marcel van Herk Onderwerp: Re: [gsl-shell] Livecoding fun (#20)

Hi Marcel,

I'm glad if you are able to do interesting things using livecode. Unfortunately I don't know very well how liveconding works. Do you think you can explain in a simple way how the live coding is so much interesting ? May be you can illustrate me a typical/simplified workflow that you use with live coding.

I'm interested in the idea. I'm not actually completely satisfied with the simple workflow where you modify a script and run it again and again.

May be I can implement live coding natively in gsl shell if this is really interesting.

Francesco

— Reply to this email directly or view it on GitHubhttps://github.com/franko/gsl-shell/issues/20#issuecomment-33325460.

franko commented 10 years ago

Ok, I've tried the live coding. This is actually nice to make some changes and see immediately the result in the plot, I agree with you :-)

Actually I was annoyed by the flickering of the plot. You can eliminate the problem by using p.sync = false -- only when the plot is created the first time p:flush() -- after the final addline instruction

after it was much better for me!

Otherwise I will think how this way of working can be integrated with GSL Shell. One way is to just implement live codilng like ZBS but may be I will end up with something else.

marcelvanherk commented 10 years ago

Thanks,

I will add these calls to my sample. To integrate such behavior into GSL shell there should probably be a global actove plot object that you reuse on every run and whose update is controlled by the 'live coding' controller.

Marcel


Van: Francesco [notifications@github.com] Verzonden: zondag 26 januari 2014 21:17 Aan: franko/gsl-shell CC: Marcel van Herk Onderwerp: Re: [gsl-shell] Livecoding fun (#20)

Ok, I've tried the live coding. This is actually nice to make some changes and see immediately the result in the plot, I agree with you :-)

Actually I was annoyed by the flickering of the plot. You can eliminate the problem by using p.sync = false -- only when the plot is created the first time p:flush() -- after the final addline instruction

after it was much better for me!

Otherwise I will think how this way of working can be integrated with GSL Shell. One way is to just implement live codilng like ZBS but may be I will end up with something else.

— Reply to this email directly or view it on GitHubhttps://github.com/franko/gsl-shell/issues/20#issuecomment-33328856.