Famitone sfx, 256 bytes limit?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Famitone sfx, 256 bytes limit?
by on (#225574)
I'm starting to test more and more soundfx and now I hit a new wall. The famitracker/famitone combo is working fine but some of my sound sfx are longer then the limit imposed by famitone, which I was not aware of. When the sound sfx is played with no music then I can save it as a song and bypass that limit but when I really need it to play it at the same time as the song..

Does anybody had this issue and found a workaround about that? I tried to split the sfx in both channel and trying to play then in channel 0/1 (second parameter of sfx play function) but it didn't sound the same. I need to check the cause, maybe it's possible that way (like 1 channel fx affect the other one or something like that).
Re: Famitone sfx, 256 bytes limit?
by on (#225578)
I had this old note describing how to allow bigger effects in an e-mail to shiru from a few years ago, but I don't think he wanted to add it (haven't really investigated how famitone2 has changed since). Here's the note if it's useful to you:
Code:
3. It's only a very small modification to allow effects longer than 256 bytes:

- famitone2.s: replace 3 "iny" instructions in @read_byte / @get_data with "jsr @sfx_inc"
- famitone2.s: add "@sfx_inc" subroutine
- nsf2data.cpp: create constant for new maximum length, e.g. MAX_EFFECT_LEN
- nsf2data.cpp: use MAX_EFFECT_LEN for effect_data size
- nsf2data.cpp: use MAX_EFFECT_LEN in effect_add function
- nsf2data.cpp: use MAX_EFFECT_LEN in effect_ptr<256 test in convert_effects

@sfx_inc:
   iny
   bne @inc_done
   ; offset >= 256, need to update the pointer to keep going
   inc <FT_TEMP_PTR_H
   inc FT_SFX_PTR_H,x
@inc_done:
   rts

It's a few more cycles, of course. If you put this inline instead of a "jsr", it's really just an extra "bne" except rarely.
Re: Famitone sfx, 256 bytes limit?
by on (#225581)
Thanks for the information, that should help figure out what to do next! The fx I have issues is 274 bytes long so it just "a little bit too long". I will try to double the length and see how it goes. Separating the channels and playing at the same time didn't work so I'm just concerned if the sound fx would play nicely with the famitracker or not.

If it works fine I could share the results later. thanks again!