Split up NSF music

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
User avatar
Michiel
Posts: 7
Joined: Wed Dec 13, 2006 1:20 pm
Location: Rotterdam, The Netherlands
Contact:

Split up NSF music

Post by Michiel »

Hi there. I did some Googling but couldn't really find what I wanted, so I figured I'd ask here.
Since I stopped using my iPod, I recently dug up Winamp and started redownloading all my NSF game music and other tracked files. And now I'm wondering if anyone has ever endeavored towards splitting up NSF files so that instead of them being packed into one file, you can actually have a playlist. Does that exist? I couldn't find it.
Or maybe there's a specific NSF plugin for Winamp that is able to show the multiple songs inside one file as multiple items in a playlist. That would be neat. :)
User avatar
rainwarrior
Posts: 8763
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Split up NSF music

Post by rainwarrior »

NSFPlug can read M3U playlists that reference NSFs. See its readme file for details. NEZPlug had the same feature.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: Split up NSF music

Post by zzo38 »

Michiel wrote:Hi there. I did some Googling but couldn't really find what I wanted, so I figured I'd ask here.
Since I stopped using my iPod, I recently dug up Winamp and started redownloading all my NSF game music and other tracked files. And now I'm wondering if anyone has ever endeavored towards splitting up NSF files so that instead of them being packed into one file, you can actually have a playlist. Does that exist? I couldn't find it.
Or maybe there's a specific NSF plugin for Winamp that is able to show the multiple songs inside one file as multiple items in a playlist. That would be neat. :)
It is easy to split up NSFs containing multiple songs into multiple files of single songs each. Just make multiple copies of the single .NSF and patch it to load the A register at the beginning the INIT routine (if there is any unused space in the file). Of course this will waste disk space since you need multiple copies of a file. Using playlists is probably a better choice if you are able to do this.
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
Michiel
Posts: 7
Joined: Wed Dec 13, 2006 1:20 pm
Location: Rotterdam, The Netherlands
Contact:

Re: Split up NSF music

Post by Michiel »

zzo38 wrote:
Michiel wrote:Hi there. I did some Googling but couldn't really find what I wanted, so I figured I'd ask here.
Since I stopped using my iPod, I recently dug up Winamp and started redownloading all my NSF game music and other tracked files. And now I'm wondering if anyone has ever endeavored towards splitting up NSF files so that instead of them being packed into one file, you can actually have a playlist. Does that exist? I couldn't find it.
Or maybe there's a specific NSF plugin for Winamp that is able to show the multiple songs inside one file as multiple items in a playlist. That would be neat. :)
It is easy to split up NSFs containing multiple songs into multiple files of single songs each. Just make multiple copies of the single .NSF and patch it to load the A register at the beginning the INIT routine (if there is any unused space in the file). Of course this will waste disk space since you need multiple copies of a file. Using playlists is probably a better choice if you are able to do this.
Maybe I should have a look to see if I can find a brief specification of the file format so that I can write a splitter program. That way a split file will contain only one of the songs. It doesn't sound like it's the most complicated file format, right?
I'll give that a try a bit later.

edit: ah, interesting! viewtopic.php?t=5480
I might actually do it this way, just make a little script that duplicates the files with a different LDA #xx at the start. It'll waste some space, but NSF files are so tiny to begin with it doesn't really matter.
User avatar
tokumaru
Posts: 12611
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Split up NSF music

Post by tokumaru »

Michiel wrote:It doesn't sound like it's the most complicated file format, right?
It's fairly complicated if you consider that an NSF is basically the game code stripped of anything that's not related to the music, and that each game handles music differently. The NSF specification just "wraps" that code in a way that makes it easier to interface with it.
just make a little script that duplicates the files with a different LDA #xx at the start. It'll waste some space, but NSF files are so tiny to begin with it doesn't really matter.
That's exactly what zzo38 suggested above.
User avatar
Gil-Galad
Posts: 321
Joined: Sat Nov 13, 2004 9:43 pm
Location: Ohio, USA
Contact:

Re: Split up NSF music

Post by Gil-Galad »

just make a little script that duplicates the files with a different LDA #xx at the start.
There is a simpler way. Just adjust the starting and ending song in the header. That's not a good idea to write in LDA #$xx unless you know how to rewrite the code accordingly. Also, there is init code at the beginning of many NSFs and so can't be overwritten unless you want to screw up the NSF.

LDA #$xx
JMP INIT

LDA #$xx
JSR INIT
RTS

LDA #$xx
STA $xx
RTS

ETC.

These are just very basic code examples before you go to the main init. Even those won't work for a lot of NSFs. Especially the ones that require a complicated init routine.

It's better to use a playlist like others suggested. You can also use NSFE which has a lot more information than the standard NSF.

If you decide to split them anyways. Please, don't release them, only for personal use.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: Split up NSF music

Post by zzo38 »

Gil-Galad wrote:
just make a little script that duplicates the files with a different LDA #xx at the start.
There is a simpler way. Just adjust the starting and ending song in the header. That's not a good idea to write in LDA #$xx unless you know how to rewrite the code accordingly. Also, there is init code at the beginning of many NSFs and so can't be overwritten unless you want to screw up the NSF.
You have to find an unused area of ROM to do this; you cannot simply put always at beginning or whatever else.
LDA #$xx
JMP INIT
Yes, a code like this is what I meant.
If you decide to split them anyways. Please, don't release them, only for personal use.
Agreed; anyone can split them by themself.
(Free Hero Mesh - FOSS puzzle game engine)
Post Reply