Famitracker, spike in performance on a specific frame change

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Famitracker, spike in performance on a specific frame change

Post by Banshaku » Sun Aug 16, 2020 3:06 am

It may be too specific a question but who knows, maybe someone had this problem before.

There is one song I'm using in a project and all frames are fine "except" one that once it change to it, create a huge spike in usage and cause the mid-frame chr-bank switching to be affected and glitch (just happens to be at the exact same timing).

I will have to check in the driver code what exactly is happening at that time to create such a spike but I'm asking, just in case, if someone had a similar issue before. Since I didn't make the song I need to check which effects were used but I know the speed start to change and get faster there. If it was the frame change it would glitch on all frame but only this one for some reason. Maybe spreading the effects someone may help it once I figure out the cause.

edit:

I did some test and changing the timing of the FXX makes it less intensive so I may have an idea how to make it work. Still, I'm surprised that it get in the way for he scanline counter. Why is that so? I would have though that it is independant of the rest of the code. The spike in processing from the sound driver affects it.

calima
Posts: 1186
Joined: Tue Oct 06, 2015 10:16 am

Re: Famitracker, spike in performance on a specific frame change

Post by calima » Sun Aug 16, 2020 11:23 am

I think only one music engine is constant time, most are not. So varying time is to be expected.

User avatar
Dwedit
Posts: 4351
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Famitracker, spike in performance on a specific frame change

Post by Dwedit » Sun Aug 16, 2020 4:02 pm

Indeed, music engine code doesn't run in the same amount of time every frame. So if you have to synchronize a raster effect by timed code or a sprite 0 hit, run the music code afterwards, not before it.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Famitracker, spike in performance on a specific frame change

Post by Banshaku » Sun Aug 16, 2020 5:57 pm

I see.

For now the engine is run at the end of vblank and I never had issues until now. Since the song is not that intensive, I tested if spreading the some of the effects would reduce the impact (even 1 frame to see how it goes) and the test worked. Since the change in speed seems to be the one that cause the most impact, by playing a few frames that were at F06 at F03, I will be able to reduce the impact. Later it stays at F03 all the time so the issue should rarely happens.

This means from your comments that if the game was really raster intensive then it would need to play the music at the end of the frame/rasters then?

calima
Posts: 1186
Joined: Tue Oct 06, 2015 10:16 am

Re: Famitracker, spike in performance on a specific frame change

Post by calima » Mon Aug 17, 2020 12:00 am

Yes, or use a more efficient music engine.

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Famitracker, spike in performance on a specific frame change

Post by Banshaku » Mon Aug 17, 2020 5:28 pm

calima wrote:
Mon Aug 17, 2020 12:00 am
Yes, or use a more efficient music engine.
For now, since I found a workaround for the issue, that will be a good compromise since I don't think I can make a new sound driver until I understand more on the subject :lol: The only reason I use famitracker/famitone sfx combo is because of the song was originaly made in famitracker without imposing any limitation to make it work in famitone.

Still, there is not many sound driver just:
- famitracker/famitone sfx
- famitone
- pently
- gsound
- Bleubleu one, soon I guess? (sfx possible?)
- ? (maybe a few that I forget?)

User avatar
bleubleu
Posts: 99
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Famitracker, spike in performance on a specific frame change

Post by bleubleu » Mon Aug 17, 2020 7:04 pm

Banshaku wrote:
Mon Aug 17, 2020 5:28 pm
Still, there is not many sound driver just:
- famitracker/famitone sfx
- famitone
- pently
- gsound
- Bleubleu one, soon I guess? (sfx possible?)
- ? (maybe a few that I forget?)
That's also pretty much all the ones i know of too.

The wiki mentions the one Brad did for Lizard and another one called Muse which seems to be a musetracker sound engine.

-Mat

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Famitracker, spike in performance on a specific frame change

Post by Banshaku » Mon Aug 17, 2020 7:35 pm

bleubleu wrote:
Mon Aug 17, 2020 7:04 pm

That's also pretty much all the ones i know of too.

The wiki mentions the one Brad did for Lizard and another one called Muse which seems to be a musetracker sound engine.

-Mat
There may be another one by the dev that made Rollie (Optomon) but I could be mixing things.

@bleubleu

Will your driver support sfx and is there a way to import famitracker songs to some degree in it? How is performance?

User avatar
bleubleu
Posts: 99
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Famitracker, spike in performance on a specific frame change

Post by bleubleu » Mon Aug 17, 2020 7:48 pm

Yes.

The FamiStudio sound endine is a FamiTone2 derivative, so it will use the exact same SFX architecture as the original one (I did a lot of work on the music part, nothing on the SFX part). You can play SFX for all 4 main channels, and have up to 4 streams (more streams = more RAM needed). Mixing with the music is based on the current volume of each channel, louder wins. You can also play DPCM samples as SFX, these will always take precedence over the music ones.

You can already open FamiTracker FTM and TXT files in FamiStudio.

Performance will depend on how many "features" you enable. You can toggle a few features such as : audio expansions, slide notes, arpeggios, vibrato effect, volume tracks, pitch tracks, DPCM, SFX, etc.

At its most basic level (most feature turned off), if should be similar to FamiTone2, probably a few cycles more since it will support more stuff out of the box: all 96 notes, duty cycle envelopes, release points on volume envelopes, relative pitch envelopes, etc.

I'll be happy to work with you to optimize stuff if you want to try it when it comes out!

-Mat

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Famitracker, spike in performance on a specific frame change

Post by Banshaku » Mon Aug 17, 2020 9:41 pm

bleubleu wrote:
Mon Aug 17, 2020 7:48 pm
You can already open FamiTracker FTM and TXT files in FamiStudio.
Good to hear. Does it warn you if you uses options not supported by the driver?
bleubleu wrote:
Mon Aug 17, 2020 7:48 pm
I'll be happy to work with you to optimize stuff if you want to try it when it comes out!
For now I'm porting old C code to asm and found a solution for my performance issue so I may not test it now but eventually wants to try it to see if I can make music with it (I'm not much a musician so a tracker is what I got used to get by. The piano roll scares me ^-^;;).

User avatar
bleubleu
Posts: 99
Joined: Wed Apr 04, 2018 7:29 pm
Location: Montreal, Canada

Re: Famitracker, spike in performance on a specific frame change

Post by bleubleu » Tue Aug 18, 2020 2:21 am

Banshaku wrote:
Mon Aug 17, 2020 9:41 pm
Good to hear. Does it warn you if you uses options not supported by the driver?
The FamiStudio sound engine supports 100% of the feature FamiStudio supports. The driver evolved with the app over the last year. I always needed it for the NSF and ROM export anyway.

But your question might mean something else. If you are referring to the import from FamiTracker, not every FamiTracker feature translate 1:1 to FamiStudio. Some (actually most) effects are straight up ignored. The current version is very bad at giving feedback about these, so your only resource is the documentation for the list of supported features:

https://famistudio.org/doc/importexport ... -or-binary

The upcoming version will tell you what didn't import correctly from the FTM so you will know at least *why* your song sounds different and you will have a better idea on how to adapt it.

That being said, because a feature from an FTM does not import does not mean that you cant achieve the same sound in FamiStudio. Its just that some of the approaches I take are just too different from the tracker paradigm so there is just no way to import and get a nice result.

FTM import + manual fixes is definitely a nice way to do the initial conversion of your song, but once you are in the Famitudio ecosystem, I would stay there because going back/forth between the apps will lead to degradation of your songs and you will end up with just begin able to use the intersection of both feature sets.

-Mat

User avatar
Banshaku
Posts: 2393
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Famitracker, spike in performance on a specific frame change

Post by Banshaku » Tue Aug 18, 2020 9:09 pm

bleubleu wrote:
Tue Aug 18, 2020 2:21 am

But your question might mean something else. If you are referring to the import from FamiTracker, not every FamiTracker feature translate 1:1 to FamiStudio. Some (actually most) effects are straight up ignored. The current version is very bad at giving feedback about these, so your only resource is the documentation for the list of supported features:
Yes, I meant regarding what kind of feedback the importer give. Since often I'm not the one that made the song, it's hard for me to say "hey, it's this part failing based on the doc, that's why!". I would figure out after a while but not as easily than the one that made the song. So I need to take that into consideration that I may not have feedback about what failed to import and need to check the doc about it.
bleubleu wrote:
Tue Aug 18, 2020 2:21 am
The upcoming version will tell you what didn't import correctly from the FTM so you will know at least *why* your song sounds different and you will have a better idea on how to adapt it.
Yes, I think this is an important feature since a lot of people will come from famitracker.
bleubleu wrote:
Tue Aug 18, 2020 2:21 am
FTM import + manual fixes is definitely a nice way to do the initial conversion of your song, but once you are in the Famitudio ecosystem, I would stay there because going back/forth between the apps will lead to degradation of your songs and you will end up with just begin able to use the intersection of both feature sets.
I was not expecting to go back and forth either, usually that's a bad idea anyway :lol:

Post Reply