In this class, we moved from dealing with coding 'inside' an RTcmix instrument to working with ways of running RTcmix from 'outside', or within another program. Just for fun, we hacked up several simple cellular automata programs. cellauto.c prints out a series of "0"s and "1"s following a very crude automata rule. cellauto1.c uses the same code as cellauto.c, but writes an RTcmix scorefile that maps the "0"s and "1"s onto differing notes for the STRUM plucked-string instrument.
Finally, cellautoG.c does an X11-windows graphics realization
of the simple automata and schedule RTcmix notes --
in real-time...wheee! -- and makes a real purty picture.
#define MAIN #includeObviously, the notes don't have to be schedule "by hand", you can use all the power and niftiness of C++ to do fun things like:#include #include #include "RTcmix.h" int main(int argc, char *argv[]) { RTcmix *rrr; rrr = new RTcmix(); rrr->printOn(); sleep(1); // give the thread time to initialized rrr->cmd("load", 1, "METAFLUTE"); rrr->cmd("makegen", 7, 1.0, 24.0, 1000.0, 0.0, 1.0, 1.0, 1.0); rrr->cmd("makegen", 11, 2.0, 24.0, 1000.0, 0.0, 0.0, 0.05, 1.0, 0.95, 1.0, 1.0, 0.0); rrr->cmd("SFLUTE", 7, 0.0, 1.0, 0.1, 106.0, 25.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 1.0, 1.0, 0.1, 95.0, 21.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 2.0, 1.0, 0.1, 89.0, 19.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 3.0, 1.0, 0.1, 75.0, 19.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 4.0, 1.0, 0.1, 70.0, 15.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 5.0, 1.0, 0.1, 67.0, 16.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 6.0, 1.0, 0.1, 56.0, 17.0, 5000.0, 0.5); rrr->cmd("SFLUTE", 7, 7.0, 1.0, 0.1, 53.0, 25.0, 5000.0, 0.5); sleep(8); }
int i; float start; float l1,l2; start = 0.0; for (i = 0; i < 100; i++) { l1 = rrr->cmd("random") * 25.0+5.0; l2 = rrr->cmd("random") * 25.0+5.0; rrr->cmd("SFLUTE", 7, start, 0.5, 0.1, l1, l2, 5000.0, 0.5); start += 0.2; }