public
Description: Ruby MIDI DJing/live-coding thing
Homepage:
Clone URL: git://github.com/gilesbowkett/archaeopteryx.git
archaeopteryx / demo.ck
100644 33 lines (27 sloc) 0.772 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
MidiIn min;
MidiMsg msg;
 
if ( !min.open(0) ) me.exit();
 
SndBuf s[50];
"drums/BOOM.aif" => s[36].read;
"drums/crikix.aif" => s[37].read;
"drums/bendy.aif" => s[39].read;
"drums/djembe-side.aif" => s[40].read;
"drums/electrotabla.aif" => s[41].read;
"drums/basic-ridebell.aif" => s[42].read;
"drums/african-pe-hi.wav" => s[43].read;
"drums/909-banging-lofi-hat.aif" => s[44].read;
"drums/707-ohh.aif" => s[45].read;
 
for( 0 => int i; i < s.cap(); i++)
  s[i] => dac;
 
while( true ) {
  min => now;
 
  while( min.recv( msg ) )
  {
   <<< msg.data1, msg.data2, msg.data3 >>>;
   if(msg.data1 >= 0x90 && msg.data1 < 0xa0) {
     0 => s[msg.data2].pos;
     (msg.data3 / 127.0) * 0.9 => s[msg.data2].gain;
     (msg.data3 / 127.0) * 0.2 + 0.9 => s[msg.data2].rate;
   }
  }
}