home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
sfa1.bas
< prev
next >
Wrap
BASIC Source File
|
1994-05-13
|
2KB
|
74 lines
DEFINT A-Z
CONST BPORT = &H220 'Base Port address
CONST XPORT = &H226 'Reset port address
CONST WPORT = &H22C 'Write port address
CONST RPORT = &H22A 'Read port address
CONST APORT = &H22E 'Data Available port address
DIM chgarray(79) 'change
lch0 = 0
tz0 = 0
DEF SEG = &HA000
SCREEN 13
DO
OUT WPORT, &H20 'Tell SoundBlaster you wanna read a byte.
gotit = INP(RPORT)
gg = (gotit - 128)
IF ABS(gg) > 4 THEN
chng = ABS(gotit - last)
IF chng > 39 THEN chng = 39
IF chng = 0 THEN
tz0 = tz0 + 1
lch0 = 1
ELSE
IF lch0 = 1 THEN
xx = 41 - tz0
IF xx < 0 THEN xx = 0
chgarray(xx) = chgarray(xx) + 1
tz0 = 0
lch0 = 0
ELSE
chgarray(chng + 40) = chgarray(chng + 40) + 1
END IF
END IF
END IF
at = at + 1
last = gotit
IF at = 750 THEN
at = 0
FOR r = 0 TO 79
xx = chgarray(r)
chgarray(r) = 0
IF xx > 94 THEN xx = 94
IF xx < 94 THEN
FOR rr = xx + 1 TO 94
POKE (((94 - rr) * 320) + r) * 2 + 1, &H0
NEXT
END IF
FOR rr = 0 TO xx
POKE (((94 - rr) * 320) + r) * 2 + 1, &HF
NEXT
NEXT
END IF
LOOP UNTIL INP(&H60) = 1 'esc pressed
SCREEN 0
PRINT "Realtime Frequency Analysis"
PRINT
PRINT " -based on angles from sample point to sample point"
PRINT " -ie: high frequency / high volume --> high angle"
PRINT " low frequency / low volume ----> low angle"
END