Jump to content

SFX Engine


Recommended Posts

I would like to present a prototype of the library for SFX support (possibility of integration with RMT and CMC but also as an independent engine) http://xxl.atari.pl/sfx-engine/


here is an example of an injection into the RMT code:




below running various SFX with a few games (Alley Cat, Dropzone, Bruce Lee, Donkey Kong, etc.) - PRESS "1" for action


and an example of SFX definitions:


sfxBL1 ; death
 .HE 86 54 A2   ; rept audc
 .HE 44 A6 48 A8 4A AA
 .HE 8A 00 4A
 .HE AA 4A AA 48 A8 46 A4 42 A2 42
 .HE 00 01


sfxBL2 ; yawning
 .HE 02 B0 C2
 .HE 04 B0 C4
 .HE 03 B0 C6
 .HE 0B AA C8
 .HE 02 AA C6
 .HE 02 AA C4
 .HE 03 AD C4
 .HE 01 AD C2
 .HE 03 B0 C2
 .HE 00 01


sfxBL3 ; respawn
 .HE CE 1E A2    ; rept audf
 .HE 0F 0C 1C 10 09 19 11 06 16 13 04 12 13 03


sound_engine1.obx sound_engine-dk.obx sound_engine_df.obx sound_engine-dc.obx sound_engine.obx sound_engine-bl.obx sound_engine_dog.obx sound_engine_cat.obx

  • Like 13
  • Thanks 3
Link to comment
Share on other sites

game: Stealth - flying scout


 .HE C3 38 01  ; rep audf
 .HE 34 30 2C
 .HE C3 28 02
 .HE 24 20 1C
 .HE C3 18 03
 .HE 14 10 0C
 .HE C1 08 04
 .HE 04
 .HE C1 04 05
 .HE 08
 .HE C1 0C 04
 .HE 10
 .HE C1 14 03
 .HE 18
 .HE 01 1C 02
 .HE C1 20 01
 .HE 24
 .HE 00 01


  • Like 1
Link to comment
Share on other sites

this is not the final version yet (there will be optimization yet) - I am still looking for specific SFX that can be run on this engine.


I want to make a downloadable list on the website depending on the category.

for example all SFX from Stealth (and example definition of the energy field)


  .HE 90 0B 21
  .HE 22 22 23 23 24 24 25 27 27 26 25 24 23 22 21 21
  .HE 00 01


and here is an example from the game Joust:

in the past, SFX was somehow more ambitious

sound_engine-ST.obx sound_engine-J.obx

  • Like 2
Link to comment
Share on other sites

added loops to any position within SFX


 .HE C9 80 A5      ; pac BG2
 .HE 70 60 50 40 50 60 70 80 90
 .HE C9 80 A4 ; loop
 .HE 70 60 50 40 50 60 70 80 90
 .HE C9 80 A3
 .HE 70 60 50 40 50 60 70 80 90
 .HE 00 0C


end of data format has changed
(0, loop) or (0, FF - end)


  • Like 2
Link to comment
Share on other sites

I added two features:

xSFX_START  in:  A=sfx, X=channel, C=1 (force)
                 A=sfx, C=0 (find free channel)
            out: C=1 no free channel
                 C=0 ok
(initiates playback of a specific SFX)

xSFX_STOP   in:  X=channel
(will immediately terminate SFX on the specified channel)

what game has unusual SFX ? maybe there will be something new that is worth handling...

Edited by xxl
  • Like 1
Link to comment
Share on other sites

8 hours ago, Irgendwer said:

Telephone ring, "Hello", pseudo speech

wow! Perfect! Here it turned out that I missed in definition of REP. I don't know why I didn't notice it earlier. After correction:


line:% 10 | 11 RTIME, REPEAT, AUDF, AUDC


and now more compact versions of SFX can be defined. "Hello" is 4-channel and the "Telephone ring" is 2-channel. in addition, the "2" key interrupts SFX immediately

sound_engine-phone1.obx sound_engine-phone2.obx

  • Like 5
Link to comment
Share on other sites

I wouldn't call these "unusual", but some sound effects that I like.


Robotron 2084
Donkey Kong Jr.


World/International Karate has some good fighting sound effects. Not sure if some of them are sampled or not.


  • Like 1
Link to comment
Share on other sites

8 hours ago, xxl said:

wow! Perfect!

You're welcome. BTW: What about the "kissing" sound from "Alley Cat" and the ghost eating one from "Pac Man"?

Great SFX example would also be the "scary sound" from "Rescue on Fractalus" when a Jaggie appears or

"screen-up", "screen-down" sounds from "Whistler's Brother",

the screaming bird from "Spelunker" or the flushing toilet from "Mr. M"... ;)

...and no idea how the SFX in "(Beyond) Castle Wolfenstein" is created.

Link to comment
Share on other sites

9 hours ago, MrFish said:

World/International Karate

there are samples I think.


@Irgendwerthanks, that's it, I'll be extracting some interesting SFXs and putting them on the page with SFX_ENGINE as an example to make it easier to create your own SFX.


1 hour ago, FifthPlayer said:

The pseudo-speech in Gossip is really well done

Even on 3 channels, Gossip sounds good, it's funny that the male version differs from the female version with an additional "$20" component for AUDF :D


in this example are Gyruss, Montezuma, PacMan - swallowing fruit. Looped example - Pedro walking.
key "2" ends the current SFX


 .HE C1 0B 7D A5      ; consume fruit
 .HE 82 87 8C 91 96 9B A0 A5 AA AF B4
 .HE 06 B4 A3
 .HE C1 0B AF A3
 .HE AA A5 A0 9B 96 91 8C 87 82 7D 78
 .HE 00 FF


  • Like 2
  • Thanks 2
Link to comment
Share on other sites

another change in the data format - but necessary, thanks to it the code is shorter, the data format is more readable and there is room (6 bits) for the address table pointer, e.g. for procedures modulating values ? on the website I haven't updated to the last version yet.


in the example playing jingles - here music by J.Piscol


Link to comment
Share on other sites

to compress the amount of SFX data I introduce the JSR and JMP commands


1. TIME,AUDF,AUDC ; play
2. REPF,COUNT     ; repeat audf C0
3. REPC,COUNT     ; repeat audc 80
4. 00,LOOP        ; loop
5. 00,FF          ; end/rts
6. JSR nnnnn      ; jsr nnnnn  A+sfx no !=0
7. JMP nnnnn      ; jmp nnnnn  E+sfx no !=0

JMP allows you to jump to another SFX
JSR allows you to call SFX and after its end returns to the place where it was called - thanks to it we can create our own fast version of the music player.


sample music from Preliminary Monty Bonus Level


 .HE 09 39 AA
 .HE C0 07
 .HE 22 1D 44 2B 22 39 22
 .HE 00 FF
 .HE 09 87 AA
 .HE C0 07
 .HE 55 44 AB 72 55 87 55
 .HE 00 FF
 .HE 07 5B AC
 .HE C0 18
 .HE 36 2D 44 36 22 5B 36 2D 44 36 22 36 22 1B 2D 1B 17 36 22 1B 2D 1B 17 1B
 .HE 00 FF
 .HE 07 87 AC
 .HE C0 18
 .HE 5B 44 6B 5B 36 87 5B 44 6B 5B 36 5B 36 2D 44 2D 22 5B 36 2D 44 2D 22 44
 .HE 00 FF
 .HE 05 6B AE
 .HE C0 1C
 .HE 48 36 2B 55 36 2B 24 6B 48 36 2B 55 36 2B 24 48 2B 24 1B 36 24 1B 15 2B 24 1B 15 12
 .HE 00 FF
 .HE 05 90 AE
 .HE C0 1C
 .HE 6B 55 48 6B 55 48 36 90 6B 55 48 6B 55 48 36 55 48 36 2B 48 36 2B 24 36 2B 24 1B 15
 .HE 00 FF

 .HE A5 A7 A9 A5
 .HE 09 1D AA
 .HE C0 0B
 .HE 2B 1D 15 39 22 1D 2B 1D 1A 18 15
 .HE A7 A9
 .HE 00 FF

 .HE A6 A8 AA A6
 .HE 09 44 AA
 .HE C0 0B
 .HE 72 44 39 87 55 44 72 44 39 40 44
 .HE A8 AA
 .HE 00 FF


  • Like 2
Link to comment
Share on other sites

okay, but how to do procedural SFX? How can SFX be dependent on registry values? How to pass playback parameters from SFX?


it's simple: let's check the plugins


for example, we want our SFX to get the value from the RANDOM register for the AUDF, we don't want to pass any parameters from our SFX


.HE C1 01;
let's decode what it means:
C0 = get parameter and modify AUDF
+01 = use func1
01 = loop counter - do 01 times
and that's all :-)


this is how we define func1:
      lda $ D20A; RANDOM

; 2. REPF + FUNC, COUNT; repeat audf C0 + FUNC NO
; 3. REPC + FUNC, COUNT; repeat audc 80 + FUNC NO 


but maybe we are tied to the notation, or the editor we use writes the indexes to the value of the notes? with function we can obtain a value depending on a parameter.


what about the sound envelope? we can pass ADSR's parameters using the function as above but we'll do it in the old fashion:


we'll use the new SETENV command to turn on the envelope when playing SFX - what for? because we want to play a game melody, for example? maybe with The Goonies?


SETENV command format will change, now the envelopes are predefined but maybe the envelopes should be taken from SFX data, or defined as functions? I do not know yet.


; 8. SETENV, ENV; set env E0, nn


press "1" play, "2" stop


Link to comment
Share on other sites

Alley Cat is one of the best sfx examples… 


RoF… engine sounds, laser sounds, shields melting, window breaks, knock knock on door, stomping…


7 Cities… 


if my memories are right.. some gold coin effects? Wind blowing and water waves?


btw. Thanx XXL for doing that because sound effects are hard for us coders. In the past I had some sound effects in Basic books… but not assembly.


what about lightning and thunder?


legendary, too… Dropzone player Explosion when you got hit.

Edited by Heaven/TQA
  • Like 1
Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...