Famitone sfx, 256 bytes limit?

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

Moderator: Moderators

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

Famitone sfx, 256 bytes limit?

Post by Banshaku » Mon Sep 10, 2018 10:50 pm

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).

User avatar
rainwarrior
Posts: 7717
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Famitone sfx, 256 bytes limit?

Post by rainwarrior » Tue Sep 11, 2018 12:43 am

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: Select all

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.

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

Re: Famitone sfx, 256 bytes limit?

Post by Banshaku » Tue Sep 11, 2018 1:59 am

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!

Post Reply