Skip to content

xiangsudian/nsf-player

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

NSF Player

This is a player for NSF-format Nintendo Entertainment System music files. It's written in JavaScript and should work in any major browser.

How to use it

Include libgme.js and index.js in your project.

<script src="libgme.js"></script>
<script src="index.js></script>

Create a player by calling createNsfPlayer.

const nsfPlayer = createNsfPlayer(); // An audio context is created for you.

Optionally, you can pass in your own audio context.

const ctx = new AudioContext();
const nsfPlayer = createNsfPlayer(ctx);

NSF files may contain multiple tracks. Play a track by calling play and passing it the path to your NSF file and the index of the track you wish to hear. (Indexes start at 0 and go up.)

nsfPlayer.play('./songs/smb.nsf', 2);

If you just want to hear the first track, you don't have to pass an index.

nsfPlayer.play('./songs/smb.nsf');

Stop the music by calling stop.

nsfPlayer.stop();

Notes

This uses (and includes) libgme, A.K.A. Game_Music_Emu, a library for emulating video game music. I adapted it from code I found on the web at onakasuita.org/jsgme.

About

NES music player for the web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%