Midi Controller for Alpha Juno 1


hi,

i plan rebuild old programmer (pg300) roland. programmer build alpha juno , send midi sysex alpha.
i wrote simple code had found in www.
i build simple midi in circuit .
the fowling code includes 3 analogin. 1 select midichannel , others control cutoff , resonance. code works.
thats first step of project , question: think code ok or can more simple?

the next question: arduino uno have 6 analogins need round 35 , more?
i have use multiplexer or there other way have more analogsins?


code: [select]
/**
* midi programmer
* 3 analog potis
*
* using code from:
* midi_cc_test.pde
* @author benjamin eckel
*/

#define inputs 2
#define e 1        // delta needed in
                  // currentpot[i] send message
                  
int currentpot[2] = {0,0};    
int pot[2] = {0,0};
//int channel[8] = {1,2,3,4,5,6,7,8};
int parameter = 0;
int midichan = 0;
int sensorreading = 0;


void setup() {


 serial.begin(31250);      // baud rate = 31250 midi
}                           //           = 38400 serial debug

void loop() {
 for(int i=0; i<inputs; i++) {
   currentpot[i] = analogread(i);
   currentpot[i] = map(currentpot[i],0,1023,0,127); //midi read 0-127
   // select midicc right input i
    parameter = i+16;
   midichan = analogread(a2); //read midi channel
   midichan = map(midichan,0,1023,0,15);
  
   // send midi protokoll
   if(abs(currentpot[i]-pot[i]) > 1) {
     sendsysex(midichan,parameter,currentpot[i]);
     pot[i] = currentpot[i];
   }
 }

}

//midi protokoll
void sendsysex(int chan, int par, int value) {
//ifdef
    //serial.println(value, dec);
//else
    serial.write(0xf0);         // sysex start
    //delay(1);
    serial.write(0x41);         // manufacturer 0
    //delay(1);
    serial.write(0x36);         // model 1
    //delay(1);
    serial.write(chan);      // midi channel
    //delay(1);
    serial.write(0x23);         // data
    //delay(1);
    serial.write(0x20);         // data
    //delay(1);
    serial.write(0x01);         // data
    //delay(1);
    serial.write(par);         // example cutoff synth
    //delay(1);
    serial.write(value);         // sensorvalue
    //delay(1);
    serial.write(0xf7);         // sysex end
    //delay(1);

  //serial.begin(9600);
  //serial.println(value, hex);
}

 

quote
i have use multiplexer
yes have use multiplexer.

quote
you think code ok
remove commented out delays , learn use functions make code easier follow.


Arduino Forum > Using Arduino > Audio > Midi Controller for Alpha Juno 1


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code