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 SFX Sequence Voice Command format)
(Adding a stub marker citing the under construction nature of this page.)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Go back to [[N-SPC Engine/Prototype]]
Go back to [[N-SPC Engine/Nintendo/Koji Kondo]]
 
{{stub}}


__TOC__
__TOC__
'''NOTE: This page is under construction. The later Koji Kondo games use the same format for the most part (except for ''Star Fox 2'', which has a more massive overhaul), but adapted to modern N-SPC VCMD IDs, and they may have some extra per-entry parameters.'''
''TODO insert table here containing a list of games and their version''


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 <tt>$FF</tt>.
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 <tt>$FF</tt>.


All SFX are initially handled at a tempo of <tt>$38</tt>.
All SFX are initially handled at a tempo of <tt>$38</tt>. ''TODO double check for all games''
 
==SFX Instrument Format==
''TODO Star Glider, Star Fox, Yoshi's Island and Star Fox 2 don't use this instrument format: instead they're standard Kankichi-kun, so TODO note this once the versioning info is implemented''
 
The SFX instrument format, shared among all SFX but not consistently stored in terms of memory location, consists of a series of bytes as following...
<pre>xx yy zz aa bb cc dd ee ff</pre>
* <tt>xx</tt> is a direct write to the VxVOLL DSP register.
* <tt>yy</tt> is a direct write to the VxVOLR DSP register.
* <tt>zz</tt> is a direct write to the VxPITCHL DSP register.
* <tt>aa</tt> is a direct write to the VxPITCHH DSP register.
* <tt>bb</tt> is a direct write to the VxSRCN DSP register.
* <tt>cc</tt> is a direct write to the VxADSR1 DSP register.
* <tt>dd</tt> is a direct write to the VxADSR2 DSP register.
* <tt>ee</tt> is a direct write to the VxGAIN DSP register.
* <tt>ff</tt> is a pitch base multiplier.
 
==SFX Percussion Format==
See [[N-SPC Engine/Prototype#Percussion Format|the music percussion format]], as the format is identical.


==SFX Voice Command Format==
===V0.0-V0.1===
{| class="wikitable sortable"
{| class="wikitable sortable"
|-
|-
Line 13: Line 39:
|<tt>$00</tt> || End of SFX ||
|<tt>$00</tt> || End of SFX ||
|-
|-
|<tt>$01-$7F</tt> || Note Duration || <tt>xx</tt>
|<tt>$01-$7F</tt> || Note Duration || <tt>(xx) (yy)</tt>
|-
|-
|<tt>$80-$C5</tt> || Note ||  
|<tt>$80-$C5</tt> || Note ||  
|-
|-
|<tt>$C6-$CF</tt> || Tie ||  
|<tt>$C6-$CF</tt> || Retrigger Note ||  
|-
|-
|<tt>$D0-$D9</tt> || Percussion ||  
|<tt>$D0-$D9</tt> || Percussion ||  
|-
|-
|<tt>$DA</tt> || Instrument || <tt>xx</tt>  
|<tt>$DA</tt> || Instrument || <tt>xx</tt>  
|-
|<tt>$DA</tt> || Noise Instrument (Super Mario World CPUIO3) || <tt>%1??xxxxx yy</tt>
|-
|-
|<tt>$DB-$DC</tt> || Invalid Note ||
|<tt>$DB-$DC</tt> || Invalid Note ||
|-
|-
|<tt>$DD</tt> || Pitch Slide to Note || <tt>xx yy zz aa</tt>  
|<tt>$DD</tt> || Note + Pitch Slide to Note || <tt>xx yy zz aa</tt>  
|-
|-
|<tt>$DE-$EA</tt> || Invalid Note ||
|<tt>$DE-$EA</tt> || Invalid Note ||
Line 40: Line 68:
|}
|}


==SFX Instrument Format==
===V1.0 and up===
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)...
''TODO add table here: the IDs now reflect modern N-SPC''
* VxVOLL
* VxVOLR
* VxPITCHL
* VxPITCHH
* VxSRCN
* VxADSR1
* VxADSR2
* VxGAIN
* Pitch Base Multiplier


==SFX Percussion Format==
''TODO Star Fox 2'' (has a massive overhaul to the VCMD format)
This is identical to the music percussion format.


==SFX Voice Command Format==
===Invalid Note (VCMD <tt>$DB-$DC</tt>, <tt>$DE-$EA</tt>, <tt>$EC-$FE</tt>)===
===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.
Doesn't crash the sound driver, but does play an invalid note.
Line 63: Line 80:


===Note Duration (VCMD <tt>$01-$7F</tt>)===
===Note Duration (VCMD <tt>$01-$7F</tt>)===
<pre>%0xxxxxxx (yy)</pre>
<pre>%0xxxxxxx (yy) (zz)</pre>


* <tt>xxxxxxx</tt> represents your note length (as seven bits) in tempo ticks.
* <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.
* <tt>yy</tt>, if less than <tt>$80</tt>, represents the volume of the note. If a second byte is defined, this is done for the left channel, otherwise it is for both channels.
* <tt>zz</tt>, if less than <tt>$80</tt>, represents the right volume of the note.


===Note (VCMD <tt>$80-$C5</tt>)===
===Note (VCMD <tt>$80-$C5</tt>)===
Plays a note and delays the channel for one note length before reading another VCMD.
Plays a note and delays the channel for one note length before reading another VCMD.


===Tie (VCMD <tt>$C6-$CF</tt>)===
===Retrigger Note (VCMD <tt>$C6-$CF</tt>)===
Continues playing the previous note and delays the channel for one note length before reading another VCMD.
Retriggers the previous note and delays the channel for one note length before reading another VCMD.


Note that for SFX, there is no rest command.
Note that as a side effect of this, there is no tie or rest command. Rests can be emulated via a zero volume note. Ties... well, officially they're not supported at all, but if the pitch slide length equals or exceeds the note duration, then the note won't be keyed off once the note length has elapsed.


===Percussion (VCMD <tt>$D0-$D9</tt>)===
===Percussion (VCMD <tt>$D0-$D9</tt>)===
Line 84: Line 102:
* <tt>xx</tt> is an instrument ID to an array of instruments. See SFX Instrument Format above for the format.
* <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>)===
===Noise Instrument (VCMD <tt>$DA</tt>)===
Only compatible with Super Mario World when playing SFX through the CPUIO3 register.
 
<pre>$DA %1??xxxxx yy</pre>
 
* <tt>%xxxxx</tt> contains the noise clock rate.
* <tt>yy</tt> is an instrument ID to an array of instruments. See SFX Instrument Format above for the format. This must be <tt>$7F</tt> or less, otherwise the noise clock rate is overwritten and more bytes will be fetched until a non-noise clock value is given.
 
===Note + Pitch Slide To Note (VCMD <tt>$DD</tt>)===
<pre>$DD xx yy zz aa</pre>
<pre>$DD xx yy zz aa</pre>
* <tt>xx</tt> is the starting note.
* <tt>xx</tt> is the starting note.
* <tt>yy</tt> defines the number of tempo ticks to delay the slide for.
* <tt>yy</tt> defines the number of tempo ticks to delay the slide for... at least in theory. In reality, this never works, and the pitch slide executes instantly in all cases.
* <tt>zz</tt> defines the length of the pitch slide in tempo ticks.
* <tt>zz</tt> defines the length of the pitch slide in tempo ticks. If this is equal or greater than the overall note length, the note won't key off at the end, thus allowing for multiple pitch envelopes to be chained at once.
* <tt>aa</tt> is the target note.
* <tt>aa</tt> is the target note.


===Note Pitch Envelope To (VCMD <tt>$EB</tt>)===
===Note Pitch Envelope To (VCMD <tt>$EB</tt>)===
<pre>$EB xx yy zz</pre>
<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... at least in theory. In reality, this never works, and the pitch slide executes instantly in all cases.
* <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. If this is equal or greater than the overall note length, the note won't key off at the end, thus allowing for multiple pitch envelopes to be chained at once.
* <tt>yy</tt> is the length of the pitch slide in tempo ticks.
* <tt>zz</tt> is the target note.
* <tt>zz</tt> is the target note.



Latest revision as of 03:08, 9 January 2024

Go back to N-SPC Engine/Nintendo/Koji Kondo

NOTE: This page is under construction. The later Koji Kondo games use the same format for the most part (except for Star Fox 2, which has a more massive overhaul), but adapted to modern N-SPC VCMD IDs, and they may have some extra per-entry parameters.

TODO insert table here containing a list of games and their version

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. TODO double check for all games

SFX Instrument Format

TODO Star Glider, Star Fox, Yoshi's Island and Star Fox 2 don't use this instrument format: instead they're standard Kankichi-kun, so TODO note this once the versioning info is implemented

The SFX instrument format, shared among all SFX but not consistently stored in terms of memory location, consists of a series of bytes as following...

xx yy zz aa bb cc dd ee ff
  • xx is a direct write to the VxVOLL DSP register.
  • yy is a direct write to the VxVOLR DSP register.
  • zz is a direct write to the VxPITCHL DSP register.
  • aa is a direct write to the VxPITCHH DSP register.
  • bb is a direct write to the VxSRCN DSP register.
  • cc is a direct write to the VxADSR1 DSP register.
  • dd is a direct write to the VxADSR2 DSP register.
  • ee is a direct write to the VxGAIN DSP register.
  • ff is a pitch base multiplier.

SFX Percussion Format

See the music percussion format, as the format is identical.

SFX Voice Command Format

V0.0-V0.1

VCMD ID Description Arguments
$00 End of SFX
$01-$7F Note Duration (xx) (yy)
$80-$C5 Note
$C6-$CF Retrigger Note
$D0-$D9 Percussion
$DA Instrument xx
$DA Noise Instrument (Super Mario World CPUIO3) %1??xxxxx yy
$DB-$DC Invalid Note
$DD Note + 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

V1.0 and up

TODO add table here: the IDs now reflect modern N-SPC

TODO Star Fox 2 (has a massive overhaul to the VCMD 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) (zz)
  • %xxxxxxx represents your note length (as seven bits) in tempo ticks.
  • yy, if less than $80, represents the volume of the note. If a second byte is defined, this is done for the left channel, otherwise it is for both channels.
  • zz, if less than $80, represents the right volume of the note.

Note (VCMD $80-$C5)

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

Retrigger Note (VCMD $C6-$CF)

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

Note that as a side effect of this, there is no tie or rest command. Rests can be emulated via a zero volume note. Ties... well, officially they're not supported at all, but if the pitch slide length equals or exceeds the note duration, then the note won't be keyed off once the note length has elapsed.

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.

Noise Instrument (VCMD $DA)

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

$DA %1??xxxxx yy
  • %xxxxx contains the noise clock rate.
  • yy is an instrument ID to an array of instruments. See SFX Instrument Format above for the format. This must be $7F or less, otherwise the noise clock rate is overwritten and more bytes will be fetched until a non-noise clock value is given.

Note + 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... at least in theory. In reality, this never works, and the pitch slide executes instantly in all cases.
  • zz defines the length of the pitch slide in tempo ticks. If this is equal or greater than the overall note length, the note won't key off at the end, thus allowing for multiple pitch envelopes to be chained at once.
  • aa is the target note.

Note Pitch Envelope To (VCMD $EB)

$EB xx yy zz
  • xx is the number of ticks to delay before applying the pitch envelope... at least in theory. In reality, this never works, and the pitch slide executes instantly in all cases.
  • yy is the length of the pitch slide in tempo ticks. If this is equal or greater than the overall note length, the note won't key off at the end, thus allowing for multiple pitch envelopes to be chained at once.
  • 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.