Music Playback Very Slow
Moderator: Moderators
Music Playback Very Slow
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? )
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 217 times
-
- WhatsKraken_Title_noDPCM.ftm
- (50.21 KiB) Downloaded 208 times
Re: Music Playback Very Slow
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.
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.
Re: Music Playback Very Slow
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.
Re: Music Playback Very Slow
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.
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/
But the c code for playing music is 1 line.
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 210 times
Re: Music Playback Very Slow
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.
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?
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.
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?
Re: Music Playback Very Slow
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.
To fix it, the musician just redid the song without FXX.
Re: Music Playback Very Slow
I just stumbled on the same problem. In my case it's happening when I have Fxx effects in seemingly random rows, I don't see any correlation between them. Even rows without any notes or anything will trigger the problem when I put Fxx effects on them, and I just can't figure out what these specific rows have in common. If I skip them, the remaining speed changes work normally, otherwise all speed changes are stripped out by text2data.exe and the song plays at the speed of 6, very slowly. I can only assume this is a bug in text2data, since a lot of data goes missing from the file it exports once you add a single Fxx effect to a problematic row.
Re: Music Playback Very Slow
I tested Matt's file and I'm not getting an error, as far as I can tell. The data is correct.
I have heard that Famitone doesn't handle speed of 1 very well, F01.
I have heard that Famitone doesn't handle speed of 1 very well, F01.
nesdoug.com -- blog/tutorial on programming for the NES
Re: Music Playback Very Slow
Funny. I'm not getting the same error as you. I have tested it. The data is correct. The song speed goes 1,2,1,2 for Matt's song, and 4,1,4,1 for Tokumaru's song, as expected.
(shrug) it sounds right to me.
Matt's song
$fb,$02, speed 2
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$02, speed 2
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$02 speed 2
etc
Tokumaru's song
$fb,$04, speed 4
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$04, speed 4
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$04 speed 4
etc
(shrug) it sounds right to me.
Matt's song
$fb,$02, speed 2
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$02, speed 2
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$02 speed 2
etc
Tokumaru's song
$fb,$04, speed 4
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$04, speed 4
$81, 1 row
$fb,$01, speed 1
$81, 1 row
$fb,$04 speed 4
etc
Last edited by dougeff on Tue Feb 23, 2021 10:49 pm, edited 1 time in total.
nesdoug.com -- blog/tutorial on programming for the NES
Re: Music Playback Very Slow
Are you using the original Famitone2 and conversion tool? When played back in an actual ROM it's definitely not using the Fxx data at all.
Re: Music Playback Very Slow
I used famitone 2, text2data, 4'17 build
do you have?
FT_DPCM_ENABLE = 1
because those speed effects are on the DPCM channel.
do you have?
FT_DPCM_ENABLE = 1
because those speed effects are on the DPCM channel.
nesdoug.com -- blog/tutorial on programming for the NES
Re: Music Playback Very Slow
I'm pretty sure it needs to be enabled or it won't read the stream from that channel.
perhaps the encoder, text2data, is moving the effects to channel 0 data stream... some times, but not all the time.
And the times that it DIDN'T move it, it failed because you didn't enable DPCM. (I'm guessing?)
perhaps the encoder, text2data, is moving the effects to channel 0 data stream... some times, but not all the time.
And the times that it DIDN'T move it, it failed because you didn't enable DPCM. (I'm guessing?)
nesdoug.com -- blog/tutorial on programming for the NES
Re: Music Playback Very Slow
That does make sense... I'll give it a try.
Still, if this is the case, I wonder why it doesn't move the effects in certain cases, and what was the problem in the op's case, since he didn't have the effects in the DPCM channel.