Author Topic: Handling Rotary Encoders for Program Changes  (Read 9199 times)

Offline ikatsuke

  • Newbie
  • *
  • Posts: 10
Handling Rotary Encoders for Program Changes
« on: September 27, 2014, 09:20:49 AM »
Hi, I got a question when handling rotary encoders. I am currently using an app on my iPad called TouchOSC. Quite handy for creating custom controls and what not. But I can't seem to setup the rotary encoders properly to do what I want.

Objective:

Setup an rotary encoders (endless knob as opposed to a simple knob that has min and max values) to select which Patch is currently selected.

Things I have tried that work, sort of:

- Setup Encoder to manage volume with Inc and Dec Values in AZC
- Setup Slider/Knob to send PC MIDI messages in TouchOSC

So here are a few questions (hopefully am not missing something from another post and asking again, sorry ^^):

- Can we take a MIDI signal from controller, modify it, and let it through to Sonar?
- Can we "select" a control in a Console Strip? Say the volume. If you click on it with the mouse 4 white frame corners appear, that's what I mean by "select". Focus may be another word for it
- Can we fake a MIDI signal to Sonar?
- Can we just outright control the Patch control from the Console Strip of a MIDI track?

Do you have any alternative suggestions?

Hope is not too much bother. Thanks in advance for any help :D

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1578
Re: Handling Rotary Encoders for Program Changes
« Reply #1 on: September 27, 2014, 12:53:09 PM »
Hi, I got a question when handling rotary encoders. I am currently using an app on my iPad called TouchOSC. Quite handy for creating custom controls and what not. But I can't seem to setup the rotary encoders properly to do what I want.

Objective:

Setup an rotary encoders (endless knob as opposed to a simple knob that has min and max values) to select which Patch is currently selected.
I have started to look at endless knobs recently (Novation Nocturn and Android TouchDAW). Support for such knobs will be added in the next version of AZC. ACT MIDI support it, Generic Surface not really.

Quote
Things I have tried that work, sort of:

- Setup Encoder to manage volume with Inc and Dec Values in AZC
- Setup Slider/Knob to send PC MIDI messages in TouchOSC
Inc/Dec in AZC was thought for buttons...

PC messages work  for me (on A-500S, it has PC encoder which sends direct PC value).

Quote
So here are a few questions (hopefully am not missing something from another post and asking again, sorry ^^):

- Can we take a MIDI signal from controller, modify it, and let it through to Sonar?
No with plug-in. At least not documented (no such CS API call). I guess CS plug-ins are implemented as "MIDI Track AUX", you receive messages but you can not send something back. But that can be done either before SONAR (with something like MidiOX) or on the track (there are free MIDI changing "fx" plug-ins).

Quote
- Can we "select" a control in a Console Strip? Say the volume. If you click on it with the mouse 4 white frame corners appear, that's what I mean by "select". Focus may be another word for it
I have not managed that. We can select/focus strip, FX or synth. But not parameters inside.

Quote
- Can we fake a MIDI signal to Sonar?
As I wrote, CS API has no such calls.

Quote
- Can we just outright control the Patch control from the Console Strip of a MIDI track?
Yes! (first positive answer...). Marked to be implemented  :)

So, endless encoder support with MIDI track Patch action should do the trick. Most probably I manage to do that during the first half of the next week (the weekend is busy). Thanks for suggestion.
« Last Edit: September 27, 2014, 01:56:02 PM by azslow3 »

Offline ikatsuke

  • Newbie
  • *
  • Posts: 10
Re: Handling Rotary Encoders for Program Changes
« Reply #2 on: September 27, 2014, 08:58:56 PM »
kk looking forward to it :D

You are probably aware of this already but just in the odd case you are not. On the subject of Inc/Dec being designed for Buttons I'd like to mention that Encoders are like buttons:

Reg knob: when turned slowly increases from 0 to 127, 1 value at the time. (1,2,3...)
Encoder knob: when turned clockwise reports 127, when turned counter-clockwise reports 0. It never reports anything in between
Button: when pressed reports 127, when released reports 0. It never reports anything in between

So to me at least Encoders behave more like buttons than knobs.

Excuse my potential lack of knowledge, I am very new to MIDI, Controllers, and such. I'm looking at it from a programming perspective lol.

In any case, thanks for all your work. I really appreciate it!

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1578
Re: Handling Rotary Encoders for Program Changes
« Reply #3 on: September 28, 2014, 12:41:42 AM »
You are probably aware of this already but just in the odd case you are not. On the subject of Inc/Dec being designed for Buttons I'd like to mention that Encoders are like buttons:

Reg knob: when turned slowly increases from 0 to 127, 1 value at the time. (1,2,3...)
Encoder knob: when turned clockwise reports 127, when turned counter-clockwise reports 0. It never reports anything in between
Button: when pressed reports 127, when released reports 0. It never reports anything in between

So to me at least Encoders behave more like buttons than knobs.
I have not seen such endless encoders... There is no standard for them.
But in case you have such, you can configure them in the current version:
  • Specify type as "Button" and put "Note: ON" condition for "Inc" and "Note: OFF" condition for "Dec"
  • If you prefer to keep them called "Rotaries", use "Value:0" for "Dec" and "Value:127" for "Inc"

Endless encoders I know are different (VPots on Mackie Control and compatible devices, encoders on Novation): the use values under 64 for clockwise movements and values from 65 for counterclockwise movements. When you turn something fast, it can not send MIDI on each "tick" and send "increase by X" or "decrease by Y" instead.

Quote
Excuse my potential lack of knowledge, I am very new to MIDI, Controllers, and such. I'm looking at it from a programming perspective lol.
We are not born with all knowledge "preinstalled"  :) I recommend www.midi.org, the table of messages is free. The standard itself is rather expensive, but you can deduct near everything (keyboard/control surface related) from the table. In case you are going to work with other MIDI equipment (hardware synth and such), the standard has its value.

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1578
Re: Handling Rotary Encoders for Program Changes
« Reply #4 on: September 29, 2014, 06:09:29 PM »
Bad news... Patch change does not work as I have expected. It works only once, when you start "Play" from the beginning and there is some MIDI clip there. In case it is modified, to make any effect, the track should be played from the beginning again.

In addition, setting it such way produce some sounds (!) the first time you start play.

Assuming that is not what you have expected, there is no reason to implement it.

So, the only way to apply "Program change" in live mode or recording is to actually inject "Program change" command into the MIDI stream. CS plug-ins can not inject MIDI data. Game over...  :(

Well, there are still several ways to solve the problem:
  • Convince your Apple send Program Change  :)
  • Use MIDI-OX to convert CC XX YY to PC YY. I have not tested it, but Google say that is possible. Obviously you should configure the control to produce normal CC (0..127), not endless mode.
  • Find MFX plug-in to do the job. There are many MFXes, but I have not found the correct one in 10 minutes.
  • In case (3) is found, and it has exported parameter to inject PC... AZC can modify that parameter as the reaction on some control  ;)

You can also try to write MFX plugin yourself. SDK is open and in case your have VS, it should work our of the box. I have plans to play with that, but not in predictable future (my approach requires convertation of IDL into C and developing "fake sonar" with required interfaces for testing).

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1578
Re: Handling Rotary Encoders for Program Changes
« Reply #5 on: September 29, 2014, 08:11:23 PM »
Test release with Endless Encoders support is in Download area.

Obviously without Program Changes (since make no sense for me).

Offline ikatsuke

  • Newbie
  • *
  • Posts: 10
Re: Handling Rotary Encoders for Program Changes
« Reply #6 on: October 03, 2014, 05:09:28 AM »
Giving it a try! Ty!

Offline ikatsuke

  • Newbie
  • *
  • Posts: 10
Re: Handling Rotary Encoders for Program Changes
« Reply #7 on: October 03, 2014, 06:15:49 AM »
Reported a couple of findings about endless here: http://www.azslow.com/index.php/topic,126.0.html

I am sad that it is not easy to control the Patch of a MIDI track. I have managed already to make a slider in my Custom controller to send PC signals, but as you say it is limited to 0 to 127 and definitely does not work with my endless controllers (that are unable to send the incremental values of 0....127, and only send either ON/OFF).

The main idea was similar to having an "instrument selection wheel" every tick of the wheel would change the instrument you can play with the controller. This is kinda cool but not absolutely required. I can probably work around it. Its useful for finding the right patch while being in the creative process of landing on what kinda sound you are aiming for in the song :) I guess I can't be lazy and will have to use my mouse for that ugh lol. Thanks for your efforts on the matter ^^.

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1578
Re: Handling Rotary Encoders for Program Changes
« Reply #8 on: October 03, 2014, 08:14:21 PM »
0-127 are the only values PC can have. Other message is "Bank Change".

But not all synts understand PC, and even less "Bank Change".

There is no Inc/Dec PC (standard) message. Some software/hardware interpret different commands to do this (it they support such changes).