[PD] Fun with Lua coroutines

Frank Barknecht fbar at footils.org
Fri Nov 2 15:56:40 CET 2007


Hallo,
Steffen Juul hat gesagt: // Steffen Juul wrote:

> Ah, ok. It was especially the 'BibTex fashion' that got me curious.  
> Now i know what you mean by 'fashion'. I think. There is no nesting  
> in BibTeX for what i know of though.
> 
> All that blah blah said i think what your write about the structured- 
> ness is a good thing, as it allows for a (BibTeX kinda) way of  
> handling/doing multi diminutional arrays even with strings as keys.
> 
> - Which in a PHP fashion could be like:
> 
> Instruments[bass][tb303][cutoff] = 10
> Instruments[bass][tb303][cf] = 440
> Instruments[drumm] = drummset1
> 
> Patterns[p1] = "1 0 0 0 1 0 0 1"
> Patterns[p2] = "0 0 1 0 0 0 1 0"
> 
> Score[bass] = p1
> Score[drum] = p2

A nice thing with Lua would/could be that many entries actually could
be code. For example one could define harmonic voices in the config
file as functions like: 

  function major7(n) return {n, n + 4, n + 7, n + 10} end

and use this with the instruments: 

  sax(major7(60))

or 

  c = major7(60)
  sax.play(c)
  trumpet.play(c)
  c = minor7(62)
  sax.play(c)
  ...

I don't know if it makes sense to write a general purpose file loader
around this, but I plan to do some examples of this approach.

Ciao
-- 
 Frank Barknecht                                     _ ______footils.org__




More information about the Pd-list mailing list