[REQUEST] NSF Plugin

  • NSF files are what people use to play music from the NES.

    Subscribe to Construct videos now

    You can export wav files from NSF files, but it comes with a lot of downsides. A plugin to play NSF files directly in C2 would make a big difference.

    Why does this matter at all?

    • Audio quality for NSF files is lossless (the difference is really noticeable between an NSF player and an exported wav file), and NSF songs are as small as MIDI files. An exported ogg is typically ~100x the size of an NSF file.
    • It makes the workflow for people composing in tracker files much faster.
    • You can customize loop regions, so, for example, you can have a 15 second intro at the start of a song, but skip the intro when the song loops. You can hack something similar together with two regular audio files, a timer and a function to switch between them, but the code ends up being pretty messy, and creating multiple files for every song can be buggy and time-consuming.

    Is it doable in javascript?

    Yeah, totally. R0J0 made a Construct Classic plugin for this a couple years ago And here's a javascript implementation; it uses the Web Audio API like Construct 2, so maybe it could play nice with C2's SDK?

    Thanks for reading.

  • You could try making it a behaviour for the audio object

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Found this javascript library here:

    http://onakasuita.org/jsgme/

    Got an example working in C2:

    https://www.dropbox.com/s/96184k4okj7vue7/nsf.capx?dl=0

    It's very basic and I've lost interest in extending it further. Also I won't be making a plugin version of it.

    To use the js at the start of layout loads the js libraries needed and the "loaded" function is triggered when it's ready to play something.

    Then to play a file use the execute js action of the browser plugin to run one of these three functions:

    play(file, trackNo)

    ex: "play(viper.js', 1);"

    It loads a file and plays a track. Tracks start at 1.

    playTrack(trackNo)

    ex: "playTrack(3);"

    It changes the playing track of the loaded file.

    stop()

    This unloads the file and stops playback. To play again you need to use the "play" function.

    EDIT:

    I just realized that the library used can play all kinds of video game music.

    https://bitbucket.org/mpyne/game-music-emu/wiki/Home

    eg. nes, sega genisis, gameboy, super nintendo

  • I only just saw this reply (took a break from game dev for a while) but this is a huge help, thank you!

  • Sorry to necro, but I was wondering if anybody saved a copy of this? It's no longer on R0j0's Dropbox.

  • Hi,

    It's still on my dropbox but all my links are broken because of a dropbox change. Anyways I updated the link.

  • Thanks a ton!

  • Hi! Sorry for the bad english. How to make it work for NW.js?

  • It should just work. If not then try without the minifier. otherwise I have no idea.

  • Problem solved:

    This works if you replace the line in libgme.js:

    module.exports = Module;[/code:223r1qwd]
    On:
    [code:223r1qwd]global.module = Module;[/code:223r1qwd]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)