# The MIDI Forum

## Resolved The Midi Tuning Standard

0
Undo
1. Karim
2. MIDI Specifications
3. Friday, 14 September 2018
Hi and thanks for accepting me on this valuable forum.

I am developing a program to send a micro-tonal midi system exclusive and I found a message that is part of the midi specification.

This is the msg:

F0 7F id 08 02 tt ll [kk xx yy zz]x(ll) F7

Is there a detailed documentation that I can download to understand at least the xx yy zz

I found it a little confusing without having the proper documentations to get the proper calculation. I want to be able to adjust the number of the notes between +63 cents to -64 cents.

I appreciate any help to get the proper calculation for the xx yy zz.

Best
Kelfar
Comment
0
Undo
Also, I just noticed, on the page The Complete MIDI 1.0 Detailed Specification, scroll down to the section "MIDI 1.0 Specification Addenda [after 1996]" and look at the PDF file "MIDI Tuning (Updated Specification)". There are some messages for "Scale/Octave Tuning 1-Byte Form" that use values from decimal 0 to 127 that are in units of 1-cent steps from -64 cents to +63 cents.
Comment
1. more than a month ago
2. MIDI Specifications
Responses (9)
0
Undo
Just to make sure you and everyone else reading this is aware, the official MIDI Tuning Standard description is part of The Complete MIDI 1.0 Detailed Specification PDF document. See PDF page 79.

Here are some notes about the xx yy zz values.

The xx value is the starting MIDI note number (decimal 0 to 127, hex 00 to 7F) you want to use in A440 twelve-tone equal temperament. Middle C is decimal 60, hex 3C. A440 is decimal 69, hex 45.

The yy zz value represents a fractional amount you add to raise the starting note.
The smallest yy zz value of hex 00 00 represents the original note with no raise.
The largest yy zz value of hex 7F 7F is 1 step below the next note.
There are 2^14 = 16384 steps between notes.

Note: The maximum xx yy zz value of hex 7F 7F 7F is reserved to mean "no change", so for xx note hex 7F the highest you can use for yy zz is hex 7F 7E.

To convert a cents value into a yy zz value, you can use this process:

Divide by 100. You now have a value in semitones from 0 to +.99993896484375.
Multiply by 16384. You now have a value in steps from 0 to +16383.
Round to the nearest whole number.
Divide by 128.
Write down the part before the decimal point. This is the decimal value for yy.
Subtract the part before the decimal point leaving just the fractional part after the decimal point.
Multiply by 128.
This is the decimal value for zz.
(Convert the decimal values to hex if you need hex values.)

You can only use positive cents values to raise notes. So if you want to lower a note, change the xx value to the next lower note, and change the cents value to 100 minus the amount you want to lower by.

Examples:

Middle C + 63 cents is the xx yy zz value of hex 3C 50 52.
Middle C - 64 cents is the xx yy zz value of hex 3B 2E 0A.
Comment
1. more than a month ago
2. MIDI Specifications
3. # 1
0
Undo
Thanks for your detailed reply. I assume that the same formula works for the 2bytes octave /scale. I appreciate if there is a documentation in regards to the correct calculation.
Comment
1. more than a month ago
2. MIDI Specifications
3. # 2
0
Undo
I assume that the same formula works for the 2bytes octave /scale.

No, the ss tt values in the "Scale/Octave Tuning 2-Byte Form" are different from the xx yy values in the "key-based" forms.

Comparison:

xx yy: Value 0 represents 0 cents. The step between each value is 100/16384 cents.
ss tt: Value 0 represents -100 cents. The step between each value is 200/16384 cents.

xx yy: Values 0 to 16383 represent 0 to +99.993896484375 cents.
ss tt: Values 0 to 16383 represent -100 to +99.987792968750 cents.

To convert a cents value into an ss tt value, you can use this process:

Add 100. (Now you have a value form 0 to 199.98779296875.)
Divide by 200. (Now you have a value from 0 to 0.99993896484375.)
Multiply by 16384. (Now you have a value from 0 to 16383.)
Round to the nearest whole number.
Divide by 128.
Write down the part before the decimal point. This is the decimal value for ss.
Subtract the part before the decimal point leaving just the fractional part after the decimal point.
Multiply by 128.
This is the decimal value for tt.
(Convert the decimal values to hex if you need hex values.)
Comment
1. more than a month ago
2. MIDI Specifications
3. # 3
0
Undo
Just a minute.

As I understand it, we are talking about a SYSEX message here, that is System Exclusive. If that is the case, then any massage may be exclusive/specific to a particular system, and may not be general. This thread does not seem to have ever specified any particular device, so the information given may be misleading.

I've just had a dig in the manual for my Yamaha MU90r, and this does show a SYSEX command for master tuning. This message is SIMILAR to the message referred to here. The detail regarding the tuning value does appear to be the same, but the message I have shows extra information before the tuning values regarding Mfg id, memory address, etc that will be specific to the Yamaha MU90r.

Is the OP trying to create something that will be applicable to a range of devices (maybe not possible) or is he thinking about a specific device, in which case, which device?

Geoff
Comment
1. more than a month ago
2. MIDI Specifications
3. # 4
0
Undo
Geof,

Within a SysEx message the manufacturer's number can only be 00 to 7Ch.
So these are specific to a particular piece of equipment.

7Dh, 7Eh and 7Fh are not included. (See table VII in the MIDI spec.)
7Eh and 7Fh are "Non Real Time" and "Real Time" respectively.
Table VIIa gives you the values for how these two types of command may be used.
A well known non real time universal SysEx message being "General MIDI System On".
Comment
1. more than a month ago
2. MIDI Specifications
3. # 5
0
Undo
John,

Thanks for the clarification, however, I was referring to the specific 'Master Tune' SYSEX example given in the manual for my Yamaha MU90r, and this is a normal SYSEX command, which includes the normal Mfg ID for Yamaha. This is not, to my understanding, either 'Real Time' or 'Non-Real Time'. In the same part of the manual, there are various examples of other messages, and I see that some of them are using the 7Eh and 7Fh codes, but none of them are for 'Master Tune'.

I can't find anything relevant in the midi charts for my Korg module, so I cannot comment on that.

The point I was making is that maybe there is NOT a 'One Command Fits All' situation., so the OP's original point may not be valid. I'm not sure the original command would work with the MU90r, although it may well work with other units.

Geoff
Comment
1. more than a month ago
2. MIDI Specifications
3. # 6
0
Undo
MU90, eh! ;-)

It may be, that this particular SysEx command wasn't added to the MIDI specification until the MU90 was designed and built.
The last published version of the specification was, I think, 1996.
I know my MU128 didn't support GM2 voices unless one did a firmware upgrade, and the MU128 was a few yars after the MU90.
I have a feeling they were introduced some time in 1999.

So older devices won't recognise these SysEx commands unless there's some sort of firmware upgrade for them.
Comment
1. more than a month ago
2. MIDI Specifications
3. # 7
0
Undo
Thanks John,

The manuals for my MU90r are dated 1997, so the device could well predate the specific format of the command being referred to here.

OP may just have to apply a warning that devices made before 1999 may not recognise the command he's using. Then he's covered!

Geoff
Comment
1. more than a month ago
2. MIDI Specifications
3. # 8
• Page :
• 1

There are no replies made for this post yet.
Be one of the first to reply to this post!