Audio frequency generator: Difference between revisions

Content added Content deleted
m (wikipedia link)
m ({{header|ZX Spectrum Basic}})
Line 19: Line 19:
Languages that provide no facilities for utilizing sound hardware of any kind should be omitted.
Languages that provide no facilities for utilizing sound hardware of any kind should be omitted.


=={{header|ZX Spectrum Basic}}==

The ZX Spectrum is not very good at making sound. Most applications in BASIC would just produce annoying beeps, and the following is no exception. To emulate the signal generator, we just produce repetative beeps using the inbuilt speaker. The left and right keys (5 and 8) change the tone. There is no volume control on the Spectrum.

<lang zxbasic>10 REM The crappest signal generator in the world
20 REM We do not check for boundary errors in this simple demo
30 LET n=1
40 LET k$=INKEY$
50 IF k$="5" THEN LET n=n-0.5
60 IF k$="8" THEN LET n=n+0.5
70 PRINT AT 0,0;n," "
80 BEEP 0.1,n: REM beep for 0.1 second at n semitones relative to middle C
90 GO TO 40</lang>


{{omit from|GUISS}}
{{omit from|GUISS}}