FamiStudio Documentation

repository·master·Indexed 23 days ago

https://github.com/bleubleu/famistudio

FamiStudio is a sound engine and editor for NES development, featuring a C# application targeting .NET 8.0 and C++ core components. It supports song, pattern, and instrument management, DPCM samples, and arpeggios. The documentation covers installation, cross-platform compilation for Windows, MacOS, Linux, and Android, localization guidelines, and detailed usage of the sequencer, piano roll, and playback controls.

Tokens
24.4K
Snippets
16
Records
140
Agent score
83%

What's inside FamiStudio

  1. Overview of Nes_Snd_Emu

    master

    Nes_Snd_Emu is a portable Nintendo Entertainment System (NES) 2A03 APU (Audio Processing Unit) sound chip emulator library designed for integration into NES emulators. It focuses on high accuracy, sound quality, and efficiency.

    In addition to the standard 2A03 APU, the library includes emulators for the following expansion sound chips:

    • Namco 106
    • Konami VRC6
  2. Understand the FamiStudio localization file format

    master

    Localization data is stored in a single file per language within the localization folder. The format is an INI file using UTF-8 encoding.

    Structure

    • Sections: Defined by brackets (e.g., [PianoRoll]), these map directly to C# classes in the source code.
    • Keys and Values: Strings are stored as Key=Value.
      • CRITICAL: You are only allowed to change the values. Do not touch, rename, or reorder the keys.
    • Comments: Use # or ; to add comments. Anything to the right of these characters is ignored.
    • Fallbacks: If a string is missing or commented out in a specific language file, FamiStudio will default to the English version.
    • Parameters: Some strings contain placeholders like {0}, {1}, etc., which are inserted at runtime. When translating, ensure these parameters are placed in a position that is grammatically correct for the target language.
    [ConfigDialog]
    
    # Title
    Title=FamiStudio Configuration
    Verb=Apply
    
    # Sections
    ConfigSectionNames_0=General
    ConfigSectionNames_1=Interface
    
    # Example with parameters
    EditEnvelopeTooltip=Edit {0} envelope
  3. Navigate the FamiStudio Main Window

    master

    The interface is divided into four primary areas:

    1. Toolbar (Top): Contains file operations, playback controls, and settings.
    2. Project Explorer (Right): Used to add, remove, or edit Songs, Instruments, DPCM samples, and Arpeggios.
    3. Sequencer (Below Toolbar): A high-level view where you schedule patterns across the 5 available channels.
    4. Piano Roll (Below Sequencer): The detailed editor for notes, instrument envelopes, and special effects.

    Selection State: Items currently selected appear in bold in their respective lists (Channel in Sequencer, Song/Instrument/Arpeggio in Project Explorer). The Sequencer and Piano Roll always display data for the currently selected song.

  4. Configure FamiStudio engine features and resource usage

    master

    The FamiStudio engine includes many features that can be toggled on or off to save CPU and RAM.

    Warning: If you disable a feature, you must ensure your songs do not use it. Using a disabled feature may cause crashes (BRK) or undefined behavior.

    Always Available (Basic Set)

    • Support for the first four 2A03 channels (2 squares, triangle, and noise).
    • Full 96 notes (C0 to B7).
    • Instruments with duty cycle, volume, pitch, and arpeggio envelopes (including absolute/relative pitch and looping).
    • Ability to change speed (FamiTracker tempo mode).
    • Song looping.
    • Up to 64 instruments per export.

    Toggleable Features

    You can enable/disable the following to optimize your project:

    • Audio Expansions: VRC6/Rainbow Mapper, VRC7, FDS, S5B, MMC5, EPSM, or N163 (Note: at most one can be enabled).
    • DPCM: Sample support, bankswitching, and extended range.
    • Instruments: Extended range (up to 256 instruments).
    • SFX: Sound effect support with configurable stream counts.
    • Playback/Effects: PAL/NTSC playback, Blaarg Smooth Vibrato, FamiTracker/FamiStudio tempo mode, Volume tracks/slides, Fine pitch tracks, Slide notes (including noise), Vibrato effect, Arpeggios, Duty cycle effect tracks, Delayed notes/cuts, Delta counter effect tracks, Phase reset support, and FDS auto-modulation.

    RAM/Code Considerations

    • Zero Page: The engine uses 7 bytes of Zero Page. These are used as temporary variables inside famistudio_xxx subroutines and can be aliased with your own ZP variables.
    • Resource Scaling: Enabling more features increases both code size and RAM usage.
  5. Use Arpeggios to simulate chords

    master

    Arpeggios allow a single note to play a sequence of notes rapidly to simulate a chord. When an arpeggio is assigned to a note, the extra notes are displayed in a semi-transparent color corresponding to the arpeggio.

    How to assign an arpeggio:

    • Select a new arpeggio and click on an existing note.
    • Select multiple notes and drag/drop an arpeggio from the Project Explorer onto the selection.

    Important Behavior: If an instrument uses both an arpeggio envelope and an arpeggio chord, the chord will completely override the instrument's arpeggio envelope.

  6. Ways to use Nes_Apu in an emulator

    master

    The library provides two primary methods for integrating the NES APU into an emulator. Detailed instructions for both methods can be found in the usage.txt file included in the library distribution.

    Commonly available interfaces include:

    • Simple_Apu: A simplified interface designed for easier integration and getting started.
    • Nes_Apu: The core NES APU emulator module.
  7. Understand FamiStudio project concepts

    master

    A FamiStudio project is composed of several key entities:

    • Songs: The high-level musical structures.
    • Patterns: The building blocks of Songs. Patterns are organized into one of the five NES-supported channels and contain Notes.
    • Instruments: Used to play Notes. Instruments can have attributes like pitch, volume, and arpeggios modulated by Envelopes.
    • DPCM samples: Audio samples that do not require an instrument to play.
    • Arpeggios: Musical patterns that can be referenced by Instruments or Notes.
  8. Understand FamiStudio Tempo & PAL conversion

    master

    FamiStudio handles the conversion between NTSC (60 FPS) and PAL (50 FPS) systems by automatically computing a tempo envelope. This envelope ensures that songs maintain their intended playback speed when played on a non-native platform (e.g., playing an NTSC song on a PAL system).

    To maintain speed, FamiStudio uses two primary techniques:

    • NTSC to PAL: Runs double frames (2 NTSC frames in a single PAL frame) to keep up with the faster NTSC timing.
    • PAL to NTSC: Inserts idle frames to slow down playback to match the slower PAL timing.

    The tempo envelope is optimized to distribute these double or idle frames as evenly as possible while following these constraints:

    1. Deterministic positions: Frames are placed within notes in a predictable way.
    2. Avoid Note Starts: It avoids placing a double/idle frame on the first frame of a note to preserve the attack.
    3. Avoid Note Ends: It avoids placing a double/idle frame on the last frame of a note to prevent issues with silent notes.
  9. Understand the FamiStudio Text format

    master

    The FamiStudio text format is a textual representation of the binary .FMS format designed for interoperability with other tools and sound engines.

    Key Constraints:

    • Compatibility: It is not forward or backward compatible. FamiStudio can only read text files generated with the same major and minor version (e.g., 3.0.x).
    • Lossy Elements: While mostly lossless, the following are not preserved:
      • Custom colors assigned to songs, instruments, patterns, arpeggios, and DPCM samples (these will be randomized upon re-import).
      • DPCM sample source data and processing parameters (only the final processed data is exported).
    • Availability: Only the desktop version of FamiStudio supports exporting to this format.

    Format Structure: The format uses a nested object structure where each line describes an object followed by attributes in double-quotes. Indentation is cosmetic. Double quotes within values are escaped by doubling them (e.g., "").

    Project Version="2.0.0" Name="FamiStudio Tutorial"
        Instrument Name="Lead"
            Envelope Type="Volume" Length="1" Values="12"
        Song Name="Tutorial Song"
            Channel Type="Square1"
                Pattern Name="Intro1"
                    Note Time="0" Value="G3" Instrument="Lead"
  10. Apply Vibrato Depth and Speed

    master

    Vibrato can be added to a portion of a song without creating a new instrument.

    Important Behaviors:

    • Pitch Envelope Override: Vibrato temporarily overrides any existing pitch envelope on the current instrument. When vibrato is disabled (depth or speed set to zero), the instrument will have no pitch envelope until a new note is played.
    • Audio Artifacts: Changing speed/depth during playback may cause a "pop" because the sine wave envelope restarts from the beginning. To avoid this, change values at the exact start of a cycle.

    Vibrato Speed to Period (Frames) Mapping:

    Vibrato SpeedPeriod (in frames)
    164
    232
    321
    416
    513
    611
    79
    88
    97
    106
    115
    124
  11. Configure Mixer Settings and Overrides

    master

    Projects can override global audio settings (like expansion volumes and filtering) to ensure the project sounds consistent regardless of the user's global configuration. Overridden settings take precedence over the global settings found in the settings dialog.

    • To enable/disable overrides: Click the mixer icon next to the project name.
      • Lit icon: Using the project's specific settings.
      • Dimmed icon: Using your global application settings.
    • Constraint: You can only override settings for audio expansions currently used in the project.