Go Down

Topic: distance sensor to midi cc (Read 837 times) previous topic - next topic

hi.. i have to traduce tension or current (from the out of a distance sensor) to a midi signal.
i have to control a program's parahm as a fader on ableton whit a distance sensor..
anyone can tell me how can i do this???

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

what is??? i don't know how to use arduino.. i need someone that can drive me step by step...or do it for me.. or someone that can tell me where to buy it...

AWOL

Up there on the left is a link called 'Main Site.
There you'll find a reference section explaining the 'map' function, and the rest of the Arduino language
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

ok.. I've read map.. but i don't find anywhere which signal receive the analog imput of arduino...

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

ok thanx a lot!! so.. now.. once i've mapped my signal to a value from 0 to 255 how can i convert it in a sequential 8 bit number(like the midi)??

AWOL

0..255 is an eight bit number
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

sure.. but.. i have to send that value to a midi instrument... like an ableton fader...

AWOL

#9
Oct 30, 2011, 10:01 pm Last Edit: Oct 30, 2011, 10:04 pm by AWOL Reason: 1
Did you look at any of the MIDI references over at the Playground?
http://arduino.cc/playground/Main/InterfacingWithHardware#Communication
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

i don't speech a good english so.. i didn't find anything about it...

#11
Oct 31, 2011, 04:09 am Last Edit: Oct 31, 2011, 08:38 am by AWOL Reason: 1
do you know if this code help me??



Code: [Select]
// by Tubedogg 12/2006; fabian at tubedogg.de

//This program reads up to 6 analog sensors / potentiometers ans converts the data to Midi-Controller messages
// define Switchpin:
#define switchPin 10
//  define LED:
#define LEDpin 13

// Variables

// define variables for the controller data
int AnalogValue[6] = {0,0,0,0,0,0};    

// define the "lastValue" variables
int lastAnalogValue[6] = {0,0,0,0,0,0};
 
// select the midi Controller Number for each input
int midiCCselect[6] = {1,2,3,4,5,6};

// select threshold for each analog input  
int thresh[6] = {1,1,1,1,1,1};  

// select number of desired analog inputs (max 6)
int input_no = 6;

void setup() {
//  set the states of the I/O pins:
pinMode(switchPin, INPUT);
pinMode(LEDpin, OUTPUT);
//  Set MIDI baud rate:
Serial.begin(31250);

}

// main program loop
void loop() {

for(int i=0;i<input_no;i++){

        AnalogValue[i] = (analogRead(i))/8;    // read the value from the analog input and divide by 8 for range 0-127
    // check if value is greater than defined threshold (good for resistive touchpads etc)
    if ( AnalogValue [i]>thresh[i] ) {
          // check if analog input has changed
          if ( AnalogValue[i] != lastAnalogValue[i] ) {

          //send control change on cc#i
          midiCC(0xB0, midiCCselect[i], AnalogValue[i]);
          // update lastAnalogValue variable
          lastAnalogValue[i] = AnalogValue[i];

          //End if
          }
      //End if
    }
 
 
//End for
}


//End Loop
}



// This function sends a Midi CC.
void midiCC(char CC_data, char c_num, char c_val){
Serial.print(CC_data, BYTE);
Serial.print(c_num, BYTE);
Serial.print(c_val, BYTE);

}



Moderator edit: Reposted, sans italics.


AWOL

Quote
do you know if this code help me??

Only you can answer that question.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

yan_g


do you know if this code help me??

it's well commented, seems like crystal clear code

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy