Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust pitch bend sensitiity #1025

Closed
sjc-or opened this issue Aug 14, 2019 · 25 comments
Closed

Adjust pitch bend sensitiity #1025

sjc-or opened this issue Aug 14, 2019 · 25 comments
Labels
MIDI MIDI support related

Comments

@sjc-or
Copy link

sjc-or commented Aug 14, 2019

Is your feature request related to a problem? Please describe.
Pitch bend has two ranges, standard and extended. Adjusting a CC in either range doesn't give very good sensitivity. Just a few knob movements moves the slider too far. I'm trying to use it for microtuning (quarter tone) user scales.

Describe the solution you'd like
Normal mode is -7 to +7. I would like to be able to adjust to -1 +1. This will allow more CC sensitivity adjustment. The idea is to send CC# right before a given note on a user scale. If the synth supports micro tuning via MIDI SysEx standard, this may not be needed, however I have not tested to see if I can do that.

Describe alternatives you've considered
Having custom user scales in the plugin might be a good alternative. This would be used for Arabic quarter tone music.

Additional context
Add any other context or screenshots about the feature request here.

@baconpaul
Copy link
Collaborator

Hi @sjc-or - we have custom user scales in the nightly version of the synth right now. Issue #828 details it. Our plan is to support arbitrary .scl files. Then if you choose, say, a 23 note quarter tone scale you will get the increased sensitivity. We do not support via midi syses. You load a .scl file into your session. (Right now that .scl file doesn't get saved in your session; that was the issue I was going to literally now when I saw your issue)

But also: You can scale a controller by rather than mapping the controller to pitch, map the controller to one of the control modulators, then map that control modulator to a much smaller shift. So your knob sends CC #41 or whatever, that modulates the box next to the LFOs, and then you have that route to pitch in whatever amplitude you want (and also you can choose to make it bipolar or unipolar).

Hope those help.

@baconpaul
Copy link
Collaborator

Oh also: If you are a user of custom scales and would like to try the nightly I would love to hear feedback on our current .scl file implementation! (With again that caveat that it doesn't save the scale right now - that will be in the nightlies next week sometime)

@sjc-or
Copy link
Author

sjc-or commented Aug 14, 2019

Thanks Paul!

Right now I think I can get the precision I need by scaling my MIDI CC, Also if I can figure out how to get pitch bend parameter to change, then I might just use that instead of MIDI CC. Pitch bend range is 16384 instead of CC of 128 increments. For some reason changing pitch bend from 48 to anything else does not seem to have any affect. Also most other plugins will more likely respond to pitch bend so I should be able to make my solution more generic across other VST's. Too bad moset VST's do not support the MIDI tuning standard. This could be really important for musicians in the Middle East the regularly use quarter tone tuning.

Steve

@baconpaul
Copy link
Collaborator

Are you accidentally in MPE mode? If so you might get that 48 behavior. Pitch bend is mapped with full fidelity into the synth though in my tests, just with the MPE remapping in MPE mode. Also curious: Are you AU VST2 or VST3?

The hard part of the tuning change to the synth was changing the internal tables, and that's already done through the .scl file remapping. The MTS spec seems like a sort of more clumsy wire format version of .scl tuning (more clumsy in that it only allows float cent increments as opposed to proper ratios; basically it is an integer-or-float version of the octave spec). What MIDI protocol are you using? From looking at the doc (which I attached here so I don't have to keep resetting my midi association password :) ) are you sending the tuning per note (so F) 7E 7F 08 07 etc...) or are you sending the sysex in some other format?

midituning.pdf

@sjc-or
Copy link
Author

sjc-or commented Aug 15, 2019

VST2 Scale/Octave tuning 1-byte real time. The reason I want to do it with MIDI is that I want to be able to have users with fairly dumb MIDI keyboards do Micro tuning using Bome MIDI Translator Pro as the brains to convert simple MIDI messages into more complex tuning Sysex messages. Right now I've had some success using pitch bend but not with the tuning accuracy I want. -.5 to -.9 cents.

@sjc-or
Copy link
Author

sjc-or commented Aug 15, 2019

You can see a short demo of what I've done so far here

https://youtu.be/Svw63J6cV6I

@baconpaul
Copy link
Collaborator

Thanks

It is definitely my goal to have Surge support tuning properly over time. The 1.6.2 release this fall will at least support .scl file retuning. The same code may be able to support MTS.

What would be super useful is: send the midi stream you are sending to a synth that works along with the audio it produces. Like the whole thing (tuning messages, pitch bends, the works). Can you save as a standard midi file the instructions you are using? I don't have a way to generate them.

@baconpaul baconpaul added the MIDI MIDI support related label Aug 15, 2019
@sjc-or
Copy link
Author

sjc-or commented Aug 15, 2019

Yes, I just have to find a synth that support MTS. The only thing now that I have been able to find to do this is Korg and they use their own custom Sysex standard. It might take a while but when I find one, I will certainly send to you!

Thanks!

Steve

@baconpaul
Copy link
Collaborator

Ok! If I have a working example it’s probably straight forward to implement

But again you can load an scl file now so if you are happy with that format you may already be ok!

@sjc-or
Copy link
Author

sjc-or commented Aug 15, 2019

I have MPE Mode disabled but changing pitch bend parameters doesn't seem to ever have any effect. Also, in Ableton Live, sometimes I cannot get the plugin window to display and I end up having to unload and re-load it on the track to get it to come back up.

@sjc-or
Copy link
Author

sjc-or commented Aug 15, 2019

I figured out how to display the plugin again without unloading it.

@baconpaul
Copy link
Collaborator

Good

Which pitch bend parameters are you adjusting?

Again a midi file of your session with the expected outcome would help.

But the most robust tuning method we have today is using an scl file then sending midi notes!

@sjc-or
Copy link
Author

sjc-or commented Aug 16, 2019

Well there are two pitch controllers in the synth. I'm using the one on the right using midi CC learn to CC#2. Without CC I can use pitch bend lever with no knobs with MIDI learn but again, the menu for pitch bend sensitivity (which is set to default of 24) doesn't seem to have any effect.
Pitch bend I'm sending in that mode is MIDI E0 HH LL where HH is MSB and LL is LSB.
If I was able to adjust sensitivity to only maybe 2, I could probably get a lot of microtuning accuracy since pitch bend can handle 16384 steps instead of 128 steams of a CC.

@sjc-or
Copy link
Author

sjc-or commented Aug 16, 2019

No matter how I set pitch bend sensitivity, it seems to only move up or down 2 semitones.

I'll look into using that since that actually might be what I want but I though you should know that changing it doesn't seem to adjust anything.

@baconpaul
Copy link
Collaborator

Ahh I see. Sorry for being a bit behind but how are you adjusting it?

@baconpaul
Copy link
Collaborator

Oh I see you answered that above ok

Will share thoughts in am but the sensitivity in the Moe menu only works in mpe mode which is how you get independent scaled bends per note which is what you are emulating. But now I see what you are saying I think what you really want is scl file timing not faking it up with pitch bend.

Happy to make sure the synth does what you want of course! Sorry for the back and forth

@baconpaul
Copy link
Collaborator

Alright so let give a more comprehensive explanation about how things work now. Sorry if you know some of this.

First the midi pitchbend is as you say +/- 8192 and is per channel, not per note. The standard application of this is a +/- 2 note bend in surge. But the MPE protocol hijacks pitch bend to mean sweeps, since MPE is a midi protocol where each note gets a separate channel.

So this means if you are not in MPE mode, then pitchbend is applied as a single modulator once as a value between -1 and 1 and then interpreted; and if you are in mpe mode then pitchbend is scaled by the pitchbendrange (which you calibrate to match your device) so you can get full keyboard sweeps and stuff.

void SurgeSynthesizer::pitchBend(char channel, int value)

there's the code that does that.

So the first thing is using pitchbend to simulate rescaled tuning will require MPE mode at least if you are polyphonic.

But back to monophonic world. So now that pitchbend is multiplied by the range of the scene in the voice. (Surge works in note space internally until very late). So if bend > 0 it is multiplied by range up or range down if < 0. These are parameters which are ignored in MPE mode but used in non MPE mode. Default value is 2. But - and this seem like a bug - that default value at least in the AU in logic pro seems to be off by 2. More on that in a second. But when you set the pitch bend range in the UI you are basically changing that integer multiplier.

The bug I see is if I set them to 0, in logic in the AU, I still get +/- 2. But if I set them to 11, I get +/- 13 or what not. So the control works but some "extra" pitch bend is coming from somewhere. I will fix that as part of this issue.

But I don't think this is how you want to engineer tuning to be honest, unless you split into an MPE mode. So let me explain what we did.

Internally surge has a table of note -> frequency which is set up as 440 * pow ( 2, (note-69)/12) as standard. The entire synth then works internally in note space. So apply an LFO to pitch and you get +/- LFO in note, then at OSC render time you look up in the table.

What we did with .scl file tuning in the nightly was keep the synth internal architecture the same but modify those tables.

So if you put in place a 23 note SCL file the note 60 is middle c, but note 84 is not 2 octaves above but one octave above (assuming octave wrapped sci files). I think this is what you want and it works today!

Hope this helps.

@baconpaul
Copy link
Collaborator

OK I just took a look at this and my report if things being off-by-two was because I had my surge in MPE mode!

With MPE mode disabled, the pitch bend sensitivity controls do indeed adjust the pitch bend sensitivity. They are capped at integers but work.

And in non-mpe mode if I set the pitch bend integers to 0 and then modulate using pitchbend I can make the range of the wheel arbitrarily small on oscillator pitch (and even different on two different pitches or any other feature of the synth).

@sjc-or
Copy link
Author

sjc-or commented Aug 16, 2019

OK, since I have to do everything in MIDI (since the only control of the application will be through MIDI keyboard and processed MIDI messages through my application), I will use Non MPE pitch bend an .I should be able to control the tuning of any given note in mono mode. What I'm doing is creating a table of value adjustments for the scale I want in my MIDI application and then sending pitch bend message immediately before sending a given MIDI note message. I have 12 values (one per note). So I can sharp or flat any note just prior to sending it based on my user defined scale). This should allow people with a standard MIDI keyboard to tune the synth for user defined quarter tone messages for Arabic scale).

Thanks for the detailed explanation!

Steve

@baconpaul
Copy link
Collaborator

Yeah I sure I think. You also have to deal with far-away-from-center notes though. So if 60 is your center note and you go to quarter steps, note 20 needs to move by 20 notes - way outside your pitchbend range. Happy for you to proceed that wan and I don't think we need to change the synth for you to do so, but that's a hard way to do it.

What's the constraint that stops you from using the built in scl mechanism? It does exactly what you are trying to do.

@sjc-or
Copy link
Author

sjc-or commented Aug 16, 2019

The constraint is that it needs to be user adjustable by MIDI messages only.

@baconpaul
Copy link
Collaborator

Gotcha. Out of curiosity: What drives that constraint in your use case? Not one we normally see in virtual synth land.

@sjc-or
Copy link
Author

sjc-or commented Aug 16, 2019

Don't know for sure but my client says he wants it all done in MIDI and that his client may not even be aware of the underlying synth application. May or may not be Surge. May or may not even be a virtual Synth. Only thing we know is that it will all need to be done with MIDI.

@baconpaul
Copy link
Collaborator

Ahh right well there you go then!

But is there anything you need changed in surge now? The path you laid out should work and the pitch bend stuff all seems to be working properly and be routable either with the default or custom routings. If not, I'll close this issue if that's OK.

@sjc-or
Copy link
Author

sjc-or commented Aug 16, 2019

I think I will be OK for now. Will use pitch bend default in Mono mode and I believe with that I will get the precision I need. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MIDI MIDI support related
Projects
None yet
Development

No branches or pull requests

2 participants