High-precision pitch offset command

Started by glowcoil, June 14, 2020, 18:34:10

Previous topic - Next topic

glowcoil

For the purposes of microtonal music, it would be nice to have a pitch-offset command, similar to EFx/EEx/FEx/FFx, but with two digits and precision of at least 1/100th of a semitone. Would it be feasible to add this to OpenMPT as a new effect and/or volume command?

Saga Musix

Sorry for the late reply. It's possible of course but any newly-added command should be well-debated (in particular to avoid commands with dodgy or inconsistent behaviour and to not needlessly reserve more command letters which we are already running out of).
So the first thing I would like to be answered is: In which scenario would the precision of EEx / FEx, which is a 64th of a semitone, not be enough? I get that the range of those commands is limited (only values 1/64 through 15/64 can be used) and needs to be extended, but apart from that, I don't see much of a problem. 1/64th of a semitone is already well beyond the resolution of human hearing, and I think for the sake of consistency with other effect commands it would make sense to let them share the same resolution base.

In fact, I think only one new command would be required for the purpose of microtonal tuning, which would kinda work like the Set Finetune (S2x) command: The command would be centered around parameter 80h (no deviation) and values 00h...7Fh would decrease the finetune from that, 81h...FFh would increase it. The exact meaning needs to be agreed upon, it could be either 64th of a semitone like EEx/FEx, so allowing a deviation of up to +/-2 semitones, or it could be in 128th of a semitone to allow a deviation of up to +/-1 semitone, which may be more useful and would be consistent with your wish to have at least 1/100th of a semitone of precision.

It also needs to be defined how the new command works with and without custom tunings: Would it always be expressed in cents in the classic sense (with 1200 cents per octave), or should it rather depend on the distance between two notes of the custom tuning? Would that be useful or more distracting?
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

glowcoil

#2
I think that a command centered around 80h, with a precision of 1/128 of a semitone and a range of +/-1 semitone would be absolutely perfect. As for custom tunings, I think it would definitely be preferable for offsets to use the same range and precision regardless of tuning.

To answer your first question, it's true that human hearing is only accurate to about 1/10 of a cent in a melodic or sequential context, but human pitch resolution is much finer in a harmonic or simultaneous context, due to both virtual pitch (harmonicity) and roughness (beating).

Harbinger

Personally I can see some interesting flanging effects with samples by being able to shift the frequency slowly or per tick. I'd love to see it!

Saga Musix

#4
I'm getting the command ready to be commited (for OpenMPT 1.30), and so far it's working nicely.
I'm still a bit torn with regards to the resolution, though. Of course using 128th of a semitone plays nicely with the hexadecimal nature of the pattern notation, so that e.g. a parameter of 0x40 is half a semitone. But would it maybe be easier to use actual cent values? They don't translate nicely to hex (e.g. E4 would be +1 semitone), but they are much easier to transfer from real-world scale definitions, which may outweigh the niceness of hexadecial magic constants. What do you think? You probably have a better idea how you would like to use this feature.
Currently I'm leaning more towards using cents.

BTW, all of this is always in the sense of a semitone/cents of a 12TET scale, even when using custom tunings.

Edit: We could also make this command even more precise using the #xx parameter extension: A second command would be put in the following row to define a 16-bit instead of 8-bit value, making the effective resolution a 256th of a cent. Do you think it's worth implementing that?
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Saga Musix

#5
Thinking one step further... This command should also work with plugins. This can of course be achieved by translating the cents to MIDI pitch wheel commands.
But for a while now I though that it would be great to have a pattern command that would essentially directly translate to MIDI pitch wheel commands (so that you can directly record them from MIDI and don't have to set up Zxx MIDI macros yourself). So what if we combine this fine-tuning command and MIDI pitch bend command into one new command? Their functionality is pretty much the same. The command should work identically for plugins and samples, so its effective pitch depth would depend on the pitch wheel depth configured in instrument settings (in sample mode, we would assume +/-1). So if you set up a sample-based instrument with a pitch wheel depth of 1, you would get exactly what was previously proposed with 1/128th of a semitone. If you set up a pitch wheel depth of 2, the resolution would be reduced to 1/64th of a semitone but with a wider pitch range (and when using #xx command extensions, there would be 8 more bits of precision of course).
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

glowcoil

I prefer 128th-semitones personally, since it gives a bit more accuracy and less redundancy/overlap and matches the rest of OpenMPT a bit better. I don't consider the ability to use known cent values for intervals to be that big of an advantage, since (like you said) you have to convert them to hex anyway, whereas being able to use 0x40 for a half-semitone sounds very nice to me.

I like the idea of this command also serving as a MIDI pitch bend command a lot! On the topic of pitch bend ranges, I think it would be good to keep in mind the recently adopted MPE (Midi Polyphonic Expression) standard, which specifies a default (but still configurable) pitch bend range of 48 semitones (not sure if/when it would make sense to implement MPE support in OpenMPT, but it seems to be the way a lot of tuning-focused sequencers and synthesizers are going). I think the approach you outlined where the command's range spans the entire pitch bend range would still work fine, but it might be worth making it further configurable so that the command can span a fraction of the pitch bend range instead of always spanning the entire thing. In any case, the idea seems good to me!

Saga Musix

I am monitoring the MPE standard but I currently don't have any devices that support it. I'd like to support it eventually because it finally makes MIDI a lot more tracker-like.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Saga Musix

OpenMPT 1.30.00.32 (soon available from https://builds.openmpt.org/builds/) implements a first version of this finetune command. In fact, there are two new commands:

  • +xx immediately sets the finetune
  • *xx slides to the new finetune value (intended for MIDI pitch wheel)
As outlined above, the commands work for both plugins and samples and span the instrument's entire pitch wheel depth (for sample mode, it's fixed to +/-1 semitone). The center of the command is +80 / *80, and it can be extended using parameter extension commands to higher precision, like so:
ModPlug Tracker MPT
|        +80
|        #03

The second command is essentially a fractional extension to the first command, so you can read it as 80.03 (in hex). As a result, you can still achieve good precision even with a high pitch-wheel depth.

The new commands should be mapped to = and Shift+= on US keyboards (+ and Shift++ on a German keyboard) by default, but can be reconfigured like all other non-letter commands in the keyboard config.

I've attached a module demonstrating the various possibilities. It should be said that until OpenMPT 1.30 is officially released, the exact behaviour of the command is not set in stone yet and may be tweaked according to the feedback in this thread.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Saga Musix

Previous builds didn't apply the finetune commands to OPL voices. This is now fixed as of r14608.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.