Adding audio formats to LÖVE (NSF)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Viento
Prole
Posts: 4
Joined: Sat Jun 30, 2012 11:32 am

Adding audio formats to LÖVE (NSF)

Post 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?
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

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

Post 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.
Viento
Prole
Posts: 4
Joined: Sat Jun 30, 2012 11:32 am

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

Post 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.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

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

Post 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.
Viento
Prole
Posts: 4
Joined: Sat Jun 30, 2012 11:32 am

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

Post 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 :)
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

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

Post 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 19003 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.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

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

Post 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.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

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

Post 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.
Shallow indentations.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

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

Post by rude »

The Windows nightlies(ish) now have GME support.

As a bonus, the Windows nightlies are now also actually working again.
Viento
Prole
Posts: 4
Joined: Sat Jun 30, 2012 11:32 am

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

Post 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!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 43 guests