Music Playback Very Slow

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

Moderator: Moderators

Post Reply
User avatar
Goose2k
Posts: 96
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Music Playback Very Slow

Post by Goose2k » Mon Jun 01, 2020 9:54 pm

Hi,

I'm pretty new to NES development, and even more so NES Music.

I am making an NES game in C using neslib, with music playback via famitone2.

The musician I am working with has sent me a music track which, when played in famitracker or exported as an nsf, sounds totally fine. However, when I export it for playback in game, it plays very very slow (like 25% slower maybe).

I suspect it might have something to do with all the tempo fx being applied (1 every beat), because when I remove all of them the song plays back fine (although now the tempo is right, but it sounds the same as famitracker).

However, if I apply the same tempo fx so another same song I have, it works fine in that case, so there must be something additional to this file that I am not catching.

Any suggestions on how to debug this further?

Note: The tempo fx are on the otherwise unused DPCM channel, but I originally suspected that channel might be the problem and transfered all the fx to the Pulse 1 channel, but the issue happens there too.

I've attached both the famitracker file, and rom.

(Aso: Is this the right forum for this kind of question, or should it go in the nes dev forum? )
Attachments
main.nes
(40.02 KiB) Downloaded 19 times
WhatsKraken_Title_noDPCM.ftm
(50.21 KiB) Downloaded 20 times

User avatar
Gilbert
Posts: 384
Joined: Sun Dec 12, 2010 10:27 pm
Location: Hong Kong
Contact:

Re: Music Playback Very Slow

Post by Gilbert » Mon Jun 01, 2020 10:14 pm

Haven't checked the ROM, but maybe somehow your game is run in 50Hz PAL mode (like because of header settings) so the music are slower?

Edit:
Hmmm Nestopia reported that it's NTSC. Don't know about it then.
Last edited by Gilbert on Mon Jun 01, 2020 10:17 pm, edited 1 time in total.

lidnariq
Posts: 9500
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Music Playback Very Slow

Post by lidnariq » Mon Jun 01, 2020 10:17 pm

Without debugging symbols, this is a bit harder, but it tentatively seems like the playback engine is never successfully changing the "speed" from the default of 6, instead of the very fast (1 or 2) that the FTM indicates.

User avatar
Goose2k
Posts: 96
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Re: Music Playback Very Slow

Post by Goose2k » Mon Jun 01, 2020 10:22 pm

One thing to keep in mind is that other music plays back fine in the exact same game (just swapping out the exported music .s file). So I think it is something unique about this particular song (although possibly just exposing a bug in my code the other song did not).

But the c code for playing music is 1 line. :D

I've attached the whole game if you feel like looking any deeper.

The source is on git hub too: https://github.com/mhughson/mbh-firstnes/
Attachments
game.zip
(152.83 KiB) Downloaded 21 times

User avatar
Goose2k
Posts: 96
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Re: Music Playback Very Slow

Post by Goose2k » Mon Jun 01, 2020 11:08 pm

After reducing this song down to just 1 frame of music, I think I have narrowed down the issue.

The issue appears to occur whenever there is a note played on all 4 channels, and at the same time a tempo fx is applied.

music_broken_line.png

I suspect this is a bug in famitone2, since this plays fine in NSF format. Does anyone know if anyone maintains the library anymore? Perhaps there is already a fix out there?

music_works_no_overlap.png

User avatar
Goose2k
Posts: 96
Joined: Wed Dec 11, 2019 9:38 pm
Contact:

Re: Music Playback Very Slow

Post by Goose2k » Wed Jun 03, 2020 8:56 pm

Just in case anyone stumbles on this hoping to find a solution, the solution I posted above did not actually fix the issue. I mean it did for a very small example song, but when I applied the solution to a full song, it still played back very slow.

To fix it, the musician just redid the song without FXX. :oops:

Post Reply