Sign in to follow this  
Followers 0
tonedef

button presses = +/- keyboard transpose?

4 posts in this topic

Okay so I'm having a bit of trouble figuring out how to take the current keyboard range and on each successive press of a button, shift it down by one octave. It has to be relative, because I also want an increment button as well.

 

I'm assuming it'd be something like:

 

event_button id=1  kb_transpose= current_value + 12

event_button id=2  kb_transpose= current_value - 12

 

Sorry if this has been covered before, (I looked but maybe I didn't search for the right terms?).  Thanks for any help!

Share this post


Link to post
Share on other sites

Tonedef

 

I happened to read your August post.  

 

I can let you know how I achieved this if you need some ideas.  I use two membrane momentary switches. Transpose+ and Transpose-.

 

If you want to see the code let me know.

 

Robin

Share this post


Link to post
Share on other sites

Sorry I've not been on the forums in awhile, but yes! If you've got some code to share, I'd love to take a look. I've been trying to accomplish this via the NGC file, but haven't had much luck. I'm currently using the NG app which does everything else I need, just not the keyboard octave shifting... Thanks Robin!

Share this post


Link to post
Share on other sites

Here are a couple of ideas.

 

Most of my work concerns digital piano.

 

In addition to scanning the keys for switch changes . I scan 16 extra switches for changes.  You could use J5 to to the same.

 

I use a membrane momentary action switch.made by MEC with low bounce characteristics.

 

Here is some code for a 2 switch solution. This enables the user to to decrement and increment the value.  You will need to declare the transpose variable as a global variable.

 

//transpose buttons
	if(pin == 95 && pin_value == 0){//pin 95 is RH Transpose Button ie + Transpose (Higher Note)
	transpose = transpose +1;}	
	if(pin == 94 && pin_value == 0){//pin 94 is LH Transpose Button ie + Transpose (Lower Note)
	transpose = transpose -1;}	
	if(transpose > 9){ transpose = 9;}
	if(transpose < -9){transpose = -9;}

 

You need only one switch, but you can only advance

 

if(pin == 95 && pin_value == 0){//pin 95 is  Transpose Button 
	transpose = transpose +1;}
if(transpose > 9){ transpose = 0;}	

 

In the latter case pressing the button after 9 is reached, returns the variable to 0

 

 

Later in the program you will add the transpose value to the note number..

 

For octave shifts you will use multiples of 12 notes

 

 

 

Robin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0