Monday, July 30, 2007

Emutron


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/.

More stuff arrives

ISD1510 digital audio recorder


M24C16 eeprom with i2c interface


Saturday, July 28, 2007

24 points of articulation

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?

The performance of "Twenty-four Points of Articulation" from our set on Thursday is now up on YouTube. Watch it here: http://www.youtube.com/watch?v=Ddr35PqsxoU

My SD card broke today and seemed to corrupt all of the data that was on it. So there are no other photos or footage from the Tomczak/Sutter camp from the concert.

Wednesday, July 25, 2007

DK bongos on mac

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.

Should be easy. The SuperJoyBox 13 (pictured in front of the bongos) is compatible with Mac OSX (despite what the box says). It appears as a USB HID device and can be routed into Max/MSP via the hi object.

Element 21 is the microphone, with data ranging from 9 to 136. Elements 6 and 5 are the high left and right bongos, whilst elements 4 and 3 are the low left and right sensors. The start button appears as element 10.

Tuesday, July 24, 2007

Stuff arrives

BAS120 printer module


Picaxe 14M microcontroller


Monday, July 23, 2007

... a little bit more


I worked on the standalone Toriton hardware a little bit more yesterday. The breadboard is looking a little less clustered. I still have to massage the data and maths quite a lot more, though.

Sunday, July 22, 2007

Hidden Village live this thursday 26/7

(poster by Lauren)


Lauren and i are playing a set at this thursdays Tyndall concert (26/7). De la catessen gallery, 9 anster street, adelaide. 8:30 PM onwards. $6 entry.

Saturday, July 21, 2007

NES controller to arduino

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!

I can't think of anything overly useful for this, apart from gutting mechanically defective NES controllers for their 4021 shift registers... but hey, I'm tired. I'm sure there is something cool that can be done with it.

Here is the pinout of the 4021:
P0 to P7 are the parallel digital inputs.
Latch is PL.
Clock is CP.
Serial Out is 07.

Anyway, here are the pinouts of the NES controller (lead plug on controller, not the socket on the console):
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:

bit 7 = A
bit 6 = B
bit 5 = select
bit 4 = start
bit 3 = up
bit 2 = down
bit 1 = left
bit 0 = right


[expand / collapse code]

Friday, July 20, 2007

SPI by hand

Introduction
Previously, i was not able to control more than one SPI (serial peripheral interface) integrated circuit from the Arduino successfully. I was using the in built SPI registers, functions and pins inherent to the Arduino. However, the SPI bus is actually very easy to control by directly manipulating any digital pins. My previous post regarding the control of a digital pot via a picaxe chip is an example of this.


What is SPI?

Well, I am not going to go into too much depth here. If you're into Arduino, chances are you already know (and can write the code more elegantly than me ;-). The wiki article has a bit of a info, i am sure there are heaps of websites out there. Basically, the protocol has at least three, if not four lines. These are:
• MISO (master in, slave out): data is sent from the controller to a slave IC
• MOSI (master out, slave in): data is sent from a slave IC to the controller
• SCK (spi clock): a clock signal is used to time bit-shifting, to ensure a smooth transfer of data
• CS (chip select): this line selects the slave IC, to which data can be written and read from

In theory, it should be possible for multiple slave IC's to share commone MISO, MOSI and SCK lines while each retains an individual CS line. Thus, individual slave IC's can be targeted for manipulation.


Bit Banging
By manipulating the digital outputs of the Arduino directly using code (as opposed to calling a slightly more macro function within the Arduino SPI library), it is possible to use any pins as MOSI, MISO, SCK lines, as well as multiple CS ones.

See the code below for more info. It is fully commented. Fun on a sleepless saturday morning.
/* SPI by Hand

by Sebastian Tomczak

20 July 2007

Adelaide, Australia

*/

/* 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

}

}

Thursday, July 19, 2007

SPI using picaxe


Tonight is the first time that i have successfully used the SPI protocol with a Picaxe chip (not on a 28X1 or a 40X1 that have it as part of their software library). To be honest, i hadn't tried before today - just didn't get around to it. But this is really a useful thing. In the example code below, i controlled the resistance of one of the pots on an MCP42100 IC.

The picture above shows outputs 0, 1 and 2 of the Picaxe 08-M being used as the CS (chip select), SCK (spi clock) and MOSI (master out, slave in) lines. There is no MISO (master in, slave out) line because the Picaxe chip can only write to the digital pot (as opposed to being able to read from it).

It really has been a productive evening. This would not have been possible without P. H. Anderson's page on using SPI with the Picaxe chips (a true master!). Thanks.

[expand / collapse code]

... a beginning

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.

The hour that i breadboarded, prototyped, coded and tested was well spent. The outcome was far more positive than i could have anticipated. This warrants further investigation.

The prospect of getting the Toriton away from the host computer system is something that has intrigued me for a long time. This is a beginning.

Tyndall 1, 2007 footage

http://www.youtube.com/watch?v=pZG1ID6JuTQ

Wednesday, July 18, 2007

Low bit manip


I woke up with this simple idea in my head. It seems to be such a simple idea, in fact, that i should have thought of this a while ago. But anyway. It revolves around manipulating the output lines of a 4040 counter that drive a resistor ladder. In the schematic, R1-5 are twice the value of R6-8 (preferably within the 100kΩ - 200kΩ range). The cap is 0.22uF and the pot is 2MΩ.

For the time being, i am using only four bits, corresponding to the clock input (bit 0, LSB), Q1 output (bit 1), Q2 (bit 2) and Q3 (bit 3, MSB). By manipulating which line is going into which part of the resistance network, various waveforms can be achieved quite easily. This technique is expandable to a higher bit depth. However, there is an intrinsic speed limit; the speed of the input clock signal for the 4040 must be doubled for each bit added to the network.



4 bit sawtooth. you can clearly see the 16 steps.


by inserting an inverter stage in every bit line,
the shape of the waveform is reversed.


bits 2 and 3 share the bit 2 line.


bit order reversal.


bits 0 and 2 are swapped.

Tuesday, July 17, 2007

"Songs of a Broken Heart"


"Songs of a Broken Heart"

direct line out. unedited.


8 stage sinewave approximation

Introduction
I have been looking around for a simple sinewave circuit that provides a sweepable frequency with a stable amplitude for little cost.

Analog circuits that offer a stable, easily sweepable frequency with a stable amplitude output appear to be relatively complex but not too expensive. An integrated circuit such as an XR2206 is quite expensive, costing between $6.50 and $14.00 depending on where you go (this is just for the chip).

Luckily, the sinewave i need doesn't actually have to be very sinusoidal at all. I just want it to have less prominent harmonics than, say, a square wave. Which brings me to a low-cost, very low-fi digital logic approach.


Low-fi Digital Approach
The concept is actually quite simple. By using a 4051 multiplexer, it is possible to generate custom waveforms with eight stages. By choosing the correct resistors for the voltage division
that feeds the eight channels on the 4051, it is possible to get a very compromised approximation of a sinewave. This technique would also rely on a 4040 binary counter or similar and a squarewave clock input for the counter. Below you can see an ideal representation of this situation of power supply voltage versus step.


Resistor Choice

The main issue is that real-world, locally available resistor only come in the E24 series as a maximum 'resolution' of resistance. What is the E24 series? Well, its pretty much a number series of 24 unique values between 10 and 100 in which resistors are available in various magnitudes. In other words, although it may be possible to get the resistance ratio (and thereby voltage output) of the eight voltage dividers close to the above diagram, it will not be possible to get those exact ratios.

Since the resistors that are available locally only have a maximum precision of 1%, the aim of balancing the resistance values is to be within this margin of error when compared to the 'ideal' values that should be used to produce the shape shown on the graph.

The following table shows the relationship between degrees, the sine function and the equivalent ratio for eight steps. It is then possible to reconcile the ratio value with a voltage value and also a resistance value. 112KΩ has been chosen to represent a resistance ratio of 1. Ra and Rb implies the following voltage divider circuit:

             Out
|
Vcc --- Rb ---| --- Ra --- Gnd


So, the choice for which resistors to choose becomes quite simple. No resistors are required for a ratio of 1 or a ratio of 0, because vcc or ground can be connected to the channels / steps in question. Which leaves only three values left to approximate - 560.00k, 955.98k and 164.02k

56 is in the E24 series, so 560kΩ is a real world value. Neither of the other two values are available, so they have to be approximated by putting two resistors in series. For 164.02k, a 120k plus a 43k are enough, producing a precision that is approx. -0.62% below the ideal value. For 955.98k, a 910k plus a 47k are enough, producing a precision that is approx. +0.11% above the ideal value.



Yep.

Results coming very soon. Like, tomorrow. Or even today. Although i am a bit sick : (

Sunday, July 15, 2007

Phone fun


After having had a nice night out last night, i decided to plug my phone synth into some cheap and nasty effects pedals and have a jam. I have made a slight update on the phone synth program - there are now octave change buttons (left and right keys). Check out this stuff in action here: http://www.youtube.com/watch?v=SzECOGeKWKo

You can download this version of the app here:
http://www.milkcrate.com.au/_other/downloads/mobile_phone_apps/live_instrument.zip

You will need a phone that is compatible with J2ME / Mobile Processing. You can find a list of some of the phones here: http://mobile.processing.org/phones/list.php

Here is the code for this app. To use the code, you will need to download Mobile Processing here (this is not required if you just want to run the app):
http://mobile.processing.org/download/index.php

You will also need a Wireless Toolkit (this is not required if you just want to run the app). For windows:
http://java.sun.com/products/sjwtoolkit/

For Mac OSX:
http://mpowerplayer.com/


/* 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;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;} }

Wednesday, July 11, 2007

Milkcrate 17: sea monster


The seventeenth milkcrate session took place from yesterday until this morning at 9:49 am. Check out the tracks on the session page here: http://milkcrate.com.au/sessions-details-017.html.

The restriction was that all source material had to be from handmade electronic devices.

Monday, July 09, 2007

Getting ready...

... for a milkcrate

Broken sword


Yes. It sounds very dramatic, doesn't it? This video features a circuit bent "space sword" which i bought from a discount variety store for AU$2. This was quite fun to do, even though the sword only has one button (and plays one of two sounds in alternation). The cool thing is that the LED lights up and flashes for each press of the button / sound event.

URL: http://www.youtube.com/watch?v=gO4frolFprU

Saturday, July 07, 2007

The life and times of dr fart


This video features a circuit bent Dr Fart, a novelty keyring that plays rude sounds.

Dr Fart is played in the first scene by Seb Tomczak and Lauren Sutter. In the second scene it is just Seb.

URL: http://www.youtube.com/watch?v=cayabhvRsm4

Cool swung triplet feel


Got home at 1.30 am last night and had a quick thought. So i breadboarded something that would give a somewhat interesting rhythmic feel.

Have a listen here.

Tuesday, July 03, 2007

Fun with sea moss

You can find some information about basic digital sound devices that i have been working on here: http://milkcrate.com.au/_other/sea-moss/.