Software 001

With the help of Luke, who kindly coded this first sound experience. I am now working on finding the algorithms that will trigger the sound. The initial code here:

#include <Fluxamasynth.h> // this is some bullshit library

Fluxamasynth synth; // this is the synth

// this is some melody:
int notes[16] = {60, 62, 67, 68,
63, 58, 67, 60,
72, 70, 65, 75,
72, 62, 67, 65};

// these are the counter variables for which note in the melody
int i1 = 0;
int i2 = 7;

int chan1 = 0; // MIDI channel for first sound
int chan2 = 1; // MIDI channel for second sound

// sound list here:
// http://www.midi.org/techspecs/gm1sound.php

int prog1 = 49; // program change for first sound
int prog2 = 80; // program change for second sound

int mastervol = 255;

void setup() {

// tell the synth what to do:
synth.setMasterVolume(mastervol); // how loud?

// set the sounds you’re gonna use:
synth.programChange(0, chan1, prog1);
synth.programChange(0, chan2, prog2);

// make up some reverb shit
synth.setReverb(chan1, 7, 127, 64);
synth.setReverb(chan2, 4, 127, 0);
synth.setReverb(9, 0, 90, 0); // drums
}

void loop()
{
// how fast?
int a = analogRead(A0); // read the pot
int soundSpeed = map(a, 0, 1023, 20, 1000); // map it to a millisecond value

// note ON
synth.noteOn(chan1, notes[i1], random(60, 100));
synth.noteOn(chan2, notes[i2], random(60,100));
if(i1%4==0) synth.noteOn(9, 36, 80); // kick drum

delay(soundSpeed); // wait

// note OFF
synth.noteOn(chan1, notes[i1], 0); // Be sure to turn the note off!
synth.noteOn(chan2, notes[i2], 0); // Be sure to turn the note off!
if(i1%4==0) synth.noteOn(9, 36, 0); // kick drum

// go to next note in loop
i1 = (i1 + 1) % 16;
i2 = (i2 + 1) % 15;
}