[REQUEST] NSF Plugin

Post your work in progress addons and get feedback

Post » Fri Jan 23, 2015 7:07 am

NSF files are what people use to play music from the NES. People also make new music in the NES format, and it's awesome. 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. :)
B
12
S
3
Posts: 39
Reputation: 1,001

Post » Sun Jan 25, 2015 8:33 pm

You could try making it a behaviour for the audio object
B
79
S
13
G
8
Posts: 1,976
Reputation: 9,947

Post » Wed Jun 22, 2016 4:33 pm

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
Last edited by R0J0hound on Tue Mar 21, 2017 8:12 am, edited 1 time in total.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Sat Dec 10, 2016 7:48 pm

I only just saw this reply (took a break from game dev for a while) but this is a huge help, thank you!
B
12
S
3
Posts: 39
Reputation: 1,001

Post » Tue Mar 21, 2017 8:08 am

Sorry to necro, but I was wondering if anybody saved a copy of this? It's no longer on R0j0's Dropbox.
B
95
S
35
G
8
Posts: 315
Reputation: 11,326

Post » Tue Mar 21, 2017 8:13 am

Hi,
It's still on my dropbox but all my links are broken because of a dropbox change. Anyways I updated the link.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Sat Mar 25, 2017 3:02 pm

Thanks a ton!
B
95
S
35
G
8
Posts: 315
Reputation: 11,326

Post » Sun Jul 30, 2017 8:38 pm

Hi! Sorry for the bad english. How to make it work for NW.js?
B
3
Posts: 6
Reputation: 181

Post » Sun Jul 30, 2017 10:59 pm

It should just work. If not then try without the minifier. otherwise I have no idea.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Mon Jul 31, 2017 5:58 pm

Problem solved:
This works if you replace the line in libgme.js:
Code: Select all
module.exports = Module;

On:
Code: Select all
global.module = Module;
B
3
Posts: 6
Reputation: 181


Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests