Page 1 of 2

Adding audio formats to LÖVE (NSF)

Posted: Sat Jun 30, 2012 11:44 am
by Viento
Hi, I've been using Blitzmax as my primary coding language for a while but due to various limitations/persistent bugs I'm looking to shift to Löve.

Blitzmax had a module to play NES music (NSF files) that was based on the libGME audio library. Would it be possible to add libGME support to Löve? as the GME library is C++, I assume I'd have to modify the Löve source code?

Re: Adding audio formats to LÖVE (NSF)

Posted: Sat Jun 30, 2012 12:09 pm
by coffee
Viento wrote:Hi, I've been using Blitzmax as my primary coding language for a while but due to various limitations/persistent bugs I'm looking to shift to Löve.

Blitzmax had a module to play NES music (NSF files) that was based on the libGME audio library. Would it be possible to add libGME support to Löve? as the GME library is C++, I assume I'd have to modify the Löve source code?
LOVE uses libmodplug with support (I think) of a large number of module formats. Can't you convert the NSF to any of those formats?
Supported module types: .669, .amf, .ams, .dbm, .dmf, .dsm, .far, .it, .j2b, .mdl, .med, .mod, .mt2, .mtm, .okt, .psm, .ptm, .s3m, .stm, .ult, .umx, .xmSound files with .wav extension are also supported.

Re: Adding audio formats to LÖVE (NSF)

Posted: Sat Jun 30, 2012 12:33 pm
by Viento
Thanks for the reply!

As far as I know NSF can't be converted to MOD. I write NES music with MML which is then converted to assembly and compiled into the NSF format. I heard that was an NSF to MIDI converter but apparently the results are patchy and MIDI doesn't sound authentic.

Re: Adding audio formats to LÖVE (NSF)

Posted: Sat Jun 30, 2012 1:20 pm
by coffee
Viento wrote:Thanks for the reply!

As far as I know NSF can't be converted to MOD. I write NES music with MML which is then converted to assembly and compiled into the NSF format. I heard that was an NSF to MIDI converter but apparently the results are patchy and MIDI doesn't sound authentic.
Well, I thought that was perhaps an editor choice problem. I had the felling that good editors as http://famitracker.com/ with exporter plugins can/could output to several other formats than NSF. Try compose with MML but later load it in any other good dedicated NSF editor/player just for exporting. MIDI is not really a good format and could compromise the way you want the track sound like.

Remeber that in last case you can raw export in .ogg or .mp3.

Re: Adding audio formats to LÖVE (NSF)

Posted: Sat Jun 30, 2012 4:07 pm
by Viento
coffee wrote:Well, I thought that was perhaps an editor choice problem. I had the felling that good editors as http://famitracker.com/ with exporter plugins can/could output to several other formats than NSF. Try compose with MML but later load it in any other good dedicated NSF editor/player just for exporting. MIDI is not really a good format and could compromise the way you want the track sound like.

Remeber that in last case you can raw export in .ogg or .mp3.
I'd looked at Famitracker but it's windows only and I use a Mac. Mp3 or Ogg exports would be more of a last resort for me as one of the benefits of NSF is its small filesize, multitrack files and the ability to use loop points etc. within each track.

If adding libgme to Löve is going to be a bit of a pain, I guess I'll have to look into alternatives for the music :)

Re: Adding audio formats to LÖVE (NSF)

Posted: Sat Jun 30, 2012 5:31 pm
by coffee
Viento wrote:
Viento wrote:I'd looked at Famitracker but it's windows only and I use a Mac.
I also run OSX. This kind of small programs work usually well with Wine. Only thing I did to sound output be good was increase buffer.
wine.png
wine.png (103.29 KiB) Viewed 19104 times
Viento wrote:If adding libgme to Löve is going to be a bit of a pain, I guess I'll have to look into alternatives for the music :)
Sorry, even that I sympathize with your cause of want add 8bit chiptune support I doubt that LOVE devs will add it (and increase size to distribution file) just because you ask it (nevertheless being a cute feature don't also add much to LOVE). But remember that LOVE is open source, and you can alter it and add it whatever you want. Maybe someone is willing to unnoficially compile a version with libGME to you. I'm afraid that C++ is beyond my knowledge.

Re: Adding audio formats to LÖVE (NSF)

Posted: Sun Jul 01, 2012 10:31 pm
by rude
Viento wrote:Would it be possible to add libGME support to Löve?
REQUEST GRANTED , probably

I think having support for these files is quite l33t, and therefore necessary. I added support for GME now ( https://bitbucket.org/rude/love/changeset/a46c1dffc4b4 ). For pure-playback purposes, it works quite nicely. Multitrack isn't really well-supported by the current API, though, so the current implementation just plays one track after another. (And seeking probably can't cross tracks). But still, it's a start.

Re: Adding audio formats to LÖVE (NSF)

Posted: Mon Jul 02, 2012 8:33 am
by Boolsheet
I've built a Windows LÖVE binary with Game_Music_Emu support enabled if you want to play around with it. Get it here. This is a development build, don't expect it to be bug or issue free.

Like rude said, this new decoder may have some rough edges. The love.audio and love.sound modules will probably show issues with tracks that have infinite loops. You will see them sooner (newSoundData trying to allocate infinity) or later (love.audio could report inaccurate results after a while where single-precision floating-point numbers are used).

Edit: Ah, I missed the OS X part. Sorry, can't build for that platform.

Re: Adding audio formats to LÖVE (NSF)

Posted: Wed Jul 04, 2012 12:38 pm
by rude
The Windows nightlies(ish) now have GME support.

As a bonus, the Windows nightlies are now also actually working again.

Re: Adding audio formats to LÖVE (NSF)

Posted: Wed Jul 04, 2012 12:56 pm
by Viento
Haha, amazing support! I was just wondering if it was possible, but to actually add it to the source...wow thanks! :D

I downloaded the source you linked to and fired up xcode, but I'm getting 140+ errors when I try to compile. They are mostly "XX was not declared in this scope" and "ostream forbidden with this type" errors. I have the Löve dependancies installed in frameworks - do I need anything else to build the app?

Thanks!