IGNORED

# Sound is a hard thing.

## Recommended Posts

I'm not afraid to admit that sound is not my speciality, infact I find it hard to deal with adding sound elements to a game sometimes.

Anyway, I'm having an issue I can't resolve on my own. The idea is that when the joy0fire button is pressed there would be short bleep sound, but it never ends, what did I do wrong?

```   if !joy0fire then _Bit1_FireB_Restrainer{1} = 0 : goto __Skip_Fire

if _Bit1_FireB_Restrainer{1} then goto __Skip_Fire

_Bit1_FireB_Restrainer{1} = 1

_Bit0_Player0_Sword{0} = 0

if joy0fire then _Bit0_Player0_Sword{0} = 1

if _Bit0_Player0_Sword{0} && q=0 then player0x=player0x+1 : a=a+1 : player1x=player1x+1 : m=1

__Skip_Fire

if !joy1fire then _Bit3_FireB1_Restrainer{1} = 0 : goto __Skip_Fire2

if _Bit3_FireB1_Restrainer{1} then goto __Skip_Fire2

_Bit3_FireB1_Restrainer{1} = 1

_Bit2_Player1_Sword{0} = 0

if joy1fire then _Bit2_Player1_Sword{0} = 1

if _Bit2_Player1_Sword{0} && z=0 then player0x=player0x-1 : b=b+1 : player1x=player1x-1 : n=1

__Skip_Fire2

if m>0 then o=o+1
if n>0 then o=o+1
if o>0 && o<30 then AUDV1 = 10 : AUDC1 = 12 : AUDF1 = 12
if o=0 then AUDV1=0
if o=30 then AUDV1=0
if o=30 then o=0 ; m=0

```
Edited by Captain Spazer
##### Share on other sites

have you tried my sound effect driver?

##### Share on other sites

The last line of the code seems wrong.

`if o=30 then o=0 ; m=0`

Perhaps if you changed the semicolon to a colon?

##### Share on other sites

Sound has become pretty simple with my technique here:

The smallest sound system I've come up with is something like this: I use two variables "sounda" and "soundb". The length of time a sound is played is represented by the current value of the variable. The sound changes with the variable value as well so longer playing sounds will be different from shorter ones. If a sound is decremented down to zero I kill the volume.

```main
if sounda > 0 then sounda = sounda - 1 : AUDC0 = 8 : AUDV0 = 4 : AUDF0 = sounda else AUDV0 = 0
if soundb > 0 then soundb = soundb - 1 : AUDC1 = 2 : AUDV1 = 4 : AUDF1 = soundb else AUDV1 = 0```

The only thing that takes times is experimenting with AUDCx, AUDFx and duration values.

UPDATE: I just realized I keep posting this code snippet with no response. So, I made a more demonstrative topic here:

http://atariage.com/forums/topic/260179-very-simple-sound-engine-with-example/

##### Share on other sites

Thanks guys, you where an enormous help, I got it working =)

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.