Note event 0x81-0xFF

Represents a note.

Syntax

byte note, byte duration     // normal
byte note, ushort duration   // in 16-bit duration mode
byte note                    // in default duration mode

Parameters

ParameterTypeDescription
notebyteNote number (0x81-0xFF)
durationbyte / ushortLength (ticks).
Omitted in default duration mode.
A big-endian 16-bit value in 16-bit duration mode

Description

Calculates the pitch from the note number and the channel settings, keys on the DSP channel, and waits for duration. On a BGM channel under SE interrupt, it only waits without writing to the DSP.

At key-on, the following values are written to the DSP.

  • Volume: the channel’s left and right volume (as is)
  • Pitch: the pitch value described below
  • Source number, ADSR1, ADSR2: the channel’s settings
  • GAIN: $7F

At the same time, if pitch bend, vibrato or tremolo is enabled, its counters are initialized.

Length and key-off

The note’s remaining tick count decreases by 1 every tick; key-off happens when the remainder reaches 1, and the next event is read when it reaches 0. In other words, a note of length n sounds for n−1 ticks, and the last tick is silent (release).
If the length is 1, no key-off is performed, so there is no silence between it and the next note. A length of 0 behaves the same as a length of 1.

Pitch calculation

The pitch is obtained by looking up the pitch definition table ($11E1) using the low 7 bits of (note number + transpose value) as the index, then correcting it with the tuning value.
The pitch value is the value of the DSP pitch register; at $1000 the sample plays back at its original speed.

If the tuning value t is not 0, the pitch value P is corrected to P + P × t ÷ 1024.

The pitch definition table covers indexes 0-61.

The note names in the table below assume note number 0x81 is C3. The actual pitch depends on the sample.
However, as a rule it is easier to understand if you set the transpose so that the octave relationships follow this table.

IndexNote numberNote namePitch value
00x80Rest$0000
10x81C3$0200
20x82C#3$021E
30x83D3$023F
40x84D#3$0261
50x85E3$0285
60x86F3$02AB
70x87F#3$02D4
80x88G3$02FF
90x89G#3$032D
100x8AA3$035D
110x8BA#3$0390
120x8CB3$03C7
130x8DC4$0400
140x8EC#4$043D
150x8FD4$047D
160x90D#4$04C2
170x91E4$050A
180x92F4$0557
190x93F#4$05A8
200x94G4$05FE
210x95G#4$065A
220x96A4$06BA
230x97A#4$0721
240x98B4$078D
250x99C5$0800
260x9AC#5$087A
270x9BD5$08FB
280x9CD#5$0984
290x9DE5$0A14
300x9EF5$0AAE
310x9FF#5$0B50
320xA0G5$0BFD
330xA1G#5$0CB3
340xA2A5$0D74
350xA3A#5$0E41
360xA4B5$0F1A
370xA5C6$1000
380xA6C#6$10F4
390xA7D6$11F6
400xA8D#6$1307
410xA9E6$1429
420xAAF6$155C
430xABF#6$16A1
440xACG6$17F9
450xADG#6$1966
460xAEA6$1AE9
470xAFA#6$1C82
480xB0B6$1E34
490xB1C7$2000
500xB2C#7$21E7
510xB3D7$23EB
520xB4D#7$260E
530xB5E7$2851
540xB6F7$2AB7
550xB7F#7$2D41
560xB8G7$2FF2
570xB9G#7$32CC
580xBAA7$35D1
590xBBA#7$3904
600xBCB7$3C68
610xBDC8$3FFF

See also

Sequence data structure
Rest event
Command 0x06
Command 0x12
Command 0x13
Command 0x2B