music in asm

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

Moderator: Moderators

Post Reply
Posts: 4
Joined: Fri Sep 21, 2018 4:00 pm

music in asm

Post by lapalourde75 » Fri Oct 05, 2018 9:48 am

je voudrai savoir si il est possible d inclure un fichier nsf cree avec famitracker
pour pouvoir l inclure dans un programme asm

juste pour faire une melodie sur un jeu basique

pour l instant j ai juste reussi en recuperant des infos
a avoir un background
un personnage qui se deplace
un flip du personnage

ainsi que des ennemi qui se deplacent horizontalement ou verticalement

les prochaines etapes seront une petite melodie comme indique
et surtout la gestion des collisions

in english

I want to know if it is possible to include a file nsf created with famitracker
to be included in an asm program

just to make a melody on a basic game

for now I just managed to recover some information
to have a background
a moving character
a flip of the character

as well as enemies moving horizontally or vertically

the next steps will be a little melody as indicated
and especially collision management

thank you all

merci a tous

Posts: 22017
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Re: music in asm

Post by tepples » Fri Oct 05, 2018 9:53 am

Do you have the FTM or 0CC file? If so, there are a few audio drivers that can play music converted from FamiTracker, such as Pently, FamiTone2, FamiTone4, and GGSound. Each of these drivers has limits on which FamiTracker effects it supports: FamiTone2 and GGSound are more basic, whereas Pently and FamiTone4 are more full featured.

User avatar
Posts: 7824
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada

Re: music in asm

Post by rainwarrior » Fri Oct 05, 2018 10:27 am

If the NSF is small enough and doesn't bankswitch, you can embed it directly in your assembly program. The NSF header has three fields, LOAD, INIT and PLAY that are needed for doing this. LOAD is where to put the data in the ROM. INIT is the address of the routine to set up a track to be played. PLAY is called once per frame.

If you need sound effects as well, this can be a bit of a problem to implement on top of an NSF. The sound effect code should need to cooperate with the music code, not just run on top of it. For that case one of tepples' suggested alternatives might help.

There is also "NSF driver" assembly source code for Famitracker, which would let you build the NSF data yourself as part of the program. If you used that you could place the data anywhere (not just the INIT address) and modify the source code as needed for sound effect cooperation.

Posts: 4
Joined: Fri Sep 21, 2018 4:00 pm

Re: music in asm

Post by lapalourde75 » Mon Oct 08, 2018 2:48 pm

can you explain more
and example

Post Reply