Multiple tracks in NSF files

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Multiple tracks in NSF files
by on (#2832)
how are you supposed to put multiple tracks in NSF files? I know how to make another track, but i don't know how to put anything in it. Does anyone know how? :(

by on (#2973)
anyone? :(

by on (#2975)
Which NSF playback engine are you using?

If you're writing your own, try looking at the A register in your song's init code.

by on (#2976)
I'm not quite sure what you mean, but maybe that's just because I'm a dumbone. I am using the code that was for making NEDs into NSFs. I know how to make 2 tracks, but i don't know how to put anything in the second track. I'm making an NSF for a huge project I am starting, and I want it to be like a soundtrack, which is what an NSF pretty much is, so I'm going to stop talking.

by on (#2977)
Ohh, forgot to say. I'm using the one that They had availible for download at NT2s site.

by on (#2978)
NT2's engine uses .dat files. When you hit enter in there, it creates "temp.dat". So do that with your second song, and rename the file. Then edit the songs.asm file so it includes the .dat file there, and that's about it.

Oh, and all the songs need to use the same set of samples and dpcm notetable too.

by on (#2979)
Okay, I am dumb, but can you just have an extra label like ned18 and just have that incbin the extra dat file? or better yet, can you replace one such as ned1?

by on (#2980)
You need to include it after the labels that are already there (because they're referred to from the main source). The .incbin commands in there now are just commented out (except the first one, for temp.dat).

by on (#2981)
I didn't realize that those other ones had a ; in front of them, so I got it all taken care. Thanks! :)

by on (#12075)
Memblers wrote:
NT2's engine uses .dat files. When you hit enter in there, it creates "temp.dat". So do that with your second song, and rename the file. Then edit the songs.asm file so it includes the .dat file there, and that's about it.

Oh, and all the songs need to use the same set of samples and dpcm notetable too.


I tried to do this, and it didn't quite work out for me. I wanted to make a single .nsf of all my first endeavors, so none of them use the DPCM channel... no problem there. I also uncommented all of the .incbins in the songs.asm file that were necessary (4 tracks). Still, only the first track gets put into the .nsf.

Now, I'm not sure, but is it needed to edit the nt2-22.asm file? I looked in the code and saw this portion:

Code:
NED_Songs: ; = *
NED_Songsx:
                .addr     ned1
                .addr     ned2
                .addr     ned3
                .addr     ned4
                .addr     ned5
                .addr     ned6
                .addr     ned7
                .addr     ned8
                .addr ned9
                .addr ned10
                .addr ned11
                .addr ned12
                .addr ned13
                .addr ned14
                .addr ned15
                .addr ned16
                .addr ned17


NED_SONG = *


Is it possible that I need to edit something in there? I noticed the "= *" after NED_Songs was commented out... would that have anything to do with it?

Thanks.

by on (#12076)
Roth wrote:
Now, I'm not sure, but is it needed to edit the nt2-22.asm file? I looked in the code and saw this portion:


Nope, you could add more entries to that table though if you want to add more tracks, but otherwise only songs.asm needs to be modified.

When you create the temp.dat file, you need to exit NT2 (or in another window) and rename the temp.dat to something else and have it included in songs.asm.

by on (#12077)
Yeah, that's what I did:

Code:
ned1:
.incbin "TEMP.DAT"
ned2:
.incbin "riff.dat"
ned3:
.incbin "newstuff.dat"
ned4:
.incbin "sleuth.dat"


I had ned1 as "stage.dat" but after that didn't work, I thought maybe something with the program needed a "TEMP.DAT" in it, so I did that too. That's why I'm so confused... it seems like it should work no problem.

by on (#12086)
But then all the songs need to use the same set of DMC samples and the same sample mappings. For non-trivial projects, that can be non-trivial to get right.

by on (#12089)
Yeah, I didn't have any samples in any of those. By chance, I don't need to use the same instruments also do I?

by on (#12092)
Instruments for channels 1-4 are stored in a 128-byte block along with each .dat file. They need not be the same on all music files within a .nsf or .nes project.

by on (#12109)
I can't seem to get this to work :? I've included every song with the same samples (even songs that don't use them), and the note-tables are identical. I have every .dat file renamed, and songs.asm edited as necessary. Still no go.

If anyone would like to look at this for me and let me know why it won't work, I'd be VERY grateful. I'm pretty sure all the appropriate files are included.

http://roth.zhxhome.net/nsf/rothstuck.zip

by on (#12110)
Hey, it works already. I'm a tard, I forgot to ask about the NSF header. Problem was when I converted it to cc65 by default I set it to only allow one song to play (on the old ver it was set to 128 or something obnoxious). Sorry about that.

Just find this part in nt2-22.asm, and change the byte for the number of songs.

Code:
.segment "NSFHEADER"

.byte 'N','E','S','M',$1A
.byte $01
.byte 1  ; number of songs

by on (#12117)
Awesome! It works now. There is one problem however... the samples don't work properly. They make a very nasty sound in the background. When the .nsf is just a single song, they sound fine. Is there any way to fix it so the samples play right in a multiple track .nsf?

EDIT: Thanks a ton Memblers!


UPDATE:
Okay, I noticed that it's building with one sample from the "temp.dmc" in this snippet of code from NT2-22.asm:

Code:
.segment "SAMPLES"
.incbin "temp.dmc"


Instead of two samples it's just creating one... do I perhaps need to add in a second .incbin dmc, then edit the makensf.bat file to include it also? If so, how do I go about doing that? I'm not sure if that would work, since I can't edit the other temp files (temp.ihd, temp.dtt) to help it along if need be.

by on (#12502)
So does anyone have any clue why my samples get compressed into one sample when I try to make a multiple track .nsf? All of the songs have the same settings and placement for the samples. Any ideas? Do I have to edit the DPCMCODE.INC file perhaps? Any help is appreciated as usual.

by on (#17339)
Just wanted to post to let everyone know what the problem was, just in case this happens to someone else. The temp.ihd file was the incorrect file. After deleting it and letting a new one appear, all compiled correctly with the samples and such. Thanks to Memblers once again for helping me with this problem.

http://roth.zhxhome.net/nsf/Progress.nsf

If anyone checks it out, it's what I wrote in order... thus the name Progress.nsf. The first couple of tracks are before I learned to use samples/sample editor. There's a couple of cool things, like towards the end of track 6 the bass makes an emergency alarm type sound, and track 7 has a record scratch sample. I think it turned out decent overall. Also, thanks to Tepples who helped me early on while learning how to use NT2.

Does anyone know if you can set something in NT2 that tells a song to stop at a certain point? So if I have a complete song it doesn't keep looping, that is.

EDIT: Sorry about the triple post, but it's been awhile since posting on this thread anywho.

by on (#17341)
Roth wrote:
Does anyone know if you can set something in NT2 that tells a song to stop at a certain point? So if I have a complete song it doesn't keep looping, that is.


Use the Fxx effect with F00 in any channel, it'll stop right there. However, don't let it play to that point in NT2 because it'll never go again until you re-start NT2 (and might carry over to the temp.dat file if you create it when it's stopped, though I'm not sure).

by on (#20249)
**BUMP**

Are there any known ways to create NSF's with multiple tracks from separate NSF files exported from more than one program?

Thanks,

NC

by on (#20251)
No Carrier wrote:
Are there any known ways to create NSF's with multiple tracks from separate NSF files exported from more than one program?


Sure. You'll need space for the NSF init routine, and a way to redirect the play routine to the real play routine for each sound engine.

Then what you'd do is in the NSF init routine, write to the NSF bankswitching registers to swap in the NSF you want for a particular song #. If each NSF is 32kB, you'll need put the init and play routines in the same place in memory (the play routine could simply be a JMP to it from $8000 for example). If the NSFs are smaller than 28kB you could use the last bank (or whichever is free) to hold the init code, and never have to switch that bank.

Make sense?