Skip to content

Commit cd3575b

Browse files
author
Michael Wilson
committed
Add non-normative definition of a valid MIDI message
1 parent 75f9aa2 commit cd3575b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

index.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,33 @@ <h2>
169169
<dfn>MIDI message</dfn>, <dfn>System Real Time</dfn> and
170170
<dfn>System Exclusive</dfn> are defined in [[MIDI]].
171171
</p>
172+
<div class="note">
173+
The definition of a <dfn>valid MIDI message</dfn> should be
174+
inferred from [[MIDI]], but the following may be used as a
175+
non-normative guide:
176+
<ul>
177+
<li>The first byte (the status byte) should have the high bit
178+
set, any following bytes should not unless they are part of a
179+
[=System Exclusive=] message</li>
180+
<li>If the high nibble of the status byte in hex is `8`, `9`,
181+
`A`, `B`, or `E` then the total message length should be 3
182+
bytes
183+
<li>If the high nibble of the status byte is `C` or `D` then
184+
the total message length should be 2 bytes</li>
185+
<li>If the status byte is `F1` or `F3` then the total message
186+
length should be 2 bytes</li>
187+
<li>If the status byte is `F2` then the total message length
188+
should be 3 bytes</li>
189+
<li>If the status byte is `F6`, `F8`, `FA`, `FB`, `FC`, `FE`,
190+
or `FF` then the total message length should be 1 byte (only
191+
the status byte)</li>
192+
<li>If the status byte is `F0` then this is a [=System
193+
Exclusive=] message with no length restriction, and the last
194+
byte should be `F7`</li>
195+
<li>If the status byte is `F4`, `F5`, `F7`, `F9`, or `FD` then
196+
the message is not valid</li>
197+
</ul>
198+
</div>
172199
</section>
173200
<section>
174201
<h2>
@@ -1029,13 +1056,13 @@ <h3 id="MIDIOutput">
10291056
);</code>
10301057
</p>
10311058
<p>
1032-
The data contains one or more valid, complete [=MIDI messages=].
1059+
The data contains one or more complete, [=valid MIDI messages=].
10331060
Running status is not allowed in the data, as underlying systems
10341061
may not support it.
10351062
</p>
10361063
<p>
10371064
If <var>data</var> is not a valid sequence or does not contain
1038-
a valid [=MIDI message=], throw a <code>TypeError</code> exception.
1065+
a [=valid MIDI message=], throw a <code>TypeError</code> exception.
10391066
</p>
10401067
<p>
10411068
If <var>data</var> is a [=System Exclusive=] message, and the

0 commit comments

Comments
 (0)