No Sound?

I was following the music and sfx NESMas tutorial and I ran into a problem. I put “PlaySound #sfx_laser” into my script like it said (well, more specifically they said #sfx_coin, but in my case it’s #sfx_laser), but no sound is playing. I’m inserting it at the end of my “shootProjectile” script. I also tried inserting it at the start of the scrip, but either way it doesn’t seem to work.
 

TakuikaNinja

Active member
It could be an issue with how you have SFX set up in your module. The sound engine expects instruments to use volume macros in the instrument itself instead of the volume column, and SFX are no exception. Check your text file export using this tool: https://nerdboard.nl/ftm/
For SFX, the sound engine also expects the volume macro to end with a value of 0. Otherwise, it will keep playing forever. (You could probably use this for looping SFX but typically you want one-shots.)
If you happen to be using the SFX provided by older versions of NESmaker, please use the fixed version from here instead.
 

baardbi

Well-known member
I was following the music and sfx NESMas tutorial and I ran into a problem. I put “PlaySound #sfx_laser” into my script like it said (well, more specifically they said #sfx_coin, but in my case it’s #sfx_laser), but no sound is playing. I’m inserting it at the end of my “shootProjectile” script. I also tried inserting it at the start of the scrip, but either way it doesn’t seem to work.
This is a long shot, but just to rule out the obvious... By default the Mesen (emulator) volume is set very very low. Check that sound is enabled in Mesen and adjust the volume.
 
This is a long shot, but just to rule out the obvious... By default the Mesen (emulator) volume is set very very low. Check that sound is enabled in Mesen and adjust the volume.
You're right that the master volume is low (it was at 3% for some reason?) but that didn't solve the issue
 
It could be an issue with how you have SFX set up in your module. The sound engine expects instruments to use volume macros in the instrument itself instead of the volume column, and SFX are no exception. Check your text file export using this tool: https://nerdboard.nl/ftm/
For SFX, the sound engine also expects the volume macro to end with a value of 0. Otherwise, it will keep playing forever. (You could probably use this for looping SFX but typically you want one-shots.)
If you happen to be using the SFX provided by older versions of NESmaker, please use the fixed version from here instead.
Nerdboard suggested that I use an executable script to fix the BXX issue, so I did. Then I loaded in the asm from that, and now I'm getting this error:Screenshot 2024-02-27 073705.png
Prior to fixing the file, this error did not appear. The script the error is referring to:
Code:
;;; Create a Projectile.
;;; Assumes that the projectile you want to create is in GameObject Slot 01.
    ;; We count the projectiles already on screen to see if can Shoot another one :
    CountObjects #%00000100, #$00   ;; count player weapon on screen  ;; the variable used to count is monsterCounter
    CLC
    CMP #$01        ;; compare to 2
    BCC +canShoot           ;; if less than 2 on screen we can create a projectile
    RTS         ;; else we quit   
    +canShoot
    ;; else, the script continues:
    PlaySound #sfx_laser
TXA
PHA
TYA
PHA
LDX player1_object
LDA Object_x_hi,x ; get player x coord
STA tempA
LDA Object_y_hi,x; get player y coord
STA tempB

LDA Object_screen,x
STA tempC
CreateObjectOnScreen tempA, tempB, #$03, #$00, tempC
;;; x, y, object, starting action.
;;; and now with that object, copy the player's
;;; direction and start it moving that way.

PLA
TAY
PLA
TAX

RTS
 

kevin81

Well-known member
NESmaker and ft_txt_to_asm use different prefixes for the exported sound/sfx constants. There are two things you can do to fix this (pick one):

1) Change PlaySound #sfx_laser to PlaySound #sfx_index_sfx_laser, or:
2) Open the exported .asm file and replace all constant instances of song_index_ with song_, and sfx_index_sfx_ with sfx_.
 
NESmaker and ft_txt_to_asm use different prefixes for the exported sound/sfx constants. There are two things you can do to fix this (pick one):

1) Change PlaySound #sfx_laser to PlaySound #sfx_index_sfx_laser, or:
2) Open the exported .asm file and replace all constant instances of song_index_ with song_, and sfx_index_sfx_ with sfx_.
Now it plays the sound and immediately crashes while endlessly playing the end of the sound effect.
 
Now it plays the sound and immediately crashes while endlessly playing the end of the sound effect.
Also testing it now, multiple shots get fired before it crashes, and for some reason, each shot sounds different. It crashes once I die and none of the shots sound like they should. And the sound will only play when the enemy fires the projectile. For some reason nothing plays when the player does it.

Worth noting as well that I'm using Famistudio to make the sound effects, and not Famitracker, because Famistudio was what they recommended in the tutorials (although the tutorials themselves use Famitracker). Could that be causing some issues?
 

kevin81

Well-known member
Oh hold on... You're using Bxx on a sound effect? That sounds like trouble =] I'd suggest removing all Bxx's from the sfx_laser effect. Also, make sure to give the instrument a volume envelope value, even if it's 15; if it's empty, the sound may not play in the ROM.

Unfortunately I'm not familiar with Famistudio, so if that somehow is the cause (which I don't really suspect though), I hope someone else can chime in here.
 
Oh hold on... You're using Bxx on a sound effect? That sounds like trouble =] I'd suggest removing all Bxx's from the sfx_laser effect. Also, make sure to give the instrument a volume envelope value, even if it's 15; if it's empty, the sound may not play in the ROM.

Unfortunately I'm not familiar with Famistudio, so if that somehow is the cause (which I don't really suspect though), I hope someone else can chime in here.
I don’t even know what Bxx is, but it claims I’m using that. Famistudio didn’t make that clear, so if that is the issue I’d have no idea how to fix it. As for the volume envelope, it is at 15.
 
Oh hold on... You're using Bxx on a sound effect? That sounds like trouble =] I'd suggest removing all Bxx's from the sfx_laser effect. Also, make sure to give the instrument a volume envelope value, even if it's 15; if it's empty, the sound may not play in the ROM.

Unfortunately I'm not familiar with Famistudio, so if that somehow is the cause (which I don't really suspect though), I hope someone else can chime in here.
Screenshot 2024-02-27 121116.png
Would the Bxx effect refer to these "B00" values? If so, getting rid of them didn't change anything.
 

TakuikaNinja

Active member
Oh, I would not recommend using FamiStudio for this since it makes many assumptions regarding song data. These assumptions are fine for its normal use cases but not in this context (at least, not without a lot of external editing). The sound engine is geared towards FamiTracker's workflow. I know the tracker interface looks intimidating but you'll realise how intuitive it can be once you learn it. There are plenty of tutorials for it on YouTube, and there is a guide by CutterCross for creating compatible music and SFX (in fact, the FTM checker is based on it).
 
Oh, I would not recommend using FamiStudio for this since it makes many assumptions regarding song data. These assumptions are fine for its normal use cases but not in this context (at least, not without a lot of external editing). The sound engine is geared towards FamiTracker's workflow. I know the tracker interface looks intimidating but you'll realise how intuitive it can be once you learn it. There are plenty of tutorials for it on YouTube, and there is a guide by CutterCross for creating compatible music and SFX (in fact, the FTM checker is based on it).
My main issue with Famitracker is just the interface. I’m more of a visual kinda guy. Hard to imagine how something sounds just looking at a row of numbers and letters, you know? I saw it does have support for using a keyboard, but I don’t have one. I’ll check out the tutorials though. I could probably make it work with some practice.
 
Oh, I would not recommend using FamiStudio for this since it makes many assumptions regarding song data. These assumptions are fine for its normal use cases but not in this context (at least, not without a lot of external editing). The sound engine is geared towards FamiTracker's workflow. I know the tracker interface looks intimidating but you'll realise how intuitive it can be once you learn it. There are plenty of tutorials for it on YouTube, and there is a guide by CutterCross for creating compatible music and SFX (in fact, the FTM checker is based on it).
It seems that even after making it in Famitracker and using Nerdboard to assure there weren't any problems, I'm still getting the bug. Here's a video showing the issue, in case it makes any difference.

Project Eruca Sound Bug

Also worth noting that it still does not play at all when fired by the player, despite the code being in the input script as well.
 
I've come a lot closer to figuring this out. Been talking to someone on the Facebook group. I got it to play for the player, but I noticed something else. The ship is playing the wrong sound. In my file, I added a new sound effect, sfx_explode, for future use. Then I noticed that the enemy projectile plays the "sfx_laser" sfx when it fires, but would occasionally play sfx_explode for some reason. I talked to someone in the Facebook group about this, and he gave me a set of sounds to play with. His sound pack has an extra sound, and that's when I noticed the pattern. sfx_laser is the first on the sfx list. sfx_explode is the second. When there is already an enemy projectile on the screen, the sfx_explode will play upon firing a second projectile. If there are two already on the screen, it will instead play the third sfx in the row. If there are three already on the screen, it will play the fourth, etc. It will only play sfx_laser if there are no enemy projectiles on screen at the time. So clearly, something is wrong in my scripts, and I wonder if the culprit might actually be the PlaySound macro.
 
Top Bottom