Friday, September 30, 2011

SEGA Master System Control Pad as USB Joystick for Emulated Games


This is a Teensy-based USB converter for using a SEGA Master System control pad with an emulator. See in the Setup() function below for the hardware configuration. I used a male 9 pin cable for the converter so that I didn't have to splice an actual SEGA control pad cable.

The converter takes button presses from the control pad and sends them to the computer as keyboard presses and releases. W is up, S is down, A is left, D is right, J is button 1 and K is button 2. Simply setup the emulator of your choice with these keyboard buttons.
byte button_1;
byte button_1_previous;
byte button_2;
byte button_2_previous;
byte button_3;
byte button_3_previous;
byte button_4;
byte button_4_previous;
byte button_5;
byte button_5_previous;
byte button_6;
byte button_6_previous;

void setup() {
pinMode(0, INPUT); // up direction = SEGA joystick pin 1
pinMode(1, INPUT); // down direction = SEGA joystick pin 2
pinMode(2, INPUT); // left direction = SEGA joystick pin 3
pinMode(3, INPUT); // right direction = SEGA joystick pin 4
pinMode(4, INPUT); // button 1 = SEGA joystick pin 6
pinMode(5, INPUT); // button 2 = SEGA joystick pin 9
// also connect Teensy ground to joystick pin 8
digitalWrite(0, HIGH); // turn the pullup resistor on
digitalWrite(1, HIGH); // turn the pullup resistor on
digitalWrite(2, HIGH); // turn the pullup resistor on
digitalWrite(3, HIGH); // turn the pullup resistor on
digitalWrite(4, HIGH); // turn the pullup resistor on
digitalWrite(5, HIGH); // turn the pullup resistor on
}

void loop() {
button_1 = digitalRead(0);
if(button_1 != button_1_previous) {
button_1_previous = button_1;
if(button_1 == 0) {
Keyboard.set_key1(KEY_W);
}
else {
Keyboard.set_key1(0);
}
}
button_2 = digitalRead(1);
if(button_2 != button_2_previous) {
button_2_previous = button_2;
if(button_2 == 0) {
Keyboard.set_key2(KEY_S);
}
else {
Keyboard.set_key2(0);
}
}
button_3 = digitalRead(2);
if(button_3 != button_3_previous) {
button_3_previous = button_3;
if(button_3 == 0) {
Keyboard.set_key3(KEY_A);
}
else {
Keyboard.set_key3(0);
}
}
button_4 = digitalRead(3);
if(button_4 != button_4_previous) {
button_4_previous = button_4;
if(button_4 == 0) {
Keyboard.set_key4(KEY_D);
}
else {
Keyboard.set_key4(0);
}
}
button_5 = digitalRead(4);
if(button_5 != button_5_previous) {
button_5_previous = button_5;
if(button_5 == 0) {
Keyboard.set_key5(KEY_J);
}
else {
Keyboard.set_key5(0);
}
}
button_6 = digitalRead(5);
if(button_6 != button_6_previous) {
button_6_previous = button_6;
if(button_6 == 0) {
Keyboard.set_key6(KEY_K);
}
else {
Keyboard.set_key6(0);
}
}
Keyboard.send_now();
}










Wednesday, September 28, 2011

Do A Heaps PhD Graduation





How To Make A USB Beeper


Overview
This USB Beeper adds a MIDI-accessible piezo beeper transducer to any modern PC without the need for archaic hardware or virtual emulation. Create 1-bit music melodies using a real beeper speaker for that authentic sound. I strongly encourage individuals to customise this code or write their own from scratch.


Example Video




Usage
The USB Beeper driver included in this post provides for two channels. Data sent to MIDI channel 1 will play notes back using a simple square wave. Data sent to MIDI channel 2 will generate noisy sounds useful for percussion.



Hardware
You will need a piezo buzzer audio transducer and a Teensy 2.0 board. Simply solder digital pin 0 of the Teensy board to the red wire of the buzzer. Solder ground of the Teensy board to the black wire of the buzzer.


Software
Install Teensyduino.

Replace Arduino > Contents > Resources > Java > hardware > teensy > cores > usb_midi > usb_api.cpp with http://milkcrate.com.au/_other/downloads/projects/usb_buzzer/usb_api.cpp

Replace Arduino > Contents > Resources > Java > hardware > teensy > cores > usb_midi > usb_api.h with http://milkcrate.com.au/_other/downloads/projects/usb_buzzer/usb_api.h

This will add high resolution pitch bends to the MIDI read functionality of the Teensyduino (at the time of writing).


Teensyduino Code
// Teensyduino MIDI Out Example - Receive Note On and Off
// by Sebastian Tomczak
// 1 September 2011

/*

Functionality:
* The piezo transducer responds to MIDI note messages received via USB by playing a tone


Hardware Setup:
* USB connection from Teensy board to host computer
* Connect the red wire of the piezo transducer to

*/

#include "math.h"
#include <avr/pgmspace.h>

float frequency;
float bend_amount = 0;
float current_pitch = 0;
byte play_flag = 0;
float delay_time;

float note_A = 440.0;

int sample_flag = 0;
int sample_counter;
int sample_speed = 4;
int sample_previous = 0;

long voice_1_previous;


void setup() {
usbMIDI.setHandleNoteOn(noteon);
usbMIDI.setHandleNoteOff(noteoff);
usbMIDI.setHandlePitchChange(PitchChange);
usbMIDI.setHandleControlChange(controlchange);
pinMode(0, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
}

void loop() {
usbMIDI.read();
play();
sample();
}

void noteon(byte channel, byte note, byte velocity) {
if(channel == 0) {
if(velocity > 0) {
digitalWrite(11, 1);
frequency = note_A * pow(2, (float(note) - 69.0 + bend_amount) / 12.0);
delay_time = 500000 / frequency;
current_pitch = note;
play_flag = 1;
}
else {
digitalWrite(11, 0);
play_flag = 0;
}
}

if(channel == 1) {
if(velocity > 0) {
sample_flag = 1;
sample_speed = 128 - note;
play_flag = 0;
}

else {
sample_flag = 0;
}
}
}

void noteoff(byte channel, byte note, byte velocity) {
if(channel == 0) {
digitalWrite(11, 0);
play_flag = 0;
}

if(channel == 1) {
sample_flag = 0;
}
}

void PitchChange(byte channel, unsigned int bend) {
if(channel == 0) {
bend_amount = (bend / 682.625) - 12;
if(play_flag == 1) {
frequency = note_A * pow(2.00, (current_pitch - 69.0 + bend_amount) / 12.0);
delay_time = 500000.0 / frequency;
}

}
}

void play() {
if(play_flag == 1 && sample_flag == 0) {
PORTB = 1;
delayMicroseconds(delay_time);
PORTB = 0;
delayMicroseconds(delay_time);
}

}

void sample() {
if(sample_flag == 1) {
if(sample_counter < sample_speed) {
sample_counter ++;
}
if(sample_counter >= sample_speed) {
digitalWrite(0, random(2));
sample_counter = 0;
}
}

}

void controlchange(byte controller, byte value, byte channel) {
if(controller == 70) {
PORTB = value & 1;
}
}

Tuesday, September 27, 2011

WiiMote Gesture Looper Max/MSP Patch

Download
Max patch: http://milkcrate.com.au/_other/downloads/max_patches/gesture_looper/GestureLooper.maxpat

OSCulator mapping: http://milkcrate.com.au/_other/downloads/max_patches/gesture_looper/wii_setup.oscd



Usage

+ Launch OSCulator
+ Synchronise the WiiMote to OSCulator
+ Setup mapping in OSCulator as below
+ Go to View > Parameters > I/O Tab > Select Active MIDI Outputs > OSCulator Out
+ Launch the Max/MSP patch
+ Set the MIDI Input device to OSCulator Out
+ Set the MIDI Output device to whichever destination you would prefer
+ Set the tempo in the transport section
+ Press the toggle in the transport section to activate the looper
+ The four phrases / loops represent: pitch, roll, yaw, accel of the WiiMote
+ Each toggle next to each phrase activates / deactivates that particular parameter
+ Pitch is mapped to the selected MIDI output along MIDI CC #1 on channel 1
+ Roll is mapped to the selected MIDI output along MIDI CC #2 on channel 1
+ Yaw is mapped to the selected MIDI output along MIDI CC #3 on channel 1
+ Accel is mapped to the selected MIDI output along MIDI CC #4 on channel 1
+ Hold down the B button on the WiiMote to turn recording on.
+ When recording, data will be recorded into each parameter loop
+ Release the B button on the WiiMote to turn playback on.
+ When playing back, data will be streamed from each parameter to the selected MIDI output




OSCulator Setup


Monday, September 26, 2011

WiiMote Gesture Looper



The B button on the Wii remote records gesture data into a 2-bar phrase. Otherwise, whatever data is in the phrase is automatically played back and looped continuously. This data can then be used to control various parameters - in this case, filter frequency, resonance, delay times, bit crushing, compression, waveform etc.




This Is The Storm You Call Progress (Feat. Rosa Menkman) (Live)



Audio by little-scale. Video by Rosa Menkman.

Instrumentation: Ableton Live, Max/MSP, Launchpad, iPhone, Nanoloop for iPhone

Featuring "Most Likely You Go Your Way (And I'll Go Into the Tulgey Woods)" video by Rosa Menkman: http://vimeo.com/26156391 - used with permission.

Title of this work is taken from: "Nova Roja Movies / Rosa Menkman - Collapse of PAL 2010-2011" http://vimeo.com/25410265

More details about Rosa and her inspiring work can be found here: http://rosa-menkman.blogspot.com/

Inspired by the complex rhythms of Aphex Twin and the luscious sonic textures of Autechre, This Is The Storm You Call Progress combines localised field recordings and exasperated audio compression artefacts with smart phone music production. Although the work begins softly and gently, algorithmically-generated rhythms eventually underpin simple melodic and harmonic lines, whilst being engulfed in a thick envelope of ambient sound. As with some of the works in the current Saatchi exhibition, this piece touches upon issues of medium versus outcome.The (normally unwanted) sonic entities brought about by audio file compression formats are emphasised, extrapolated, extracted and processed. Incidental rhythms formed within these extractions are used and integrated into the work. Structurally, the performance consists of a mirrored form, growing from a single point to a large peak, and then subsiding over the course of the second half.

The video elements have been created by the glitch visualist Rosa Menkman, whose artistic work explores creative uses of video compression artefacts in performance and exhibition contexts. The visuals presented in this performance exploit playback failures within the aging Cinepak video codec. These failures are used to produce an outcome that deviates greatly from an input video source signal.

Sunday, September 25, 2011

Christian Haines Has A Dot Com


My colleague and friend Christian Haines has a new website up at christianhaines.com. Check back often, as I am sure that content will be both interesting and inspirational for many people that like this blog.

Wednesday, September 21, 2011

Blip Festival Australia Announced for February 2012!


Tuesday, September 20, 2011

Dot.AY's Laser Gameboys 2.0 (Now With VGA Hacking)



More information here.

Sunday, September 18, 2011

Saatchi Exhibition: Psychedelic Rays of Sound Concert: 25 September

When: 25 September, 3PM
Where: Radford Auditorium, Gallery of South Australia, Adelaide
Cost: Free with your Saatchi exhibition ticket or $10 at the door


Inspired by the Saatchi Gallery in Adelaide, some of Adelaide’s leading composers and performers of contemporary music have combined forces to present this concert inspired by recent British art and music.

Those much-admired champions of new music, the Zephyr String Quartet, are joined by Stephen Whittington, Luke Harrald, Christian Haines, Seb Tomczak, Al Thumm and Jamie Seyfang to premiere new works combining instrumental and electronic sounds with video projections – like the music of Brian Eno, Aphex Twin and Autechre, but with a distinctly Adelaide twist.

Using everything from classic analogue synths to mobile phones and Wii controller, the music ranges from ambient to electronica and drum and bass. From Stephen Whittington’s wistful Music for Airport Furniture to Luke Harrald’s controversial You Can Change The World By Shopping, it is guaranteed to be both entertaining and thought-provoking.

Saturday, September 17, 2011

A Cut and Paste Summary of Dynasties 1 & 2 (W D U W S T S Rework)


E.N. Cowell aka We Danced Until We Saw The Sun has reworked one of my PAUSE releases "Dynasty". Listen to the WDUWSTS remix over here.

Wednesday, September 14, 2011

Glitched Badges by hellocatfood


My hellocatfood badges arrived. Yay!

Monday, September 12, 2011

Game Gear Display Failure



The display on one of my SEGA Game Gears has failed. Somewhat ironically, the sound output is still OK with this unit.

Friday, September 09, 2011

Beeper Recorded with a Neumann U87A Microphone



USB Beeper recorded with a Neumann U87A microphone. 192 KHz / 24 bit, downsampled and converted to 44.1 KHz / 16 bit.

Monday, September 05, 2011

USB Beeper: Now With Heatshrink


Photos of the Port River



Sunday, September 04, 2011

Final Cut Pro X as Audio Glitcher



A Teensy board is programmed to be a "mouse". One switch moves the mouse to the right. The other switch moves the mouse to the left. The potentiometer sets the speed of the mouse movement. This "mouse' is then used to scrub audio in Final Cut Pro X.

Audio Rendering of Kindergarten Songs from 1968



A friend was asking for help transcribing a number of songs that were written for kindergarten-aged children in 1968. The aim was to have rendered audio of the sheet music.

Saturday, September 03, 2011

MIDI with Teensy: Light Controlled Pitch Bends




Hardware
:



Software:
int current_analog;

int previous_analog;

int current_button;
int previous_button;

void setup() {
pinMode(0, INPUT);
digitalWrite(0, HIGH);
pinMode(11, OUTPUT);
}

void loop() {
current_analog = analogRead(0);
if(current_analog != previous_analog) {
usbMIDI.sendPitchBend(current_analog << 4, 1);
previous_analog = current_analog;
delay(1);
}


current_button = digitalRead(0);
if(current_button != previous_button) {
usbMIDI.sendNoteOn(60, 127 * (! current_button), 1);
delay(5);
previous_button = current_button;
}
}

Teensyduino MIDI Clock Sync Updated with DIN 24 Sync Support

My Teensy-based Game Boy sync (more information here) has been updated with support for DIN sync 24. Additionally, the code has been cleaned up a little bit to make it slightly more readable.

- Pin 2 is the sync 24 pulse output, at 24 pulses per quarter note and with a duty cycle of 3 milliseconds (regardless of the BPM)
- Pin 3 is the sync 24 stop / start pin, which outputs 5V when playing and 0V when stopped

Source code is here (for those wanting to edit).
HEX file is here (for those wanting to upload to Teensy straight away).

Thursday, September 01, 2011

USB Beeper: A Hardware Plugin for Software Music