NES Sound Format
Encyclopedia
NSF is the DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

 8.3 filename Filename extension
Filename extension
A filename extension is a suffix to the name of a computer file applied to indicate the encoding of its contents or usage....

 of the audio file format originally designated as NESM (Nintendo Entertainment System Music) by the inventor Kevin Horton. This format was originally designed for playback in a custom hardware device named HardNES by the inventor. Over the years, the NSF format has been implemented for playback on many platforms via plugins, stand-alone players, emulators and also the NES PowerPak.

The particulars of the NSF format resemble the SID
MOS Technology SID
The MOS Technology 6581/8580 SID is the built-in Programmable Sound Generator chip of Commodore's CBM-II, Commodore 64, Commodore 128 and Commodore MAX Machine home computers...

 format loosely, where a header is prepended and then the original audio data follows. The original audio data commonly has been extracted from a ROM image
ROM image
A ROM image, or ROM file, is a computer file which contains a copy of the data from a read-only memory chip, often from a video game cartridge, a computer's firmware, or from an arcade game's main board...

 or disk image and then modified for stand-alone playback by various players. The original audio data is also commonly referred to as an audio driver or music engine. The audio driver is then completely isolated from the rest of the code, data and graphics that have nothing to do with the audio driver. A complete NSF is considered a multiple song and sound effect container for one particular game or composition.

The following 6502 platforms with a RP2A03/RP2A07 microprocessor
Microprocessor
A microprocessor incorporates the functions of a computer's central processing unit on a single integrated circuit, or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and...

 including some clone units are compatible with the NSF format and current NSF players. These platforms can be PAL
PAL
PAL, short for Phase Alternating Line, is an analogue television colour encoding system used in broadcast television systems in many countries. Other common analogue television systems are NTSC and SECAM. This page primarily discusses the PAL colour encoding system...

 or NTSC
NTSC
NTSC, named for the National Television System Committee, is the analog television system that is used in most of North America, most of South America , Burma, South Korea, Taiwan, Japan, the Philippines, and some Pacific island nations and territories .Most countries using the NTSC standard, as...

 or dual PAL/NTSC from any region. There are exceptions to the rule where if any part of a platform that has another microprocessor such as the Zilog Z80
Zilog Z80
The Zilog Z80 is an 8-bit microprocessor designed by Zilog and sold from July 1976 onwards. It was widely used both in desktop and embedded computer designs as well as for military purposes...

 will not be supported.
  • Nintendo Entertainment System
    Nintendo Entertainment System
    The Nintendo Entertainment System is an 8-bit video game console that was released by Nintendo in North America during 1985, in Europe during 1986 and Australia in 1987...

  • Famicom
  • Family Computer Disk System
  • Nintendo Vs. System
  • PlayChoice-10
    PlayChoice-10
    PlayChoice-10 was an arcade machine which could consist of as many as 10 different games previously available only on the Nintendo Entertainment System home console...

  • Dendy (console)
  • Various NES and Famicom clone units.


The following chips and components are supported in the NSF specification.
  • RP2A03 APU
    APU
    - Film and television :* The Apu Trilogy, a series of Bengali films from the 1950s directed by Satyajit Ray** Apu Roy, the main protagonist of the trilogy* Apu Nahasapeemapetilon, a fictional character from the animated television series The Simpsons...

     NTSC
  • RP2A07 APU
    APU
    - Film and television :* The Apu Trilogy, a series of Bengali films from the 1950s directed by Satyajit Ray** Apu Roy, the main protagonist of the trilogy* Apu Nahasapeemapetilon, a fictional character from the animated television series The Simpsons...

     PAL
  • RP2C33 Audio Channel (FDS)
  • Konami
    Konami
    is a Japanese leading developer and publisher of numerous popular and strong-selling toys, trading cards, anime, tokusatsu, slot machines, arcade cabinets and video games...

     VRC VI Audio
  • Konami
    Konami
    is a Japanese leading developer and publisher of numerous popular and strong-selling toys, trading cards, anime, tokusatsu, slot machines, arcade cabinets and video games...

     VRC VII Audio
  • Namco N106 Audio
  • Nintendo
    Nintendo
    is a multinational corporation located in Kyoto, Japan. Founded on September 23, 1889 by Fusajiro Yamauchi, it produced handmade hanafuda cards. By 1963, the company had tried several small niche businesses, such as a cab company and a love hotel....

     MMC5 Audio
  • Sunsoft 5B Audio (similar to AY-3-8910)


NSF format supports all five normal audio channels of the APU as well as the other audio expansion chips previously listed.
  • Square 1
    Square wave
    A square wave is a kind of non-sinusoidal waveform, most typically encountered in electronics and signal processing. An ideal square wave alternates regularly and instantaneously between two levels...

  • Square 2
    Square wave
    A square wave is a kind of non-sinusoidal waveform, most typically encountered in electronics and signal processing. An ideal square wave alternates regularly and instantaneously between two levels...

  • Triangle
    Triangle wave
    A triangle wave is a non-sinusoidal waveform named for its triangular shape.Like a square wave, the triangle wave contains only odd harmonics...

  • Noise
    Noise (electronics)
    Electronic noise is a random fluctuation in an electrical signal, a characteristic of all electronic circuits. Noise generated by electronic devices varies greatly, as it can be produced by several different effects...

  • DMC
    Delta modulation
    Delta modulation is an analog-to-digital and digital-to-analog signal conversion technique used for transmission of voice information where quality is not of primary importance. DM is the simplest form of differential pulse-code modulation where the difference between successive samples is encoded...

     - Including 1-bit delta encoded samples or using the 7-bit counter for PCM playback.

NESM header specification

As said earlier, the NSF header is prepended to the original audio data and code. The header was designed to be as flexible as possible and to allow for hardware and emulation playback. The header supports three specific addresses; the first one is the beginning address of the audio data, the next two are entry points to the play and initialization code respectively.

The header supports PAL, NTSC, dual PAL/NTSC and also allows to adjust the playback speed. This playback speed is not meant to be used to adjust the speed of songs in a rip, but to account for various units with a microprocessor speed that is not considered standard. Such as many clone Famicom/NES units from China
China
Chinese civilization may refer to:* China for more general discussion of the country.* Chinese culture* Greater China, the transnational community of ethnic Chinese.* History of China* Sinosphere, the area historically affected by Chinese culture...

. Be aware that some players do not support the playback speed.

The header also has an extra sound chip support setting for six expansion chips listed above. No commercial game ever used more than one expansion sound chip. However, many fan compositions do use up to all expansion sounds chips in the NSF format.

The header also has a total number of songs. However, this setting has a limit for 256 songs. In most cases you will never reach this limit.

There are also three slots for name of song, artist and copyright holder. Each one of these has a limit of 32 ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 characters.

Bankswitching is also supported in the header format. The bank size select is 4KB for a total amount of FF(256) banks or a maximum limit of 1MB. There are 8 bank switching bytes, each one supports a 4KB section of the memory range used which is $6000 - $FFFF depending on if normal or FDS bankswitching is used. These bytes are the initial setting for banks to be loaded on reset.

NSF 2

Currently, NSF is at version 01h. NSF version 2 is a proposal that has been in discussion for a few years and hasn't been finalized as of yet. The reason why version 2 has been proposed is because the current NSF format doesn't support every possible configuration of a NES audio driver, which means that there are some NSFs that cannot be ripped without extensive hacking, or maybe it's impossible. There are also a handful that need to be reripped for this format.

The general idea is to support a initialization routine that never returns, IRQ and a proper NMI instead of a play entry point address call. Generally speaking, the initialization routine should return in 4 or less frames. If the routine does not return in time or not at all then the NSF will not play. The reason why you would need a non-returning routine is for PCM playback and a few NSFs that require a non-returning initialization.

There are some audio drivers that have a play call in the NMI as well as audio code in the IRQ. Since the NSF format currently does not support an additional IRQ address setting, those rips will not play either without extensive modification.

There are only approximately about 40 games that require this function to be ripped properly in NSF format. So, it's unknown as to when this format will be finalized. Quietust has implemented some features of this proposal in his emulator Nintendulator which allows both Battletoads
Battletoads
Battletoads is a platformer video game created by Tim and Chris Stamper and developed by Rare. Starring three anthropomorphic toads named after skin conditions , the game was created to rival the Teenage Mutant Ninja Turtles games....

 and Battletoads & Double Dragon
Battletoads & Double Dragon
Battletoads & Double Dragon: The Ultimate Team is a 1993 beat 'em up developed by Rare and published by Tradewest. It was originally released for the NES and later ported to the Sega Mega Drive/Genesis, Super NES, and Game Boy....

 to play with raw PCM drums. There may be other players that support the watch-dog timer and/or non-returning features as well.

NSFE

NSFE is a 4 character file name extension for a new Extended NSF format. This format was extended by Disch and initially for his NSF Winamp plugin called NotSo Fatso as an extension to the original NSF format invented by Kevin Horton. NSFE was also created to add additional functions to NSFs such as timers for songs, fade-out time, arrange songs in a playlist, labels per song, the person who ripped the NSF and several other features. Since NotSo Fatso supports nearly every feature of the NSF format including all expansion chips, NSFE quickly gained in popularity. In order to implement these additional features, the format is chunked based. Thus, it's not ideal or possible to implement on any type of Famicom/NES hardware or FPGA type system without extensive modification. While the NSFE format shines on modern PC emulation platforms.

NSF hardware players

HardNES is the first NSF hardware player invented by Kevin Horton that is run by a NES CPU and a FPGA. It features a LED
LEd
LEd is a TeX/LaTeX editing software working under Microsoft Windows. It is a freeware product....

, stereo sound and 128 KB RAM
Ram
-Animals:*Ram, an uncastrated male sheep*Ram cichlid, a species of freshwater fish endemic to Colombia and Venezuela-Military:*Battering ram*Ramming, a military tactic in which one vehicle runs into another...

 chip which contains all the RAM used by the control system and the emulated ROM space that is bank-switched. The maximum NSF size would be under 128 KB.

CopyNES NSF Cart is another invention by Kevin Horton. The NSF Cart is used in combination with a CopyNES. The NSF file is transferred to the CopyNES and then to the NSF Cart for NSF playback. The maximum sized NSF for the original cart is 128 KB. It may be possible to install a larger RAM chip to play back larger NSFs.

NES PowerPak is a NES cartridge that has a CompactFlash
CompactFlash
CompactFlash is a mass storage device format used in portable electronic devices. Most CompactFlash devices contain flash memory in a standardized enclosure. The format was first specified and produced by SanDisk in 1994...

 card port that enables the transfer of ROM images to this cart. The 512 KB RAM chip and the FPGA circuits allow this cartridge to be flexible enough to support many iNES mappers including the NSF specification. Currently, NSF support does not include all expansion sound chips. Also, since the NES PowerPak's smallest bank size select is 8 KB and the NSF bank size select is 4 KB, there is a trick involved that effectively doubles the 4 KB banks but also limits the maximum NSF size to 256 KB.

NSF music composition

Over the years, the NSF format became so popular that many composers wished to create their own NES music. That day was realized when Nerdtracker first came out which is probably the first free public domain tracker. Since then, many other trackers and tools came out to compose NES music. All over the world and across the internet many composition contests are held such as the once a year Famicompo mini which is a Japanese hosted competition. The number of original compositions is beginning to rival the number of current commercial NSF game extractions.

See also

  • Family Computer Disk System
  • Nintendo Entertainment System
    Nintendo Entertainment System
    The Nintendo Entertainment System is an 8-bit video game console that was released by Nintendo in North America during 1985, in Europe during 1986 and Australia in 1987...

  • List of NES games
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK