Help using Fluxamasynth to make music!

Hello All
I am using Arduino to make a real-time instrument. My sensors control the new FLUXAMASYNTH(its a MIDI synth). I am using an accelerometer and a hall effect sensor (to control speed). I want to be able to do a few things but Im very new to coding and to music and am just very very lost. ANY help anyone can offer would be really great!

I want my “speed” sensor to make the synth set the tempo (array of notes) ie if speed = 500 then play ArrayofBeats[1].

I am having trouble getting the function programChange() to work. its supposed to change the instrument or “voice” of the synth. When i call it and set it to a new instrument (ie flute = 74) it wont work.

Any coding ideas for making pretty music. let me know also!

Here is my code:

#include “Fluxamasynth.h”

#define hallPin 0
#define MIDIMODE //MIDIMODE OR DEBUGMODE
#define HALLTHRESHOLD 510

Fluxamasynth synth; // create a synth object to
// create all of the MIDI byte commands
int note=60; // C4 on keyboard
int bend=512; // midpoint of pitch bend range

const int X = 1; //X axis of accelerometer
const int Y = 2; // /Y axis
const int Z = 3; //Z axis

int yVal = 0;
int xVal = 0;
int zVal = 0;

unsigned long startWheelCycle, previousWheelCycle, wheelMillis;
int previousHallReading, hall;

void setup() {

#ifdef MIDIMODE

Serial.begin(31250); // use for sending midi MIDI baud rate:

synth.setMasterVolume(120); // max volume
synth.setChorus(0, 5, 127, 127, 127); // turn on Chorus effect
synth.programChange(0, 0, 74); // set instrument to
synth.pitchBendRange(0, 127); // set pitch bend to maximum range
//synth.noteOn(0, note, 64); // play C4

#endif

#ifdef DEBUGMODE
Serial.begin(38400); // use for debugging
#endif

pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A0, INPUT);
}

void loop() {

#ifdef MIDIMODE

int Xval = analogRead(X); //value of x-axis
int Yval = analogRead(Y); //value of y-axis
int Zval = analogRead(Z); //value of z-axis

//this is the part that plays notes right now//

synth.programChange(0, 0, 74); // set to flute
synth.noteOn(1 , random(1, 32)* 2, 45);
delay(100);
synth.noteOff(1, 60);
delay(100);
synth.noteOn(1, random (1, 32)*2, 45);
delay(100);
synth.noteOff(1, 5);
delay(100);
bend=analogRead(0);
synth.pitchBend(1, bend);
delay(200);

#endif

hall = analogRead(hallPin);

if (hall < HALLTHRESHOLD && previousHallReading > HALLTHRESHOLD) {
startWheelCycle = millis();
previousHallReading = hall;
delay(10);

//compute wheel speed in wheelMillis - lower if faster

wheelMillis = startWheelCycle - previousWheelCycle;
previousWheelCycle = startWheelCycle;

#ifdef DEBUGMODE // use for debugging
Serial.println(wheelMillis);
#endif

}

previousHallReading = analogRead(hallPin);

#ifdef DEBUGMODE // use for debugging
// Serial.println(hall);
#endif

}

Here is the library:

/*
Fluxamasynth.cpp
A library to facilitate playing music on the Modern Device Fluxamasynth board.
This software is in the public domain.
*/

#include “WProgram.h”
#include “Fluxamasynth.h”

Fluxamasynth::Fluxamasynth() {
}

void Fluxamasynth::noteOn(byte channel, byte pitch, byte velocity) {
byte command[3] = { 0x90 | (channel & 0x0f), pitch, velocity };
Serial.write(command, 3);
}

void Fluxamasynth::noteOff(byte channel, byte pitch) {
byte command[3] = { 0x80 | (channel & 0x0f), pitch, byte(0x00) };
Serial.write(command, 3);
}

void Fluxamasynth::programChange(byte bank, byte channel, byte v) {
// bank is either 0 or 127
byte command[3] = { 0xB0 | (channel & 0x0f), byte(0x00), bank };
Serial.write(command, 3);
Serial.write(0xc0 | (channel & 0x0f));
Serial.write(v);
}

void Fluxamasynth::pitchBend(byte channel, int v) {
// v is a value from 0 to 1023
// it is mapped to the full range 0 to 0x3fff
v = map(v, 0, 1023, 0, 0x3fff);
byte command[3] = { 0xe0 | (channel & 0x0f), byte(v & 0x00ef), byte(v >> 7) };
Serial.write(command, 3);
}

void Fluxamasynth::pitchBendRange(byte channel, byte v) {
// Also called pitch bend sensitivity
//BnH 65H 00H 64H 00H 06H vv
byte command[7] = {0xb0 | (channel & 0x0f), 0x65, 0x00, 0x64, 0x00, 0x06, (v & 0x7f)};
Serial.write(command, 7);
}

void Fluxamasynth::midiReset() {
Serial.write(0xff);
}

void Fluxamasynth::setChannelVolume(byte channel, byte level) {
byte command[3] = { (0xb0 | (channel & 0x0f)), 0x07, level };
Serial.write(command, 3);
}

void Fluxamasynth::setMasterVolume(byte level) {
//F0H 7FH 7FH 04H 01H 00H ll F7H
byte command[8] = { 0xf0, 0x7f, 0x7f, 0x04, 0x01, 0x00, (level & 0x7f), 0xf7 };
Serial.write(command, 8);
}

void Fluxamasynth::setReverb(byte channel, byte program, byte level, byte delayFeedback) {
// Program
// 0: Room1 1: Room2 2: Room3
// 3: Hall1 4: Hall2 5: Plate
// 6: Delay 7: Pan delay
Serial.write(0xb0 | (channel & 0x0f));
Serial.write(0x50);
Serial.write(program & 0x07);

// Set send level
Serial.write(0xb0 | (channel & 0x0f));
Serial.write(0x5b);
Serial.write(level & 0x7f);

if (delayFeedback > 0) {
//F0H 41H 00H 42H 12H 40H 01H 35H vv xx F7H
byte command[11] = { 0xf0, 0x41, byte(0x00), 0x42, 0x12, 0x40, 0x01, 0x35, (delayFeedback & 0x7f), 0xf7 };
Serial.write(command, 11);
}
}

void Fluxamasynth::setChorus(byte channel, byte program, byte level, byte feedback, byte chorusDelay) {
// Program
// 0: Chorus1 1: Chorus2 2: Chorus3
// 3: Chorus4 4: Feedback 5: Flanger
// 6: Short delay 7: FB delay
Serial.write(0xb0 | (channel & 0x0f));
Serial.write(0x51);
Serial.write(program & 0x07);

// Set send level
Serial.write(0xb0 | (channel & 0x0f));
Serial.write(0x5d);
Serial.write(level & 0x7f);

if (feedback > 0) {
//F0H 41H 00H 42H 12H 40H 01H 3BH vv xx F7H
byte command[11] = { 0xf0, 0x41, byte(0x00), 0x42, 0x12, 0x40, 0x01, 0x3B, (feedback & 0x7f), 0xf7 };
Serial.write(command, 11);
}

if (chorusDelay > 0) {
// F0H 41H 00H 42H 12H 40H 01H 3CH vv xx F7H
byte command[11] = { 0xf0, 0x41, byte(0x00), 0x42, 0x12, 0x40, 0x01, 0x3C, (chorusDelay & 0x7f), 0xf7 };
Serial.write(command, 11);
}
}

I'd start smaller. Were you able to change instruments when using the sample fluxamasynth sketch? If you can't get it to run like that I'd just post on moderndevice's forum. They're pretty responsive.