Audio drivers: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
An '''audio driver''' or '''replayer''' is a program that runs on a game console to play music.
An '''audio driver''' or '''replayer''' is a program that runs on a game console to play music.
An audio driver for NES reads music sequences and instrument definitions from the ROM and writes to the [[APU]] ports, usually once per frame.
An audio driver for NES reads music sequences and instrument definitions from the ROM and writes to the [[APU]] ports, usually once per frame.


== Tracker replayers ==
== Tracker replayers ==
Line 19: Line 20:


* [https://famistudio.org/ Famistudio]
* [https://famistudio.org/ Famistudio]


== Game replayers ==
== Game replayers ==
Line 25: Line 27:
Most can't handle expansions at all, as NES games in an unmodified NES cannot use expansion audio.
Most can't handle expansions at all, as NES games in an unmodified NES cannot use expansion audio.
They usually operate by translating a text export into assembly language data files that are included into the game's source code.
They usually operate by translating a text export into assembly language data files that are included into the game's source code.
=== Famistudio music engine ===
[http://forums.nesdev.org/viewtopic.php?f=2&t=20825&p=256016 Famistudio music engine] by bleubleu
Famistudio's driver is originally of FamiTone2 genealogy, but has been massively reworked.
Some of its key features is being highly configurable to cater for different needs, and extensive expansion audio support.
* Meant to go with its own music tool (Famistudio). Famitracker projects are importable.
* NESASM, CA65, ASM6 versions
Basic features:
* Pulse channels, triangle channel, noise channels
* C0-B7 note range (96 notes)
* Instruments with duty cycle, volume, pitch and arpeggio envelopes
* Absolute and relative pitch envelopes
* Looping sections in envelopes
* Release points for volume envelopes
* Ability to change the speed (FamiTracker tempo mode only)
* Ability to loop over a portion of the song
* Up to 64 instruments per export, an export can consist of as little as 1 song, or as many as 17
* Can enable/disable features to save ROM and RAM
* VRC6, VRC7, FDS, Sunsoft 5B, Namco 163 support (only one at a time)
* PAL/NTSC playback
* DPCM
* Sound effect support (configurable number of streams)
* Blaarg Smooth Vibrato technique to eliminate "pops" on square channels (incompatible with SFX at the moment)
* FamiTracker/FamiStudio tempo mode.
* Volume track
* Fine pitch track
* Slide notes
* Vibrato effect
* Arpeggio effect (not arpeggio envelopes in instruments, which are always available)


=== FamiTone2 ===
=== FamiTone2 ===
Line 32: Line 66:
* Instrument: volume, arpeggio, and pitch envelopes. Duty envelopes longer than 1 frame unsupported. Pitch limited to accumulated distance of 63 units in each direction. No release phase.
* Instrument: volume, arpeggio, and pitch envelopes. Duty envelopes longer than 1 frame unsupported. Pitch limited to accumulated distance of 63 units in each direction. No release phase.
* No volume column
* No volume column
* Effects: tempo (<code>Fxx</code>), pattern cut (<code>Dxx</code>), and loop (<code>Bxx</code>) only
* DPCM for instrument 0 only
* DPCM for instrument 0 only
* Limit of 64 instruments, 17 songs, and 16 KiB of DPCM
* Limit of 64 instruments, 17 songs, and 16 KiB of DPCM
* Size: 186 bytes BSS, 3 bytes zero page, 1636 bytes ROM (source: README)
 
Effects:
* <code>Fxx</code> (speed / tempo)
* <code>Dxx</code> (pattern cut / skip to next frame and start at xx)
* <code>Bxx</code> (loop / jump to frame)
 
Requirements:
*3 bytes ZP
*186 bytes other RAM
*1636 bytes ROM (source: README)
 


=== FamiTone 5.0 ===
=== FamiTone 5.0 ===
Line 42: Line 85:
Modification of FamiTone2 that adds
Modification of FamiTone2 that adds
* Adds volume column support
* Adds volume column support
* Full note range
* Note range A0 - B7
* 1xx,2xx,3xx,4xx,Qxx,Rxx effects
* Duty cycle envelopes
* Duty cycle envelopes
* Sound effects that are bigger than 256 bytes
* Sound effects that are bigger than 256 bytes
and adds effects:
*<code>1xx</code> (portamento up)
*<code>2xx</code> (portamento down)
*<code>3xx</code> (glissando)
*<code>4xy</code> (vibrato)
*<code>Qxx</code>  (slide up to note)
*<code>Rxx</code>  (slide down to note)


=== GGSound ===
=== GGSound ===
[http://www.gradualgames.com/p/sound-engine.html GGSound] by Gradual Games
[https://github.com/gradualgames/ggsound https://github.com/gradualgames/ggsound] by Gradual Games


* Full note range
* NESASM3, ASM6, and ca65 syntax supported
* Note range: C0 - B7
* Instrument: volume, arpeggio, pitch, and duty envelopes, all looping
* Instrument: volume, arpeggio, pitch, and duty envelopes, all looping
* Effects: tempo (<code>Fxx</code>) and loop (<code>Bxx</code>, must be placed in all patterns) only
* SFX playback on up to two channels
* Size: 62 bytes zero page; 184 bytes in BSS; 3048 bytes ROM
* Pause / Unpause
* Compatible with NESASM3, ASM6, and ca65
* Note cuts
* 128 instruments (each with its own set of envelopes)
* 128 songs
* 128 SFX
 
Effects:
* <code>Bxx</code> (loop / jump to frame).
Difference vs famitracker: Loops each channel individually, so must be placed in all channels
for proper song looping.
 
Requirements:
* 66 bytes ZP (57 without DPCM)
* 168 bytes other RAM (144 without DPCM)
* 3048 bytes ROM (out of date, needs test on current version)
 
 
 
=== Lizard music engine ===
[http://forums.nesdev.org/viewtopic.php?f=2&t=18957&p=239567 Lizard music engine] by Rainwarrior
 
Features (subset of Famitracker):
* Volume column supported
* No DPCM
* No Hi-Pitch macros (but regular pitch works)
* Tempo fixed at 150 (use Speed instead)
* SFX on square 1 and/or noise channel
 
Effects:
* <code>Bxx</code> (loop / jump to frame)
* <code>D00</code> (Skip to next frame; no row support)
* <code>F0x</code> (just speed, not tempo)
 
Requirements:
* 22 bytes ZP
* 105 bytes other RAM
* 2152 bytes of code and tables
* ~1800 cycles per frame
 
 
=== NSD.Lib ===
http://shaw.la.coocan.jp/nsdl/ by S.W.
 
Uses linear pitch. Defaults to an uncommon A=442 tuning, though Damian Yerrick has developed a [https://github.com/pinobatch/little-things-nes/tree/master/nsdl-tune tuning table generator] in Python.
 
=== Penguin ===
[https://github.com/pubby/penguin Penguin] by pubby
 
* Constant cycle count of 790, allowing use in a raster effect
* Plays sound effects without using additional cycles
* Famitracker Exported
* [https://forums.nesdev.org/viewtopic.php?p=205095#p205095 Allegedly] has most features of FamiTone2
* No DPCM
* 12 bytes ZP
* 86 bytes other RAM
* Music data not particularly size-optimized
* Sound effects are expensive in terms of size
 


=== Pently ===
=== Pently ===
Line 62: Line 171:
* Instrument: volume, duty, and (absolute) arpeggio envelopes. Pitch envelopes unsupported. The volume envelope can't loop, and the duty and arpeggio envelopes stop at the end of the volume envelope. No release phase.
* Instrument: volume, duty, and (absolute) arpeggio envelopes. Pitch envelopes unsupported. The volume envelope can't loop, and the duty and arpeggio envelopes stop at the end of the volume envelope. No release phase.
* Volume column limited to 4 levels
* Volume column limited to 4 levels
* Effects: vibrato (<code>45x</code>), portamento (<code>3xx</code>), grace note (<code>Sxx</code> and <code>Gxx</code>), legato (change note pitch without restarting envelope), arpeggio (<code>0xy</code>) with 1- or 2-frame arpeggio scheme, tempo, and loop (<code>Bxx</code>)
* Vibrato and portamento use "linear pitch" model similar to that of [https://github.com/HertzDevil/0CC-FamiTracker 0CC-FamiTracker]
* "Rows per minute" tempo model allows runtime correction for NTSC, PAL, and Dendy
* No DPCM
* No DPCM
* Limit of 51 instruments, 25 drums, and 255 patterns
* Limit of 51 instruments, 25 drums, and 255 patterns
* Size: 32 bytes zero page, 112 bytes BSS, 1918 bytes ROM
* tempo ("Rows per minute" tempo model allows runtime correction for NTSC, PAL, and Dendy)
 
Effects:
* <code>45x</code> (vibrato)
* <code>3xx</code> (portamento)
* <code>Sxx</code> grace note / delayed note
* <code>Gxx</code> grace note / delayed cut
* legato (change note pitch without restarting envelope)
* <code>0xy</code> (arpeggio with 1- or 2-tick scheme)
 
* and loop (<code>Bxx</code>)
* Vibrato and portamento use "linear pitch" model similar to that of [https://github.com/HertzDevil/0CC-FamiTracker 0CC-FamiTracker]
 
Requirements:
* 32 bytes ZP
* 112 bytes other RAM
* 1918 bytes ROM
* Some effects are space-intensive and can be disabled at build time through a configuration file to reduce ROM and RAM size. [https://forums.nesdev.org/viewtopic.php?p=205093#p205093 A feature set comparable to FamiTone2] uses 1283 bytes of ROM.
* Some effects are space-intensive and can be disabled at build time through a configuration file to reduce ROM and RAM size. [https://forums.nesdev.org/viewtopic.php?p=205093#p205093 A feature set comparable to FamiTone2] uses 1283 bytes of ROM.
* Compatible with ca65. In 2019, an experimental ASM6 port was added. Python 3 is used to preprocess the score and generate the RAM map.
* Compatible with ca65. In 2019, an experimental ASM6 port was added. Python 3 is used to preprocess the score and generate the RAM map.


The native input format ("Pently score") is inspired by MML and intended to be familiar to users of PPMCK or LilyPond.
The native input format ("Pently score") is inspired by MML and intended to be familiar to users of PPMCK or LilyPond.
Line 84: Line 207:
* Automatic conversion doesn't use the newest features (linear portamento and 2-frame arpeggio) due to converter author's unfamiliarity with 0CC-FamiTracker.
* Automatic conversion doesn't use the newest features (linear portamento and 2-frame arpeggio) due to converter author's unfamiliarity with 0CC-FamiTracker.


=== Penguin ===
[https://github.com/pubby/penguin Penguin] by pubby


* Constant cycle count of 790, allowing use in a raster effect
=== OFGS ===
* Plays sound effects without using additional cycles
http://offgao.net/ofgs/
* Famitracker Exported
* [https://forums.nesdev.org/viewtopic.php?p=205095#p205095 Allegedly] has most features of FamiTone2
* No DPCM
* 12 bytes ZP, 86 bytes RAM
* Music data not particularly size-optimized
* Sound effects are expensive in terms of size


=== NSD.Lib ===
To be written.


Uses linear pitch. Defaults to an uncommon A=442 tuning, though Damian Yerrick has developed a [https://github.com/pinobatch/little-things-nes/tree/master/nsdl-tune tuning table generator] in Python.
=== Sabre ===
[https://github.com/CutterCross/Sabre https://github.com/CutterCross/Sabre] by CutterCross


=== OFGS ===
Features:
http://offgao.net/ofgs/
* CA65 and ASM6 syntax supported
* Note range: A0-B7 (full pulse/tri note range)
* Note cuts
* Speed and tempo
* DPCM supported for music (not for SFX)
* Instrument envelopes: Volume, arpeggio (absolute), pitch (relative) and duty.
* Loop points for all supported envelope types
* 63 instruments
* 255 unique envelopes total shared between instruments.
* 256 tracks
* 256 SFX
* 128 patterns per track
* 1 pattern per SFX
* NTSC, PAL, Dendy tempo & period adjustments
* Linear counter trill for Triangle channel
* Play / Pause / Stop Track routines
* Mute / Unmute channel routines


=== Lizard music engine ===
Effects supported:
[http://forums.nesdev.org/viewtopic.php?f=2&t=18957&p=239567 Lizard music engine] by Rainwarrior
* <code>Bxx</code> (loop / skip to frame)
 
* <code>C00</code> (halt / end song)
Features (subset of Famitracker):
* <code>D00</code> (skip to next frame; specify row not supported)
* Volume column supported
* <code>Fxx</code> (speed / tempo)
* No DPCM
* <code>Zxx</code> (set DPCM delta counter ($4011); affects tri, noise and DPCM volume)
* No Hi-Pitch macros (but regular pitch works)
* Tempo fixed at 150 (use Speed instead)
* Bxx for looping
* D00 for variable pattern length
* F0x for variable speed
* No other effects supported
* Sound effects on square 1 and/or noise channel


Requirements:
Requirements:
* 22 bytes ZP
* 42 bytes ZP
* 105 bytes other RAM
* 121 bytes other RAM
* 2152 bytes of code and tables
* 1749 bytes ROM
* ~1800 cycles per frame


=== Famistudio music engine ===
Notable usage notes:
[http://forums.nesdev.org/viewtopic.php?f=2&t=20825&p=256016 Famistudio music engine] by bleubleu
* Instruments share a common envelope set.
 
* Song format doesn't lay down redundant note period data if the instrument or length changes
* Meant to go with its own music tool (Famistudio)
* Loop/forward points should be in first channel, rather than all channels
* NESASM, CA65, ASM6 versions
* Basic features
** Pulse channels, triangle channel, noise channels
** C0-B7 note range (96 notes)
** Instruments with duty cycle, volume, pitch and arpeggio envelopes
** Absolute and relative pitch envelopes
** Looping sections in envelopes
** Release points for volume envelopes
** Ability to change the speed (FamiTracker tempo mode only)
** Ability to loop over a portion of the song
** Up to 64 instruments per export, an export can consist of as little as 1 song, or as many as 17
* Can enable/disable features to save ROM and RAM
** VRC6, VRC7, FDS, Sunsoft 5B, Namco 163 support (only one at a time)
** PAL/NTSC playback
** DPCM
** Sound effect support (configurable number of streams)
** Blaarg Smooth Vibrato technique to eliminate "pops" on square channels (incompatible with SFX at the moment)
** FamiTracker/FamiStudio tempo mode.
** Volume track
** Fine pitch track
** Slide notes
** Vibrato effect
** Arpeggio effect (not arpeggio envelopes in instruments, which are always available)

Latest revision as of 23:23, 27 September 2024

An audio driver or replayer is a program that runs on a game console to play music. An audio driver for NES reads music sequences and instrument definitions from the ROM and writes to the APU ports, usually once per frame.


Tracker replayers

NSFs exported from FamiTracker and 0CC-FamiTracker contain replayers that can handle all tracker features, but they use a lot of ROM and RAM space and can't handle sound effects.

  • FamiTracker 0.4.2 replayer (0.4.6 is similar)
    • No sound effect support
    • Size: 245 bytes BSS, 20 bytes zero page, 5547 bytes ROM


Game replayers

Replayers intended for use in games have limits on the instrument, effect, and expansion features they can use. Most can't handle expansions at all, as NES games in an unmodified NES cannot use expansion audio. They usually operate by translating a text export into assembly language data files that are included into the game's source code.


Famistudio music engine

Famistudio music engine by bleubleu

Famistudio's driver is originally of FamiTone2 genealogy, but has been massively reworked. Some of its key features is being highly configurable to cater for different needs, and extensive expansion audio support.

  • Meant to go with its own music tool (Famistudio). Famitracker projects are importable.
  • NESASM, CA65, ASM6 versions

Basic features:

  • Pulse channels, triangle channel, noise channels
  • C0-B7 note range (96 notes)
  • Instruments with duty cycle, volume, pitch and arpeggio envelopes
  • Absolute and relative pitch envelopes
  • Looping sections in envelopes
  • Release points for volume envelopes
  • Ability to change the speed (FamiTracker tempo mode only)
  • Ability to loop over a portion of the song
  • Up to 64 instruments per export, an export can consist of as little as 1 song, or as many as 17
  • Can enable/disable features to save ROM and RAM
  • VRC6, VRC7, FDS, Sunsoft 5B, Namco 163 support (only one at a time)
  • PAL/NTSC playback
  • DPCM
  • Sound effect support (configurable number of streams)
  • Blaarg Smooth Vibrato technique to eliminate "pops" on square channels (incompatible with SFX at the moment)
  • FamiTracker/FamiStudio tempo mode.
  • Volume track
  • Fine pitch track
  • Slide notes
  • Vibrato effect
  • Arpeggio effect (not arpeggio envelopes in instruments, which are always available)

FamiTone2

FamiTone2 by Shiru

  • Notes limited to C-1 through D-6
  • Instrument: volume, arpeggio, and pitch envelopes. Duty envelopes longer than 1 frame unsupported. Pitch limited to accumulated distance of 63 units in each direction. No release phase.
  • No volume column
  • DPCM for instrument 0 only
  • Limit of 64 instruments, 17 songs, and 16 KiB of DPCM

Effects:

  • Fxx (speed / tempo)
  • Dxx (pattern cut / skip to next frame and start at xx)
  • Bxx (loop / jump to frame)

Requirements:

  • 3 bytes ZP
  • 186 bytes other RAM
  • 1636 bytes ROM (source: README)


FamiTone 5.0

FamiTone 5.0 by dougeff

Modification of FamiTone2 that adds

  • Adds volume column support
  • Note range A0 - B7
  • Duty cycle envelopes
  • Sound effects that are bigger than 256 bytes

and adds effects:

  • 1xx (portamento up)
  • 2xx (portamento down)
  • 3xx (glissando)
  • 4xy (vibrato)
  • Qxx (slide up to note)
  • Rxx (slide down to note)


GGSound

https://github.com/gradualgames/ggsound by Gradual Games

  • NESASM3, ASM6, and ca65 syntax supported
  • Note range: C0 - B7
  • Instrument: volume, arpeggio, pitch, and duty envelopes, all looping
  • SFX playback on up to two channels
  • Pause / Unpause
  • Note cuts
  • 128 instruments (each with its own set of envelopes)
  • 128 songs
  • 128 SFX

Effects:

  • Bxx (loop / jump to frame).

Difference vs famitracker: Loops each channel individually, so must be placed in all channels for proper song looping.

Requirements:

  • 66 bytes ZP (57 without DPCM)
  • 168 bytes other RAM (144 without DPCM)
  • 3048 bytes ROM (out of date, needs test on current version)


Lizard music engine

Lizard music engine by Rainwarrior

Features (subset of Famitracker):

  • Volume column supported
  • No DPCM
  • No Hi-Pitch macros (but regular pitch works)
  • Tempo fixed at 150 (use Speed instead)
  • SFX on square 1 and/or noise channel

Effects:

  • Bxx (loop / jump to frame)
  • D00 (Skip to next frame; no row support)
  • F0x (just speed, not tempo)

Requirements:

  • 22 bytes ZP
  • 105 bytes other RAM
  • 2152 bytes of code and tables
  • ~1800 cycles per frame


NSD.Lib

http://shaw.la.coocan.jp/nsdl/ by S.W.

Uses linear pitch. Defaults to an uncommon A=442 tuning, though Damian Yerrick has developed a tuning table generator in Python.

Penguin

Penguin by pubby

  • Constant cycle count of 790, allowing use in a raster effect
  • Plays sound effects without using additional cycles
  • Famitracker Exported
  • Allegedly has most features of FamiTone2
  • No DPCM
  • 12 bytes ZP
  • 86 bytes other RAM
  • Music data not particularly size-optimized
  • Sound effects are expensive in terms of size


Pently

Pently by Damian Yerrick

  • Notes limited to A-0 through C-7; changeable at build time
  • Instrument: volume, duty, and (absolute) arpeggio envelopes. Pitch envelopes unsupported. The volume envelope can't loop, and the duty and arpeggio envelopes stop at the end of the volume envelope. No release phase.
  • Volume column limited to 4 levels
  • No DPCM
  • Limit of 51 instruments, 25 drums, and 255 patterns
  • tempo ("Rows per minute" tempo model allows runtime correction for NTSC, PAL, and Dendy)

Effects:

  • 45x (vibrato)
  • 3xx (portamento)
  • Sxx grace note / delayed note
  • Gxx grace note / delayed cut
  • legato (change note pitch without restarting envelope)
  • 0xy (arpeggio with 1- or 2-tick scheme)
  • and loop (Bxx)
  • Vibrato and portamento use "linear pitch" model similar to that of 0CC-FamiTracker

Requirements:

  • 32 bytes ZP
  • 112 bytes other RAM
  • 1918 bytes ROM
  • Some effects are space-intensive and can be disabled at build time through a configuration file to reduce ROM and RAM size. A feature set comparable to FamiTone2 uses 1283 bytes of ROM.
  • Compatible with ca65. In 2019, an experimental ASM6 port was added. Python 3 is used to preprocess the score and generate the RAM map.


The native input format ("Pently score") is inspired by MML and intended to be familiar to users of PPMCK or LilyPond. Conversion from FT text export is through ft2pently by NovaSquirrel. As Pently score was originally intended for human writability, some features don't map well onto FamiTracker features, requiring manual configuration of ft2pently or manual editing of the Pently score it produces:

  • Pattern start has row granularity, allowing a pattern such as a drum fill to replace the end of another pattern.
  • Pattern length is not fixed, allowing long melodic patterns and short drum loops.
  • Patterns are shared among channels. Use this with delayed pattern start for 2-channel echo.
  • Patterns can be transposed. Use this for parallel fourths, fifths, or octaves, or for gear changes like that in the Mermaids of Atlantis soundtrack.
  • Drum channel instead of noise channel. Drums are played as pairs of sound effects that interrupt a note played on the same channel, making Tim Follin-style triangle+noise drums somewhat easier than with the fixed arpeggio that one would use in FT.
  • Envelope divided into an attack phase, similar to FT envelopes, and a decay phase with a constant duty and decreasing volume, similar to NerdTracker II envelopes.
  • "Attack track" mode, where the attack phase of a note on MMC5 channel 1 temporarily overrides the note on pulse channel 1. Useful for staccato ostinatos and occasionally 1-channel echo.
  • Automatic conversion doesn't use the newest features (linear portamento and 2-frame arpeggio) due to converter author's unfamiliarity with 0CC-FamiTracker.


OFGS

http://offgao.net/ofgs/


Sabre

https://github.com/CutterCross/Sabre by CutterCross

Features:

  • CA65 and ASM6 syntax supported
  • Note range: A0-B7 (full pulse/tri note range)
  • Note cuts
  • Speed and tempo
  • DPCM supported for music (not for SFX)
  • Instrument envelopes: Volume, arpeggio (absolute), pitch (relative) and duty.
  • Loop points for all supported envelope types
  • 63 instruments
  • 255 unique envelopes total shared between instruments.
  • 256 tracks
  • 256 SFX
  • 128 patterns per track
  • 1 pattern per SFX
  • NTSC, PAL, Dendy tempo & period adjustments
  • Linear counter trill for Triangle channel
  • Play / Pause / Stop Track routines
  • Mute / Unmute channel routines

Effects supported:

  • Bxx (loop / skip to frame)
  • C00 (halt / end song)
  • D00 (skip to next frame; specify row not supported)
  • Fxx (speed / tempo)
  • Zxx (set DPCM delta counter ($4011); affects tri, noise and DPCM volume)

Requirements:

  • 42 bytes ZP
  • 121 bytes other RAM
  • 1749 bytes ROM

Notable usage notes:

  • Instruments share a common envelope set.
  • Song format doesn't lay down redundant note period data if the instrument or length changes
  • Loop/forward points should be in first channel, rather than all channels