Sound Effects...

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
Link

Sound Effects...

Post by Link » Fri Dec 31, 2004 8:41 pm

I'm trying to get sound effects working. I write to $4000-$4003 in the routine of the B button (as it has no other functions, but shoot), the problem is that:

1)The Blaster Master NSF (the music engine playing) lets it play for a 1/60th of a sec until it instantly changes those regs making it so that the "sound effect" is hardly noticable

2. The engine changes only some of the regs $4000-$4003leaving the rest unchanged, but since I had already changed them...it messes up the square 1 channel for a sec.

Solution. I removed all accesses to $4010-$4013, + high bits of $4015 as it was causing some glitches in the songs themselves for some reason (never happenned in the NSF). So, those regs are completely unaffected by the engine. So I think I'd need to use that. I could either write values to $4011, or use the CPU DMC channel to play the sound effects.

Any thoughts/suggestions/ideas...

tepples
Posts: 22276
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Fri Dec 31, 2004 11:06 pm

Most game music engines have a way to disable writes to a particular tone generator while a sound effect is using it. You'd have to disassemble the engine to discover it.

A lot of the early NSFs with DMC drums were bad rips made before DMC was fully understood, and they don't work on a real HardNES.

Link

I'll try

Post by Link » Sat Jan 01, 2005 12:16 am

Hmmmm, I guess I'm gonna have to try this. I guess I'll just get an BM rom and see what it does for sound effects...If I can't get this working though I'll prolly have to use the DMC channel for sound effects unfortunately. thanks

Link

Sorta figured it out

Post by Link » Sat Jan 01, 2005 1:31 am

Well, I kinda figured it out. At least it works... It seems $728/9 have something to do with the sound effects witin the game so in my sound effects routine whenever theres a sound effect I load $728 with $BB and $729 with $BA, I play my sound effect in square 2, and a little after the sound effect is done playing the music engine automatically resets the ram bytes and starts playing the actual song. Well, as long as it works I'm happy.

Hmmm, now I need to get some good sound effects. I need a "shooting fireball" sound, a "getting hit with a fireball sound", and a "enemy hurting you sound." I'm gonna try to do this now, thanks for your help. :-)

Link

Problem

Post by Link » Sat Jan 01, 2005 9:58 pm

I tried changing RAM $728/9 back to 0 when the sound effect ended, but problems occurred when I did that. It seems that if I do that, some regs of $4000-$4003 remain unchanged and the sound becomes odd until the music engine "resets" those regs to the right values. I'm prolly gonna have to live with it, at least it works. I think I'm gonna keep the resetting $728/9 code, because if I let the music engine reset it, it takes like 5 seconds and that doesn't sound good at all (I can't seem to get the $728/9 disable channel thing to work with square #2, which would be great if I could...)

tepples
Posts: 22276
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Problem

Post by tepples » Sat Jan 01, 2005 10:01 pm

Link wrote:I tried changing RAM $728/9 back to 0 when the sound effect ended, but problems occurred when I did that. It seems that if I do that, some regs of $4000-$4003 remain unchanged and the sound becomes odd until the music engine "resets" those regs to the right values.
LDA #$30 STA $4000 at the end of your sound effect will fix that, no?

Link

...

Post by Link » Sun Jan 02, 2005 2:21 pm

It seems that it helps in some cases, but mostly the same glitches occur. It's really not that bad, I can live with it anyway.

When I change the values back to normal (so that the engine can use square 1 again), all the engine does after that is change the frequency, but leaves most of the other regs unchanged, so it uses the same length, volume, and such, and I think even some "bits" of the frequency of my sound effect unchenged.

The engine will reset $728/9 by itself when all of $4000-$4003 are changed back to something useful for the music, but generally it takes awhile for it to do that.

Post Reply