[Csnd] score in lua
Date | 2013-03-13 13:23 |
From | Stephane Boussuge |
Subject | [Csnd] score in lua |
hi,
is it possible for somebody to give me an example of writing a score in Lua inside a csd with bin= lua ? i'saw some exemple in python but will be very happy to find some in Lua.
thanks stf |
Date | 2013-03-13 13:27 |
From | Michael Gogins |
Subject | Re: [Csnd] score in lua |
It also is possible to use the Lua opcodes, if you have LuaJIT installed on your machine, to write your score directly as Lua code embedded in the Csound orchestra header. See examples/opcode_demos/lua_scoregen.csd for an example.
On Wed, Mar 13, 2013 at 9:23 AM, Stephane Boussuge <stfboussuge@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-03-13 14:00 |
From | Stephane Boussuge |
Subject | Re: [Csnd] score in lua |
Thanks Michael, but i searching for the example folder but it's not here in the new csound .dmg (mac OSX) 5.18 or even 5.19.... could you give me a point to find it ? thanks stf 2013/3/13 Michael Gogins <michael.gogins@gmail.com>
|
Date | 2013-03-13 14:04 |
From | Stephane Boussuge |
Subject | Re: [Csnd] score in lua |
Thanks for your help John, i understand the way we can use bin=.. sytem (i already use it with ngen from Michael Khun) but what i'm searching for is a short typical loop / print script as we found in python for generationg line of score but in lua (because i know nothing to Lua and i 'm not a programmer in mind and my always best way for learning a programming language is to do music with it ;) stf 2013/3/13 Stephane Boussuge <stfboussuge@gmail.com>
|
Date | 2013-03-13 14:05 |
From | Michael Gogins |
Subject | Re: [Csnd] score in lua |
It's in the GIT repository here: http://sourceforge.net/p/csound/csound5-git/ci/66e5a98abd01c12e22e88b651b04bde138f8a2dd/tree/examples/opcode_demos/lua_scoregen.csd In general, if I cite something from Csound with a path, it should probably be in the same relative path in the Csound source code repository on SourceForge. Hope this helps,
Mike On Wed, Mar 13, 2013 at 10:00 AM, Stephane Boussuge <stfboussuge@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-03-13 14:08 |
From | Michael Gogins |
Subject | Re: [Csnd] score in lua |
And, this example has such a loop as you are looking for:
local c = .93849 local y = 0.5 local y1 = 0.5 local interval = 0.125 local duration = 0.5 local insno = 1 local scoretime = 0.5 for i = 1, 200 do scoretime = scoretime + interval y1 = c * y * (1 - y) * 4 y = y1 local key = math.floor(36 + y * 60) local velocity = 80 -- Format each iteration of the logistic equation as a Csound score event and schedule it. local message = string.format('i %d %9.4f %9.4f %9.4f %9.4f', insno, scoretime, duration, key, velocity) print(message) csoundApi.csoundInputMessage(csound, message) end Just remove the final line of this loop (the csoundAPI call) and you should be fine. On Wed, Mar 13, 2013 at 10:05 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-03-13 14:09 |
From | Michael Gogins |
Subject | Re: [Csnd] score in lua |
Fine when using bin, I mean. Mike On Wed, Mar 13, 2013 at 10:08 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-03-13 14:13 |
From | Stephane Boussuge |
Subject | Re: [Csnd] score in lua |
a very big thank you for your help Michael !! it'a all i need for starting !!! thank you very much. stf
2013/3/13 Michael Gogins <michael.gogins@gmail.com>
|
Date | 2013-03-13 14:27 |
From | "\\js" |
Subject | Re: [Csnd] score in lua |
hi On 3/13/13 10:13 , Stephane Boussuge wrote: > a very big thank you for your help Michael !! and from me too. i don't know how i missed this, but i think this will make my musical life much more interesting. further, it's one more manifestation of the amazing gift that all the csound developers have given to me [and many others]. when i use csound, i often use a programming language to generate the score parameters, and then use a templating library from the programming language to write csd text files which i then feed through csound. with the bin= capability, it seems i don't need the template files at all. i'm a little slow on the uptake sometimes, but as long as i get there in the end ... -- \js [http://or8.net/~johns/] - |
Date | 2013-03-14 18:53 |
From | Adam Puckett |
Subject | Re: [Csnd] score in lua |
I have done it both ways too, but as a programmer who used programming languages before I found Csound I rather like the templating (or %s formatting even) of those languages so all I need to do is |