Author Topic: Enharmonic Notation  (Read 6712 times)

Offline pathovore

  • Active artist
  • *
  • Posts: 11
Enharmonic Notation
« on: July 29, 2008, 11:56:17 »
I personally would love to have enharmonic notation supported in modplug.

What I mean is, a keycommand to toggle sharps to flats...

...say you hit ctrl+f12... now when you go to press a sharp it shows up as a flat... C# becomes Db... It doesn't change what's already on the tracks, just what you input via keyjazz while "flat mode" is toggled on.

By only supporting sharps you are essentially throwing out half of the major/minor scales. It's kind of ridiculous, and I try my best to pretend that this is just the norm and it's selfish to ask it to change. However, if I want a song that modulates down I generally have to pick one that starts at around A major or E major or higher. I can't pick C because then I have to start mentally remapping all the sharps into flats and that extra layer of mental work is truly exhausting. Forget using Eb Major. It's too much mental work =)

If this feature was implemented, I would be incredibly happy.

Thanks =)
pv

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 707
Re: Enharmonic Notation
« Reply #1 on: July 29, 2008, 19:57:19 »
While this might not be a big task to implement, you might already be able to achieve this with the experimental tuning dialog(available since .46 in MPTM format). Just copy the 12TET tuning for example to local tuning and change the note names from C# to Db etc. (note though that the tuning dialog is certainly not a masterpiece of GUI creation, so it might not be as easy as it sounds; feel free to ask if you can't get it working). After the tuning is defined, just select all instruments to use it and pattern should show C#_ notes as Db_ and so on. Yes, not very convenient compared to having simpe 'flat mode', but the difference is that this exists while 'flat mode' doesn't.

Offline pathovore

  • Active artist
  • *
  • Posts: 11
Re: Enharmonic Notation
« Reply #2 on: July 29, 2008, 23:11:40 »
Hey Relabsoluness:  

I have one tuning file in the /tuning dir, and that's std_tunings.tc.

I'm having a little trouble.  I did find the tuning dialog on the instruments panel.  So, I created a new instrument, clicked on "control tuning"...

everything is greyed about, appears to be in read-only mode.

I tried exporting the file and then opening up that one, too, and it's greyed as well... can't think of any immediate ideas that'll remove the read-only flag...

thanks,
pv

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,197
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Enharmonic Notation
« Reply #3 on: July 30, 2008, 00:18:26 »
i think you have to convert your module to MPTm format first. on the general tab, click "song properties" to do 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.

Offline pathovore

  • Active artist
  • *
  • Posts: 11
Re: Enharmonic Notation
« Reply #4 on: July 30, 2008, 04:24:40 »
Hi Jojo,

In the post above, i started with an empty mptm song.  So, we're on the same page about that...

http://img515.imageshack.us/img515/4664/lockedsp9.png

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 707
Re: Enharmonic Notation
« Reply #5 on: July 30, 2008, 20:11:09 »
Sorry, I forgot the limitation in displaying the note names in the pattern due to which Db and other with letter b won't be shown correctly in the pattern because letter b is not there in the bitmap where it reads the letters(usable letters are upper case alphabets A-Z, digits 0-9 and the following characters: ? # \ : space and - ).  This approach is getting a bit too cumbersome, but some people have reported been able to modify bitmaps in the executable with certain tool, which might be a solution. I've never used it myself, though, so I don't know about that.

While it might matter little anymore, what comes to the tuning dialog, with mouse, drop and drop the "TET12" under the "standard tunings" on top of "local tunings" item and you should get a menu with "copy here" option. For the copied item you can clear the read only flag and modify the notenames. Modifying notes from C-5 to B-5 modifies note names on other octaves as well.

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,136
  • Gender: Male
  • Operating System: Windows XP
Re: Enharmonic Notation
« Reply #6 on: July 31, 2008, 06:28:08 »
I often use the mptm format (for what reason i don't know), but if i can get flats instead of sharps (my favorite key is Db), i'll try using the tuning settings. I don't mind using 6 or \ as the symbol for the flat.

I'll let you what i discover, too...

Offline pathovore

  • Active artist
  • *
  • Posts: 11
Re: Enharmonic Notation
« Reply #7 on: August 01, 2008, 06:59:43 »
Well, I got it set up for an octave to test it out....
Can't say it's quite what I'd hoped for...  

The Tet12 font seems to be slightly different than the OMPT IT behavior tuning setting.  I wouldn't think that this would be the case but I can clearly see on my monitor that the Tet12 font is scrunched together and slightly truncated.

Setting it to B or / or 6 or whatever just looks like a garbled mess :-)

I appreciate the suggestions and am actually am happy to use this "hack" but what I'd still really like to see is a clean implementation of flats using a toggle mode...

Harbinger: if your favorite key is Db you're pretty lucky as that maps onto C# with pretty darn well... Lacking E# and B# though...

Yeah.

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 707
Re: Enharmonic Notation
« Reply #8 on: August 01, 2008, 20:59:49 »
Thanks for the feedback; some improvement is indeed needed.

Offline Sam_Zen

  • Extreme artist
  • *****
  • Posts: 3,689
    • http://www.xs4all.nl/~samzen/
Re: Enharmonic Notation
« Reply #9 on: August 02, 2008, 02:07:52 »
I'm not into this much, because I use other concepts.
But lets not forget that this well-tempered division of a 12 key tone scale is a compromise.
According to the laws of physics Db is another frequency than C#.
0.618033988

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,136
  • Gender: Male
  • Operating System: Windows XP
Re: Enharmonic Notation
« Reply #10 on: August 04, 2008, 06:43:44 »
After some experimenting with creating a standard tuning with different labels, so we can get something of a flat-key system, as opposed to the omnipresent sharps, i came up with something that might work. I only tried this in the .mptm format, and it worked okay.

1. Set up a new .mptm track file, or convert another to the same.
2. You must use an instrument to set up non-standard tunings, so if you're starting with a new file, create a new instrument (it doesn't have to have an associated sample).
3. In the far right hand side of the instrument panel, click the Tuning Menu and select "Control tunings...". A dialog box will appear with many fields. On the left is a list of tuning files, most of which i don't understand. I do know that "Unnamed" is a copy of OMPT's default standard tuning table.
4. The object here is to take a standard tuning file (we're not tinkering with the actual acoustics) and create new labels. So select the Unnamed standard file and, if you like, rename it in the Name field. I renamed mine "D-flat scale".
5. Select one of the notes at the right labeled A:1 or so. Each of these are actual labels as the code sees it. I found that A:-7 is C4. Relabel any note name by clicking in the notename field at the bottom.
6. LPChip was right -- there are limited characters you can use for your label, and 'b' isn't one of them. Altho they will appear fine in the note menus, they will not contain the right characters in the note data columns, where you need to see it. So until the devs change the bitmap, i use the \ character to represent the flat symbol. When renaming the notes, remember to assign the right octave, such as C 4, D\4, D 5, etc. Also, to line up the octave column, put a space or period between the natural note tone and the octave number, such as "C-4".
7. When you're all done, use the EXPORT button to save this tuning.
8. Make sure you've selected the correct tuning in the Tuning menu (whatever you named it), but keep in mind that you have to select this tuning FOR EVERY INSTRUMENT -- it's not a global setting. This also means that every note played that's not triggering an instrument will revert to the default tuning (OMPT's sharps).

As a side note, i couldn't get the Save button to work in the Tuning dialog box, but the Import/Export buttons worked fine.
Also, there is a glitch in the A:5 label, which will cause all unnamed notes to use this label ("A:5") and any additional characters after the 5. Kinda hard to explain, but you'll see it once you begin relabeling the notes.

...
After further experimentation, while this worked great when VSTi's use the track, actual sample acoustics must be calculated when using samples, or all the notes will play the same tone. If i remember correctly, you have to set the Step(?) number to a strange number like 1.041 or so (square root of 2?). I played a scale in the pattern editor while i fixed the acoustics and this worked out the correct tones...more experimentation forthcoming....

Offline bvanoudtshoorn

  • Extreme artist
  • *****
  • Posts: 1,053
  • Gender: Male
    • Barryvan
Re: Enharmonic Notation
« Reply #11 on: August 04, 2008, 07:53:33 »
For an equally tempered scale, you need to use the following algorithm:

frequency = fundamental * (2 ^ (i / degrees))

where:

frequency :: the frequency of the note you want.
fundamental :: the fundamental frequency (A4 = 440Hz as a standard)
i :: the number of steps above / below the fundamental for the note you're after.
degrees :: the number of steps in your scale (Western tradition has 12)

Now, some background. In *all* tuning models, octaves are integral multiples apart. That is, A-4 = 2*A-3, and A-4 = 2*2*A-2. With an equally tempered scale, we just divide the rest of the scale into suitably-sized "chunks" between these frequencies.

So if we want to find A-5 with A-4 == 440Hz, we get

frequency = 440 * (2 ^ (12 / 12)) = 880Hz.

To find E-5 (7 semitones above), we get

frequency = 440 * (2 ^ (7 / 12)) ~= 659.255Hz.



For those who have Matlab or GNU Octave, here's a very simple function that will do all of this for you.
Code: [Select]
function x = getETPitch(varargin)
x = 0;
if ((nargin < 2) | (nargin > 3))
usage ("getETPitch(fundamental, semitones) ; getETPitch(fundamental, semitones, degrees)");
end
if (nargin == 2)
degrees = 12;
else
degrees = varargin{3};
end
if (isnumeric(varargin{1}) & isscalar(varargin{1}) & isnumeric(varargin{2}) & isscalar(varargin{2}))
x = varargin{1} * (2.0 ^ (varargin{2} / degrees));
else
error("getETPitch: Expecting scalar numeric arguments");
end
end



Or, if you prefer Java, this one will return an array, rather than a single item:
Code: [Select]
/**
 * Calculates the frequencies of an equal temperament scale based around the given fundamental.
 * @param fundamental The frequency around which to base the scale
 * @param stepsBelow The number of steps to calculate below the given fundamental
 * @param stepsAbove The number of steps to calculate above the given fundamental
 * @param degrees The number of degrees in the scale
 * @return An array of doubles which are the frequencies of the calculated scale.
 */
public static double[] getETLookupTable(double fundamental, int stepsBelow, int stepsAbove, int degrees) {
double[] toReturn = new double[stepsBelow + stepsAbove + 1];
for (int i = -stepsBelow; i <= stepsAbove; i++) {
toReturn[stepsBelow + i] = fundamental * (Math.pow(2, ((double) i / degrees)));
}
return toReturn;
}


I threw these together very quickly for a small part of my Honours project. :)

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 707
Re: Enharmonic Notation
« Reply #12 on: August 04, 2008, 21:16:19 »
Quote from: "Harbinger"
I do know that "Unnamed" is a copy of OMPT's default standard tuning table.

Not quite. There should be file std_tunings.tc located at tunings/standard relative to the executable file. If you have this file, there should be tuning item with name "12TET [[fs15 1.17.02.49]]"; if you do not have the file, the unnamed item appears. The file can be  downloaded from here.

Quote from: "bvanoudtshoorn"
For an equally tempered scale, you need to use the following algorithm:

frequency = fundamental * (2 ^ (i / degrees))

In the tuning dialog terminology(*), degrees == groupsize, 2 == groupratio, i == 'running index' in the note table(default centre note(i==0) is A:5). The finetune steps define the behavior of portamento effects.


* The terminology is completely invented without knowledge of the correct terminology. Please spread your knowledge if you know the 'correct' terms for these, if such exists.

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,136
  • Gender: Male
  • Operating System: Windows XP
Re: Enharmonic Notation
« Reply #13 on: August 13, 2008, 05:51:53 »
Quote from: "Relabsoluness"
Quote from: "Harbinger"
I do know that "Unnamed" is a copy of OMPT's default standard tuning table.

Not quite. There should be file std_tunings.tc located at tunings/standard relative to the executable file. If you have this file, there should be tuning item with name "12TET [[fs15 1.17.02.49]]".


Good to know! However, i did not see this file (or maybe i never noticed it). Does it need to be there if you're not tinkering with alternate tunings?

Thanks for the help, bvan! I did notice that when i put in what i thought was the square root of 2 in one of the fields, the tones seemed to calculate themselves in the note list.

I'm loving my new Db system. I'm using the backslash to represent the flat symbol, and i got used to it quickly. Now if i could only get my tuning to be used globally.... :?

Offline LPChip

  • Administrator
  • *****
  • Posts: 4,949
    • http://lpchip.nl
  • Operating System: Windows 7 (x64bit)
Re: Enharmonic Notation
« Reply #14 on: August 13, 2008, 07:33:19 »
The first thing you'd do to start that, is atleast share it. :D If enough interest in it, we could possibly put it on sourceforge or even include it in the package.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs