We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

N-SPC Engine/Nintendo/Koji Kondo/SFX Sequence Format: Difference between revisions

From SnesLab
Jump to: navigation, search
(Adding sections and moving SFX Instrument Format to here)
(Adding SFX Sequence Voice Command format)
Line 56: Line 56:


==SFX Voice Command Format==
==SFX Voice Command Format==
''TODO VCMD documentation (some of them are identical to standard N-SPC)''
===Invalid Note (VCMD <tt>$DB-$DC</tt>, <tt>$DE-$EA</tt>, <tt>$EC-$FE</tt>)===
Doesn't crash the sound driver, but does play an invalid note.
 
===End of SFX (VCMD <tt>$00</tt>)===
Terminates the SFX.
 
===Note Duration (VCMD <tt>$01-$7F</tt>)===
<pre>%0xxxxxxx (yy)</pre>
 
* <tt>xxxxxxx</tt> represents your note length (as seven bits) in tempo ticks.
* <tt>yy</tt>, if less than <tt>$7F</tt>, represents the volume of the note.
 
===Note (VCMD <tt>$80-$C5</tt>)===
Plays a note and delays the channel for one note length before reading another VCMD.
 
===Tie (VCMD <tt>$C6-$CF</tt>)===
Continues playing the previous note and delays the channel for one note length before reading another VCMD.
 
Note that for SFX, there is no rest command.
 
===Percussion (VCMD <tt>$D0-$D9</tt>)===
Plays a percussion note. Unlike SFX, percussion uses the same set that the music uses, and thus has the same instrument format as that.
 
===Instrument (VCMD <tt>$DA</tt>)===
<pre>$DA xx</pre>
 
* <tt>xx</tt> is an instrument ID to an array of instruments. See SFX Instrument Format above for the format.
 
===Pitch Slide To Note (VCMD <tt>$DD</tt>)===
<pre>$DD xx yy zz aa</pre>
* <tt>xx</tt> is the starting note.
* <tt>yy</tt> defines the number of tempo ticks to delay the slide for.
* <tt>zz</tt> defines the length of the pitch slide in tempo ticks.
* <tt>aa</tt> is the target note.
 
===Note Pitch Envelope To (VCMD <tt>$EB</tt>)===
<pre>$EB xx yy zz</pre>
This VCMD is applied to all subsequent notes until turned off or overwritten.
* <tt>xx</tt> is the number of ticks to delay before applying the pitch envelope.
* <tt>yy</tt> is the length of the pitch slide in tempo ticks.
* <tt>zz</tt> is the target note.
 
===Restart SFX (VCMD <tt>$FF</tt>)===
Only compatible with Super Mario World when playing SFX through the CPUIO0 register.
 
Restarts the SFX from the beginning.
 
===Jump Back One Byte (VCMD <tt>$FF</tt>)===
Only compatible with Super Mario World when playing SFX through the CPUIO3 register.
 
Normally, the pointer is incremented upon reading the VCMD. This causes the inverse to happen, and sets the pointer to one byte before this VCMD.
 
===Jump to SFX ID (VCMD <tt>$FF</tt>)===
Only compatible with Pilotwings.
 
<pre>$FF xx</pre>
* <tt>xx</tt> is the SFX ID to jump to. The array used depends on which set of sequences you're using, as the two of them use different sets.

Revision as of 00:56, 26 October 2020

Go back to N-SPC Engine/Prototype

The SFX sequence data is slightly modified compared to the standard N-SPC's voice command format. These are headerless, unlike a song, and they only support one channel at a time, with the channel used being fixed. Both games have almost the same command set except for VCMD $FF.

All SFX are initially handled at a tempo of $38.

VCMD ID Description Arguments
$00 End of SFX
$01-$7F Note Duration xx
$80-$C5 Note
$C6-$CF Tie
$D0-$D9 Percussion
$DA Instrument xx
$DB-$DC Invalid Note
$DD Pitch Slide to Note xx yy zz aa
$DE-$EA Invalid Note
$EB Note Pitch Envelope To xx yy zz
$EC-$FE Invalid Note
$FF Restart SFX (Super Mario World CPUIO0)
$FF Jump Back One Byte (Super Mario World CPUIO3)
$FF Jump to SFX ID (Pilotwings) xx

SFX Instrument Format

The SFX instrument format, shared among all SFX but not consistently stored in terms of memory location, consists of a series of bytes corresponding to direct DSP register writes to the following in order (with the last one not being a DSP register write at all)...

  • VxVOLL
  • VxVOLR
  • VxPITCHL
  • VxPITCHH
  • VxSRCN
  • VxADSR1
  • VxADSR2
  • VxGAIN
  • Pitch Base Multiplier

SFX Percussion Format

This is identical to the music percussion format.

SFX Voice Command Format

Invalid Note (VCMD $DB-$DC, $DE-$EA, $EC-$FE)

Doesn't crash the sound driver, but does play an invalid note.

End of SFX (VCMD $00)

Terminates the SFX.

Note Duration (VCMD $01-$7F)

%0xxxxxxx (yy)
  • xxxxxxx represents your note length (as seven bits) in tempo ticks.
  • yy, if less than $7F, represents the volume of the note.

Note (VCMD $80-$C5)

Plays a note and delays the channel for one note length before reading another VCMD.

Tie (VCMD $C6-$CF)

Continues playing the previous note and delays the channel for one note length before reading another VCMD.

Note that for SFX, there is no rest command.

Percussion (VCMD $D0-$D9)

Plays a percussion note. Unlike SFX, percussion uses the same set that the music uses, and thus has the same instrument format as that.

Instrument (VCMD $DA)

$DA xx
  • xx is an instrument ID to an array of instruments. See SFX Instrument Format above for the format.

Pitch Slide To Note (VCMD $DD)

$DD xx yy zz aa
  • xx is the starting note.
  • yy defines the number of tempo ticks to delay the slide for.
  • zz defines the length of the pitch slide in tempo ticks.
  • aa is the target note.

Note Pitch Envelope To (VCMD $EB)

$EB xx yy zz

This VCMD is applied to all subsequent notes until turned off or overwritten.

  • xx is the number of ticks to delay before applying the pitch envelope.
  • yy is the length of the pitch slide in tempo ticks.
  • zz is the target note.

Restart SFX (VCMD $FF)

Only compatible with Super Mario World when playing SFX through the CPUIO0 register.

Restarts the SFX from the beginning.

Jump Back One Byte (VCMD $FF)

Only compatible with Super Mario World when playing SFX through the CPUIO3 register.

Normally, the pointer is incremented upon reading the VCMD. This causes the inverse to happen, and sets the pointer to one byte before this VCMD.

Jump to SFX ID (VCMD $FF)

Only compatible with Pilotwings.

$FF xx
  • xx is the SFX ID to jump to. The array used depends on which set of sequences you're using, as the two of them use different sets.