hello, i am looking to make a fork of openmpt but i dunno my way around lol

Started by kfaraday, January 05, 2020, 20:07:38

Previous topic - Next topic

kfaraday

my "idea" for openmpt is to make it possible to enter any frequency as a note instead of just "C-5" "C-6" etc. so for example, "460hz" or "963 cents" or something like that. i'm not sure how to do this or what files depend on what and what i would need to change to make working music in this way (lol)

eventually, i'd like there to be a way to freely define scales of pitches in the pattern window that can be changed on the fly, but i'm not sure what files i would need to change for that to work either. i hope this makes sense lol!!! thank you for reading, i hope somebody can help me here

- keffie

Rakib

Just write the number you want in the samples window.


Alternative you can change tuning behavior here.



^^

manx

OpenMPT (and any other tracker-style DAW for that matter) pretty much relies on a fixed note scale in order to properly be able to perform portamento effects in any meaningful manner.
Also, all tracker formats (including MPTM) store pattern data in a pretty simplistic way, explicitly only allocating a single byte for the note value.
OpenMPT also supports completely custom tuning scales already in MPTM format, see https://wiki.openmpt.org/Manual:_Tuning_Properties . What are you trying to achieve here that is not already possible?

Saga Musix

kfaraday is well-aware of custom tunings; I pointed them to the forums because they wanted to hack OpenMPT beyond what's already possible (as described in the initial post).

It's possible of course to create such a fork, but it will be 1) a lot of work and 2) even more work if you want to keep existing playback working as it is.
That being said, if you wanted to hack in custom notes that are based on a frequency rather than a note number, here's roughly what you would have to do (I probably forget a lot of things here):

1. Extend the ModCommand struct (defined in ModCommand.h) to support this new note format. For example you could turn the note column from an 8-bit member into a 16-bit or 32-bit member to be able to store Cents or Hertz in addition to the existing note values (which are in the range 0...255). You'd probably have to move special notes (NOTE_MIN_SPECIAL and above) to the end of the note range as there are some checks in the code which assume that anything below NOTE_MIN_SPECIAL is a note and anything above is some sort of note-off event. Alternatively, define a new note type like NOTE_CENTS or so and put the actual cents value in a separate uint16 member of ModCommand. Both approaches require different amounts of effort in different places, I cannot tell you what would be less work.
2. Extend the playback engine to deal with those new notes. Most importantly, CSoundFile::GetPeriodFromNote and CSoundFile::GetFreqFromPeriod in Snd_fx.cpp have to be adjusted to deal with this. Once notes have been translated into periods, portamento and such can deal with them without any issues.
3. You somehow need to store this in files. Probably the best way is to extend MPTM's mechanism for store PC events (pattern.cpp: CreateDiffMask, WriteData, ReadData).
4. Last but not least, pattern drawing (Draw_pat.cpp, somewhat messy) and pattern editing (View_pat.cpp, less messy) need to be able to handle your new note type and being able to enter arbitrary numbers into the note column (similar to the instrument column).

As said, this is not going to be trivial to implement (and I'm afraid you cannot count on us helping you with that, there are a lot more important construction sites in OpenMPT). This kind of stuff would also most definitely have to stay in a fork, it's just too far detached from what OpenMPT aims to be and just complicates maintenance. In the end, maybe it would make more sense to discuss how working with custom tunings can be made more streamlined and less cumbersome. For example, by making the tuning editor more accessible in its own editor tab rather than being hidden in a dialog that has to be activated from the instrument editor. You still wouldn't be able to directly enter pitches into the editor, but maybe it would be a step in the right direction.
» 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.