Jump to content

button presses = +/- keyboard transpose?


tonedef
 Share

Recommended Posts

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!

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

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!

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...