Compagnie Gaspard Buma
enfr

News

Workshop lubyk

Workshop interne avec l’équipe de l’EPFL-ECAL-lab pour évaluer lubyk. Si tout va bien, on aura quelques démos à mettre en ligne…

Prochain spectacle

Nous travaillons actuellement sur le spectacle des bateaux pour nulle part prévu pour l’automne 2012.

Turing, Serial, Keyboard objects

Just finished creating a “Turing” object. It’s a state machine that takes incoming signals and moves to a new state, throwing a value out sometimes. ( “live” stupid session with a lua script.)

Turing

The Turing object is really interesting. You can write a state machine like this :

fun
# x = forward C D D# G
# z = backward
g x-> c 60 # this is the transition from state g when 'x' is received.
c x-> d 62
d x-> e 63
e x-> g 67
e c-> a 68
e d-> a 72
a x-> c 60

a c-> g 67
a z-> e 63

c z-> g 67
g z-> e 63
e z-> d 62
d z-> c 60

The object compiles this source code into goto and send tables :

goto
 .   x  c  d  z
 0 1 - - 3
 0 2 - - 0 # '-' means "use default" (= value in first column)
 0 3 - - 1
 0 0 4 4 2
 0 1 0 - 3
send
 .   x  c  d  z
 / 60 - - 63    
 / 62 - - 67    #  '-' means "use default"
 / 63 - - 60
 / 67 68 72 62 # '/' means "do not send"
 / 60 67 - 63

When a token arrives, it is translated into it’s token_id (using another table of 256 chars). In our example, ‘x’ has id 1, ‘c’ has id 2, etc. Then we simply read the new state by looking at the current state’s row and column indicated by the token_id. We have just used a small trick for default values: if the result of our lookup is 0, we look at the ‘default token’ column (first column) to find the move.

Here is a more simple example. In this example we can see that ‘b’ has defaults (/) and the default move is (0 = goto ‘a’).

929881652851' width='258' height='199' alt='fun2' class='std'/>
a  x  -> b { X }
a  'y'-> b { Z }
b  ----> a { A }
b  -x--> b {   }


goto ======
   . x y
a  0 1 1
b  0 1 -

send ======
   . x y
a  / X Z
b  A / -

Serial

This one lets you receive data from the serial port. Nothing much to add except I could not find a C++ wrapper that with MIT licence (like rubyk) so I had to write my own. I felt like reinventing the wheel on this one.

Keyboard

Just type this:

> k=Keyboard()
> n=NoteOut()
> k=>n
> m=Midi()
> n=>m
> k.get

To start playing midi with your keyboard. See how the shift key give lower sounds since ‘A’ is 65 and ‘a’ is 97.

... it’s 5am I’m dead tired.

PS

“live” stupid session with a lua script.