
A blog has been started for this semester's Music Technology Forum ("Electronics, Instruments & Improvisation"). It is called EMUTRON. You can find it here: http://emutron.blogspot.com/.

What is digital, what is analog? Can musical form include structural information regarding moving from an unbalanced, ambiguous state (read chaos) to a more balanced, well-defined state (read order)? What is a computer, what is a computation?
Consider that here we have an interface that is a videogame console controller designed with a pseudo-instrumental appearance and functionality in mind that controls a game which is basically a classic platformer using simplified musical gestures. This is why i find the concept of making music with a set of Donkey Konga bongos an interesting one.
Couldn't sleep this morning. Instead, i connected a NES controller that was lying around to my Arduino. The NES controller is actually digital, so it only uses three digital pins on the Arduino (plus positive and ground voltage pins) to read the eight button states individually. The code below has been tested and working. This is all thanks to this handy chapter on videogame hardware. Thanks!
P0 to P7 are the parallel digital inputs.
The state of the controller is fed out in the following order: A button, B button, select, start, up, down, left, right. Because the code shifts each bit to the left once it has been received, the first bit becomes the most significant bit. The format of the data byte is as follows:
Introduction/* INITIALISATION */
int SS1 = 2; // set slave select 1 pin
int SS2 = 5; // set slave select 2 pin
int CLK = 3; // set clock pin
int MOUT = 4; // set master out, slave in pin
byte cmd_byte0 = B00010001; // command byte to write to pot 0, from the MCP42XXX datasheet
byte cmd_byte1 = B00010010; // command byte to write to pot 1, from the MCP42XXX datasheet
byte cmd_byte2 = B00010011; // command byte to write to pots 0 and 1, from the MCP42XXX datasheet
byte work = B00000000; // setup a working byte, used to bit shift the data out
/* SETUP */
void setup() { // setup function begins here
pinMode(SS1, OUTPUT); // set CS pin to output
pinMode(SS2, OUTPUT); // set CS pin to output
pinMode(CLK, OUTPUT); // set SCK pin to output
pinMode(MOUT, OUTPUT); // set MOSI pin to output
digitalWrite(SS1, HIGH); // hold slave select 1 pin high, so that chip is not selected to begin with
digitalWrite(SS2, HIGH); // hold slave select 2 pin high, so that chip is not selected to begin with
}
void spi_transfer(byte working) {
; // function to actually bit shift the data byte out
for(int i = 1; i <= 8; i++) { // setup a loop of 8 iterations, one for each bit
if (working > 127) { // test the most significant bit
digitalWrite (MOUT,HIGH); // if it is a 1 (ie. B1XXXXXXX), set the master out pin high
}
else {
digitalWrite (MOUT, LOW); // if it is not 1 (ie. B0XXXXXXX), set the master out pin low
}
digitalWrite (CLK,HIGH); // set clock high, the pot IC will read the bit into its register
working = working << 1;
digitalWrite(CLK,LOW); // set clock low, the pot IC will stop reading and prepare for the next iteration (next significant bit
}
}
void spi_out(int SS, byte cmd_byte, byte data_byte) { // SPI tranfer out function begins here
digitalWrite (SS, LOW); // set slave select low for a certain chip, defined in the argument in the main loop. selects the chip
work = cmd_byte; // let the work byte equal the cmd_byte, defined in the argument in the main loop
spi_transfer(work); // transfer the work byte, which is equal to the cmd_byte, out using spi
work = data_byte; // let the work byte equal the data for the pot
spi_transfer(work); // transfer the work byte, which is equal to the data for the pot
digitalWrite(SS, HIGH); // set slave select high for a certain chip, defined in the argument in the main loop. deselcts the chip
}
void loop () {
for(int j = 0; j < 256; j++) {
spi_out(SS1, cmd_byte0, j); // send out data to chip 1, pot 0
spi_out(SS1, cmd_byte1, 255 - j); // send out data to chip 1, pot 1
spi_out(SS2, cmd_byte0, j / 2); // send out data to chip 2, pot 0
spi_out(SS2, cmd_byte1, 128 - (j/2)); // send out data to chip 2, pot 1
delay(10); // set a short delay
}
}

In order to try and take a break from cleaning the house, i decided to get serious in designing and building a standalone Toriton instrument.
4 bit sawtooth. you can clearly see the 16 steps.
by inserting an inverter stage in every bit line,
Out
|
Vcc --- Rb ---| --- Ra --- Gnd


/* Simple Live Instrument (for mobile phone)
by Sebastian Tomczak
14 July 2007, Adelaide, Australia
*/
import processing.sound.*;
int keyvalue = 0;
int octavevalue = 45;
int[] pitches = {
0, 2, 3, 5, 7, 8, 10, 12, 14};
void draw() {
}
void keyPressed() {
if(key >= '1' &&amp;amp;amp; key <= '9') { keyvalue = key - '1'; keyvalue = pitches[keyvalue] + octavevalue; Sound.playTone(keyvalue, 100, 100);} if(keyCode == LEFT) { octavevalue = octavevalue - 12;} if(keyCode == RIGHT) { octavevalue = octavevalue + 12;} }



