Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The sound effect thread
#3
I use this white noise one all the time...


Code:
SUB noise ()
asm

noise:    ld e,250          ; repeat 250 times.
        ld hl,0            ; start pointer in ROM.
noise2:    push de
        ld b,32          ; length of step.
noise0:     push bc
        ld a,(hl)       ; next "random" number.
        inc hl          ; pointer.
        and 248          ; we want a black border.
        out (254),a        ; write to speaker.
        ld a,e           ; as e gets smaller...
        cpl                ; ...we increase the delay.
noise1:    dec a              ; decrement loop counter.
        jr nz,noise1       ; delay loop.
        pop bc
        djnz noise0       ; next step.
        pop de
        ld a,e
        sub 24          ; size of step.
        cp 30             ; end of range.
        ret z
        ret c
        ld e,a
        cpl
noise3:    ld b,40            ; silent period.
noise4:    djnz noise4
        dec a
        jr nz,noise3
        jr noise2

ret       
end asm
END SUB
Reply


Messages In This Thread
The sound effect thread - by worcestersource - 02-19-2022, 12:03 AM
RE: The sound effect thread - by boriel - 02-19-2022, 11:31 AM
RE: The sound effect thread - by Jbizzel - 02-20-2022, 09:42 PM
RE: The sound effect thread - by worcestersource - 02-23-2022, 02:22 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)