Coder Social home page Coder Social logo

orangelando / nsf Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 220 KB

Programs to read Nintendo Sound Format (.nsf) files and render them to Wav files.

License: GNU General Public License v3.0

Shell 0.22% Java 98.12% Assembly 1.65%
6502 emulation nintendo nes nsf 2a03 retrogaming

nsf's Introduction

NSF renderer in Java

Java project to render the music within a Nintendo Sound Format (.nsf) file to a wav file. This is still definitely a WIP. The 6502 core is not cycle accurate. I wanted to see if it is possible to do a higher level interpretation of the CPU and still get accurate results. So far it seems to be working.

Usage

Prerequisites

Maven is required so that the fat jar can be built:

$ mvn package
... bunch of stuff ...
[INFO] BUILD SUCCESS
[INFO] --------------------------------------
[INFO] Total time: 11.201 s
[INFO] Finished at: 2019-02-04T20:50:13-05:00
[INFO] --------------------------------------

Viewing NSF Header Examples

$ ./lando-nsf-info ~/Desktop/nsf/metroid.nsf 
Version Number    : 1
Total Songs       : 12
Starting Song     : 1

Song Name         : Metroid
Artist Name       : Hirokazu "Hip" Tanaka
Copyright Holder  : 1986 Nintendo

NTSC/Pal Mode     : NTSC
NTSC Speed        : 16666
PAL Speed         : 0

Bankswitch Vals   : [5, 5, 5, 5, 5, 5, 5, 5]
Extra Sound Chips : []

Load Data Addr    : $8000
Init Data Addr    : $a000
Play Data Addr    : $b3b4

Add the "-json" argument to the results in JSON.

Extracting a Single Track to a WAV File

NSF files that are extracted from NES ROMs are under copying and cannot be distributed so please provide your own NSF files.

$ ./lando-nsf2wav -nsfFile ~/Desktop/nsf/super-mario-bros-2.nsf -trackNum 2 -outFile ~/Desktop/out.wav

Extracting All Tracks at Once

NSF files that are extracted from NES ROMs are under copying and cannot be distributed so please provide your own NSF files.

$ ./lando-nsf2wav -nsfFile ~/Desktop/nsf/super-mario-bros-2.nsf -allTracks -outFile ~/Desktop/out.wav

The full list of options are:

  • -nsfFile path Path to .nsf file
  • -outFile path Path to output file
  • -trackNum N Track num to extract
  • -allTracks Extract all tracks. Appends '-00', '-01' etc to the output file.
  • -disableChannels 12tnd Disable one or more APU channels. 1=pulse1, 2=pulse2, t=triangle, n=noise, d=dmc
  • -maxPlaysSecs 30 Many tracks loop forever. This is the maximum play time before the track fades out. 30 is the default.
  • -maxSilenceSecs 3 The tracks is stopped playing if more than this many seconds of silence is detected. 3 is the default.
  • -disableBandPass Disables the highpass filter at 440hz and a lowpass filter at 14khz in the wav output.
  • -splitChannels Output each channel into a separate file.
  • -outFmt wav|system_raw The system-raw option outputs to 32-bit, little endian float samples per 1.79MHz clock tick. Useful for debugging. Default is wav which outputs a standard wav file with mono 16bit PCM samples at 44.1kHz.

Resources

nsf's People

Contributors

orangelando avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

psykedady

nsf's Issues

Pulse channel durations incorrect

In cases where original ROM (and other NSF players) play a long duration note, my player cuts short. I've looked at the writes to the pulse channels and see the envelope being see to constant volume and that volume going down to zero so it seems correct but does not match the output of other players. An example see the 2nd track of Castlevania. The 4th note that plays around 0.6 seconds in on the second pulse channel should play for about a second.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.