Author Topic: High-precision pitch offset command  (Read 1147 times)

Offline glowcoil

  • Shy artist
  • Posts: 3
High-precision pitch offset command
« on: June 14, 2020, 18:34:10 »
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?

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,173
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: High-precision pitch offset command
« Reply #1 on: June 17, 2020, 20:28:12 »
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.

Offline glowcoil

  • Shy artist
  • Posts: 3
Re: High-precision pitch offset command
« Reply #2 on: June 21, 2020, 21:07:36 »
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).
« Last Edit: June 21, 2020, 21:15:56 by glowcoil »

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,146
  • Gender: Male
  • Operating System: Windows XP
Re: High-precision pitch offset command
« Reply #3 on: July 22, 2020, 10:24:29 »
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!

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,173
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: High-precision pitch offset command
« Reply #4 on: January 24, 2021, 00:21:00 »
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?
« Last Edit: January 24, 2021, 00:34:44 by Saga Musix »
» 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.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,173
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: High-precision pitch offset command
« Reply #5 on: January 24, 2021, 12:02:03 »
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).
« Last Edit: January 24, 2021, 15:22:47 by Saga Musix »
» 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.

Offline glowcoil

  • Shy artist
  • Posts: 3
Re: High-precision pitch offset command
« Reply #6 on: February 03, 2021, 20:47:30 »
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!

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,173
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: High-precision pitch offset command
« Reply #7 on: February 07, 2021, 16:05:34 »
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.