01 March 2022

Dissonance and Resonance

A wave function in nested loops written in BASIC on a Sinclair ZX Spectrum 48k (Fuse Emulator) showing dissonant and resonant sine waves.  


     100 REM listing
     304 LET a=25: LET h=128 : REM harmonic
     400 FOR i = 0 TO 6
     410 GO SUB 510: LET h=h-10
     420 NEXT i: GO TO 1000
     510 FOR x = 0 TO 255
     515 LET y=88+a*SIN(x/h*PI)
     520 PLOT x,y+47
     530 NEXT x: RETURN
    1000 STOP