Playing custom sounds in battle animations

  • Starting with a clean FE8 rom, I insert the debug animation in place of Eirika, with S00E7 (the code for the brigand war cry) inserted into Mode 1. I open the rom and test it, sure enough the sound plays with no issues.

  • Next, I use Sappy 2006 Mod 17.1 to import a WAV file to the documented free space at 0x0B30000-0x0B3683F. I use HxD to insert a single-instrument map at 0x0B36850 that points to the WAV (00 C0 00 00 00 00 B3 08 FF 00 FF 00).

  • I use Anvil Studio to make sfx.mid, a one second long single note Midi using Instrument 0 playing note C3, export as Midi-0 and use Mid2GBA to convert it to sfx.s.

  • At this point I test the ROM again, and the brigand war cry is still working.

  • Back in Sappy I go to Song 231 (brigand war cry) and choose Assemble Song, using 0x0B36900 as the base offset and using the instrument map I put in earlier. I leave the Song Group options at 6 and 6 (pretty sure this means it’s priority 6). Now I click play on Song 231 in Sappy and I hear my WAV sound.

  • BUT when I go in game, the sound does not play. Nothing else breaks, just the sound won’t play.

  • Back in Sappy I try replacing Song 1 with the sound effect as well. In game, I go to the Sound Room and play the song, and sure enough the sound effect plays perfectly. I go into battle, and the sound fails to play.

i dont know what is happening pls to help

EDIT: I added one more step:

  • Reload the script and reinsert the animation using Feditor Adv (Render Edition, forgot to specify earlier)

  • Now the sound plays - sometimes. About half the time it still won’t work.

Could you post the contents of SFX.s by opening it in a text editor and then pasting it here?

Sure:

	.include "MPlayDef.s"

	.equ	sfx_grp, voicegroup000
	.equ	sfx_pri, 0
	.equ	sfx_rev, 0
	.equ	sfx_mvl, 127
	.equ	sfx_key, 0
	.equ	sfx_tbs, 1
	.equ	sfx_exg, 0
	.equ	sfx_cmp, 1

	.section .rodata
	.global	sfx
	.align	2

@**************** Track 1 (Midi-Chn.1) ****************@

sfx_1:
	.byte		VOL   , 127*sfx_mvl/mxv
	.byte	KEYSH , sfx_key+0
@ 000   ----------------------------------------
	.byte	TEMPO , 60*sfx_tbs/2
	.byte		VOICE , 0
	.byte		N24   , Cn3 , v064
	.byte	W24
	.byte	FINE

@******************************************************@
	.align	2

sfx:
	.byte	1	@ NumTrks
	.byte	0	@ NumBlks
	.byte	sfx_pri	@ Priority
	.byte	sfx_rev	@ Reverb.

	.word	sfx_grp

	.word	sfx_1

	.end

Your method is correct - the only possible problem I can think of is the song group (which has been mislabelled by the creator of the modules as priority). Likely another sound effect being used also plays on group 6 so try changing it to 2, 3, 4, 5 or 7. Sound effects have a buffer/debuffer time, so to speak, so if for example a footstep was being played through group 6 it needs some time to clear that space in the memory, which may explain why your sound effect only works occasionally and always in isolation.

As I said previously, the 6 doesn’t denote priority, but rather designates a certain area in the memory for the song details to be placed. If you examine various in-game sounds you will find they have different song groups - IS has strategically placed each sound effect in a song group such that no sound effect from the same group plays at the same time, or closely in succession.

Well, this seems to be part of the solution. Changing it from 6 to 5 makes it play more often than not, though it still occasionally fails. I did find another piece of the puzzle - the sound plays if I turn off the ingame music.

What I don’t get is why the brigand yell worked every time, even though it was also group 6.

Yeah, I can’t tell you why that happens, I’m not too sure myself.

Nonetheless, can you give this patch a try and see if it solves your problem?

Is there an FE8 version? I couldn’t find one, but I went to $2900 and changed it to 0C E0 and it seems to be working. Is that going to cause problems with the RAM or something?

It definitely shouldn’t - the RAM issues are specific to part of the hack that lets you play more tracks (which isn’t happening at the moment). So it’s been solved, then? :smiley:

Looks like it! Thanks for the help!