I usually stick to the music forum for my announcements, but this is something NES devs in general might be interested in : an official FamiStudio sound engine.
If you have been living under a rock, FamiStudio is a DAW-style NES music editor, it has tons of features:
- Modern DAW-style UI with sequencer and piano roll, no hexadecimal anywhere
- Instrument & Envelope edition
- Full Undo/Redo support
- Copy & Paste support
- Note drag & drop with audio preview
- NSF import
- Import from FamiTracker FTM & Text (official 0.4.6)
- Export to various formats (WAV, ROM, FDS, NSF, FamiTone2, FamiStudio Text, FamiTracker Text)
- Volume, fine pitch, vibrato effect tracks
- Slide notes (portamento)
- Arpeggios
- NES sound engine (CA65, NESASM, ASM6)
- MIDI input support
- Audio expansions supported: VRC6, VRC7, FDS, MMC5, Namco 163 & Sunsoft S5B.
- Windows, MacOS and Linux versions.
Sound Engine
FamiStudio started with FamiTone2 as its sound engine for NSF/ROM export. At each versions more features were added to it to maintain feature parity with the app.
With the release of version 2.2.0, I finally took the time to cleanup the code (its still a bit messy), port it to all 3 assemblers, make a little demo ROM and write some documentation for it so that other devs can start using it. Just to be super clear, this is still very much a FamiTone2-derivative, I am not trying to steal Shiru's work in any way, just building on the solid foundations he laid down.
The best reason to use this engine is its seamless integration with one of more polished and actively developed NES music tool.
Features
The engine has a basic set of features, as well as a few extra toggeable features that you may wish to disable to same CPU/RAM.
The basic feature set that is always available in engine is:
- Support for the first four 2A03 channels (2 squares, triangle and noise channel).
- Support for the full 96 notes (C0 to B7).
- 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.
- Audio expansions chips (at most one can be enabled) : VRC6, VRC7, FDS, S5B and N163.
- PAL/NTSC playback support.
- DPCM sample support
- Sound effect support (with 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 support.
- Fine pitch track support.
- Slide notes.
- Vibrato effect.
- Arpeggios (not to be confused with arpeggio instrument envelopes which are always enabled).
Enabling more features will make the sound engine code larger and use more RAM. The zeropage usage is 7 bytes and can be easily aliased with some of your ZP variables as they are only used as temporary variables inside the famistudio_xxx subroutines.
Here is a table to give a rough idea of the best/worst cast of RAM/CODE usage. These tables where generated with only NTSC support, DPCM support enabled and no SFX streams.
Note that each column includes all features of the columns on the left. So the rightmost column has every feature enabled. In reality, you can toggle features individually and these tables would have dozens of columns.Code size
RAM usage
Demo
A small demo is included with the engine sound code. The demo is available for all 3 major assemblers and they will all generate binary identical ROMs.
Documentation & Download
The engine can be downloaded from famistudio.org. Be sure to checkout the documentation for more in-depth information.
-Mat