Piano Pedal Behavior
- 
 Hi everyone! Have a samplers in my piano project which have pedal down and up samples. I use midimuters and my script looks like (I put it into my pedal up and down samplers): function onController() { if (Synth.isSustainPedalDown() == true) { muteup.setAttribute(0, 1); } if (Synth.isSustainPedalDown() == false) { muteup.setAttribute(0, 1); Synth.playNote(0, 100); } }Pedal up and down samples are working just fine with my sustain pedal. But the problem is now this script reacts to all others midi controller knobs :) For example I can touch my Pitch Bend - and while I use it - pedal down and up samples are sounds too etc. How can I change this script to react only on sustain pedal? Thank you! 
- 
 Add an if statement to check if the cc number is 64 
- 
 @d-healey should it looks like this? if (CCNumber == 64) { if "my code" }
- 
 @nouslou Yes and just for better coding style, This: if (Synth.isSustainPedalDown() == true) { // blabla } if (Synth.isSustainPedalDown() == false) { // blabla }is equal to this: if (Synth.isSustainPedalDown()) { } else { }In fact, it's not even equal because in your case both statements or evaluated when it is necessary to do it only once 
- 
 @nouslou Yup 
- 
 @d-healey Somehow it doesn't work:  I mean if I write if (CCNumber == 64)Even pedal samples stop to work. Am I blind somewhere? :) 
- 
 if (CCNumber == 64)Where is CCNumber coming from? to "read" a CCNumber you need to use: Message.getControllerNumber()-- its in the API documentation, you may also need: Message.getControllerValue()at some point.... so your code should read if (Message.getControllerNumber() == 64)
- 
 @lindon now I got it! 
- 
 



