I'm using nesdoug's FamiTone4.1 (https://github.com/nesdoug/famitone4.1) with asm6 and having weird problems with the music I'm exporting from FamiTracker 0.4.6. In my project file I had multiple songs. When I loaded the second song in my game after playing the first (for the title screen), there was a weird issue where it sounded like the Pulse 2 and Triangle channels were slightly offset from the Pulse 1, creating an "off-beat" effect which I hadn't written.
I thought that perhaps I had some error in one of the songs in my project which was causing my second song to load improperly. So I deleted all of the songs in the project except for the first two to try to create a minimum-size sample—the first one, which had loaded correctly, and the second one, which was exhibiting the off-beat effect. Then when I load the second song, it doesn't even play the second song, just a long tone.
But, if I load the second song first, it plays properly, with no glitches or off-beat effects. This seems to imply that there's a problem with how I'm loading, playing, and stopping the songs, correct?
My engine logic is in my NMI thread. I start playing a song by calling "FamiToneMusicPlay" in a "draw new screen" routine that's called during NMI. Then, on the next NMI, at the end of NMI, I call "FamiToneUpdate."
If the user presses a button that indicates to my engine that we need to switch to a different game state, I call "FamiToneMusicStop." Once I call FamiToneMusicPlay, do I need to call FamiToneUpdate in that same NMI?
If my NMI is too long so I'm getting another NMI called partway through, how can I tell? I'm using Mesen. There is only very minimal logic being called when I'm playing music, so I don't think I'm running out of NMI cycles, but who knows.
Neither of these two songs are using any effects. The only envelope used by the instruments is the "volume" envelope. And these two songs only use the Pulse 1, Pulse 2, and Triangle channels.
I've confirmed that the memory page is initialized to zero; on the forums, someone said they had issues if the memory wasn't initialized to zero.
The usage notes for FamiTone4.1 say "use volume column for Square 1, Square 2, and Noise Channels." Perhaps this means that the volume envelope isn't supported and I should only use the volume column?
My cut-down FamiTracker project is attached. Thanks!
FamiTone4.1 song glitches if played after other song, if played first sounds fine?
Moderator: Moderators
FamiTone4.1 song glitches if played after other song, if played first sounds fine?
- Attachments
-
audio_data_test.ftm
- (6.39 KiB) Downloaded 35 times
Re: FamiTone4.1 song glitches if played after other song, if played first sounds fine?
So I looked at the demo source code for the original FamiTone2 v.1.15 (there's no demo source code for FamiTone4.1). Interestingly, even though the README says that we only need to call "FamiToneInit" once, the demo source code calls it every single time before playing a song.
I tried this, adding FamiToneInit calls before my FamiToneMusicPlay calls, and that seems to fix the issue with the second song. I wonder if I'm misreading the documentation, or there's some other "best practices" way I'm supposed to do this, but it is at least now playing correctly.
I tried this, adding FamiToneInit calls before my FamiToneMusicPlay calls, and that seems to fix the issue with the second song. I wonder if I'm misreading the documentation, or there's some other "best practices" way I'm supposed to do this, but it is at least now playing correctly.
Re: FamiTone4.1 song glitches if played after other song, if played first sounds fine?
Your songs work fine on my machine.
You can (and should) have 1 entry in the Duty Cycle Envolope for Instruments for Pulse 1+2 and Noise Channels.
Famitone 4.1 supports Volume, Arpeggio, and Pitch Envelopes. Pitch can't bend more than -64 to 63 from the base note.The usage notes for FamiTone4.1 say "use volume column for Square 1, Square 2, and Noise Channels." Perhaps this means that the volume envelope isn't supported and I should only use the volume column?
You can (and should) have 1 entry in the Duty Cycle Envolope for Instruments for Pulse 1+2 and Noise Channels.
nesdoug.com -- blog/tutorial on programming for the NES
Re: FamiTone4.1 song glitches if played after other song, if played first sounds fine?
Thanks dougeff! So if I'm understanding you and http://famitracker.com/wiki/index.php?title=Duty_cycle correctly, I should set a Vxx effect for those three channels for every song?dougeff wrote: ↑Sun Jul 19, 2020 8:21 pmYour songs work fine on my machine.
Famitone 4.1 supports Volume, Arpeggio, and Pitch Envelopes. Pitch can't bend more than -64 to 63 from the base note.The usage notes for FamiTone4.1 say "use volume column for Square 1, Square 2, and Noise Channels." Perhaps this means that the volume envelope isn't supported and I should only use the volume column?
You can (and should) have 1 entry in the Duty Cycle Envolope for Instruments for Pulse 1+2 and Noise Channels.
Re: FamiTone4.1 song glitches if played after other song, if played first sounds fine?
No.
When you click on an instrument, a box pops up. The bottom one is Duty Cycle. Click that, and create an envelope with one entry.
When you click on an instrument, a box pops up. The bottom one is Duty Cycle. Click that, and create an envelope with one entry.
nesdoug.com -- blog/tutorial on programming for the NES
Re: FamiTone4.1 song glitches if played after other song, if played first sounds fine?
That's what I get for not being at my computer and just responding from memory as to the options available in the instrument editor.

I see a "Duty / Noise" envelope in FamiTracker 0.4.6; I presume this is what you're referring to, as the instruments FamiTracker page confirms that it "Sets the duty cycle and noise mode."