Program music from Famitracker into game?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
JWinslow23
Posts: 30
Joined: Mon Apr 24, 2017 5:52 am
Location: West Allis, WI

Program music from Famitracker into game?

Post by JWinslow23 »

I created a song in Famitracker that I plan to put in a new game I'm making. How would I put it in a game that I'm making in 6502 asm? I tried generating a .asm file with the "Create .nsf" dialog, but I'm unsure how to play it. I will have sound effects playing with the music, as well.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Program music from Famitracker into game?

Post by tepples »

It depends on which effects and instrument features your piece uses. Two publicly available music engines that can be used with music composed in FamiTracker are Pently and FamiTone2. Neither supports all effects and instrument features.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Program music from Famitracker into game?

Post by dougeff »

But, you forget, Shiru made a full famitracker driver that is compatible with famitone2. And, it is what I'm using for my Ninja game.

It's also complicated, and cc65. And needs lots of ROM space for music data.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
JWinslow23
Posts: 30
Joined: Mon Apr 24, 2017 5:52 am
Location: West Allis, WI

Re: Program music from Famitracker into game?

Post by JWinslow23 »

I'm not using any effects except Cxx (halt song), and my instruments only have volume changes. Thanks for pointing me to Famitone2, I might use that. Is that compatible with NESASM3?
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Program music from Famitracker into game?

Post by DRW »

JWinslow23 wrote:Is that compatible with NESASM3?
Why don't you download it and check it out? :wink:


As dougeff already said: Shiru made two versions of it.

The regular FamiTone2 v1.15 is the one that he created as a minimalistic sound driver for NES development.

And because he got frustrated by people who complained that certain things don't work in FamiTone, he created neslib + FamiTracker player which uses the original FamiTone only for sound effects while the music is done with the native FamiTracker driver:
Since release of FamiTone I was getting complaints on how restricted it is, and
how missing features not allowing to create good music with it. It gets as far
as people now trying to expand the engine to support more FamiTracker features,
for some reason - rather pointless to me, as the very idea of FamiTone was to be
that restricted, the design was never intended to be expandable, and it would be
easier to just write another engine from scratch.
So, it's your choice which one you want to use.

With neslib + FamiTracker player, you can do everything that FamiTracker can do. But it will probably require a lot of ROM space and I assume calling the functions would also require a lot of the precious CPU time (which, unlike ROM space, cannot be added with mappers).

For my game, I used the regular FamiTone, i.e. the limited, but small one.

I don't understand the problem many people have. I myself don't know much about making music. But I would say my composer did a pretty neat soundtrack, even with FamiTone's restrictions:
https://iyamwhatiyam.bandcamp.com/releases
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
JWinslow23
Posts: 30
Joined: Mon Apr 24, 2017 5:52 am
Location: West Allis, WI

Re: Program music from Famitracker into game?

Post by JWinslow23 »

I'm having a problem in the first step. When I'm using the text2data tool that comes with Famitone, it always crashes. There is no error message, it just freezes for a second, and then my computer says "text2data.exe has stopped working". I'm on Windows 10, and the .txt file FamiTracker generates is attached. How do I fix this?
Attachments
WalRush_Main_Theme.txt
(9.09 KiB) Downloaded 112 times
Last edited by JWinslow23 on Thu Apr 27, 2017 3:35 pm, edited 1 time in total.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Program music from Famitracker into game?

Post by DRW »

What happens when you just call the program without any parameters? Does the error appear as well?

If yes, you might have to install the Visual C++ Runtime (version 2008 or later) first.

Edit: The problem happens on my PC as well, but only with your FamiTracker file.

Did you use the regular FamiTracker or that beta version?

I assume you have to use FamiTracker 0.4.6.
Last edited by DRW on Thu Apr 27, 2017 3:38 pm, edited 1 time in total.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
JWinslow23
Posts: 30
Joined: Mon Apr 24, 2017 5:52 am
Location: West Allis, WI

Re: Program music from Famitracker into game?

Post by JWinslow23 »

Without any parameters, it just gives me usage information.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Program music from Famitracker into game?

Post by DRW »

I added some text to my previous post.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Program music from Famitracker into game?

Post by DRW »

Alright, I see now: Your file is created from FamiTracker 0.4.2. I'd suggest to download the latest version (0.4.6):
www.famitracker.com/downloads.php
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
JWinslow23
Posts: 30
Joined: Mon Apr 24, 2017 5:52 am
Location: West Allis, WI

Re: Program music from Famitracker into game?

Post by JWinslow23 »

I did get FamiTracker v0.4.6. That's what it says in the "About FamiTracker" information. I also have the latest version of Famitone.

I'm confused. :\

Here is my actual FamiTracker project, if it's something to do with that. (It has two songs: the main theme, and a "flap" sound-effect.)
Attachments
WalRush_Main_Theme.ftm
(3.6 KiB) Downloaded 113 times
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Program music from Famitracker into game?

Post by DRW »

O.k., looks like the problem is with your FTM file somehow since it has exactly the same symptoms on my PC.

In the past, we've had this as well, that some dirty stuff was somewhere inside the binary file that was also put into the text file and made it semi-invalid.

My suggestion:
Open a clean new file (with the latest FamiTracker version).
Open the current file in another FamiTracker instance.
Put everything from the dirty file to the clean file via copy & paste.

And then save the clean file.
Whatever dirty stuff is in the old file should be gone. (You can do a file compare of the text export from the new and the old file to see where they differ.)
Last edited by DRW on Thu Apr 27, 2017 4:09 pm, edited 1 time in total.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: Program music from Famitracker into game?

Post by DRW »

Unrelated hint, but this has nothing to do with the error: Sound effects have to be created with nsf2data and therefore go into a separate file.

Unfortunately, sound effects in FamiTone cannot use an infinite loop. If you want an infinite sound effect, you either have to time the sound effect call in code or you have to do it as a song after all. But doing it as a song means that you cannot have another background song while the effect is played.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
JWinslow23
Posts: 30
Joined: Mon Apr 24, 2017 5:52 am
Location: West Allis, WI

Re: Program music from Famitracker into game?

Post by JWinslow23 »

DRW wrote:Unrelated hint, but this has nothing to do with the error: Sound effects have to be created with nsf2data and therefore go into a separate file.

Unfortunately, sound effects in FamiTone cannot use an infinite loop. If you want an infinite sound effect, you either have to time the sound effect call in code or you have to do it as a song after all. But doing it as a song means that you cannot have another background song while the effect is played.
I do not want an infinite loop. I actually made it stop with Cxx, but apparently Famitone doesn't support that. What effect would do this?

Also, I got text2data working now, thanks!
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Program music from Famitracker into game?

Post by dougeff »

I had no problems. (note, I removed the 2nd song before exporting from 0.4.6).

(leaving it on crashes text2data for some reason).
Attachments
WalRush.asm
(2.01 KiB) Downloaded 105 times
Last edited by dougeff on Thu Apr 27, 2017 4:35 pm, edited 1 time in total.
nesdoug.com -- blog/tutorial on programming for the NES
Post Reply