Sound waves

Post Reply
DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Sound waves

Post by DrChip »

REM Sound wave extended v2
REM The formula from Cal-Tech's site!
REM v2 - added detail
REM iPhone 6 plus / 8.3 b1
REM by my son Digit

graphics
'screen offset
xoffset=20
yoffset=20

'size and detail of the wave
detail = 5 '2, 5, 10, 20 20=faster

'Wave source coordetanes
x1=180 'fist wave
y1=300
x2=30 'second wave
y2=30
FOR n = 1 TO 100 STEP .2
'refresh off
'graphics clear 0,0,0

FOR x = xoffset TO 300 STEP detail
FOR y = yoffset TO 300 STEP detail
d1 = ((x-x1)^2+(y-y1)^2)^0.5
d2 = ((x-x2)^2+(y-y2)^2)^0.5
s1=60*SIN(d1/5-n)
s2=60*SIN(d2/5-n)
IF 5*n>=d2 THEN
fill COLOR (122+s2)/255,(122+s2)/255,(122+s2)/255
ELSE
fill COLOR (122+s1)/255,(122+s1)/255,(122+s1)/255
END IF
IF 5*n>=d1 AND 5*n>=d2 THEN
fill COLOR (122+s1+s2)/255, (122+s1+s2)/255,(122+s1+s2)/255
END IF
IF 5*n<=d1 AND 5*n<=d2 THEN
fill COLOR .5,.5,.5
END IF
fill rect x,y size detail-1
NEXT y
NEXT x
'refresh on
NEXT n
Attachments
image.jpg
image.jpg (179.53 KiB) Viewed 1878 times
image.jpg
image.jpg (107.84 KiB) Viewed 1878 times

Post Reply