Go Down

Topic: Get velocity from Pressure Sensor (Read 38 times) previous topic - next topic

Hi guys! What's up?!

I really need your help because I'm freaking out on this point!

My goal is: to get the pressure of a Force Sensitive Resitor (Pressure Sensor) and use it as velocity for a MIDI note.

I already did this:

 thumblval = analogRead(thumb);
     if(thumbval>50)
     {
         
         if(a==0){
         noteOn(0x90,int(43),127);
          a=1;
         }
     }
     else{
         if(a==1){
         noteOn(0x90,int(43),0);
         a=0;
         }
     } 

*43 is the note, >50 is the lowest value limit, 127 and 0 are the two velocity that I associated to have the NoteOn - NoteOff effect.

This code works perfectly but as you can see the velocity in output is always 127. Every other test i did gives some problems like: continuous triggers of the note or something like that.

I just need to associate to one note one velocity value and the input should stop only when I stop pushing (with the velocity being steady during that time).

I hope I was clear enough and I say thanks in advance to everybody out there!

Ciao!


DVDdoug

#1
Feb 28, 2015, 05:05 pm Last Edit: Feb 28, 2015, 05:08 pm by DVDdoug
Try replacing 127 with thumbval:

code
Code: [Select]

noteOn(0x90,int(43),thumbval);


And one more thing.  After reading thumbval, constrain it to 127 or less:
Code: [Select]

if thumbval > 127
   thumbval =127;


.... I'm not 100% sure that will work, but it might help.


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