SOUND Statement

Purpose:

To generate sound through the speaker.

Syntax:

SOUND freq,duration

Comments:

freq is the desired frequency in Hertz (cycles per second). freq is a numeric expression within the range of 37 to 32767.

duration is the desired duration in clock ticks. Clock ticks occur 18.2 times per second. duration must be a numeric expression within the range of 0 to 65535.

Values below .022 produce an infinite sound until the next SOUND or PLAY statement is executed.

If duration is zero, any active SOUND statement is turned off. If no SOUND statement is running, a duration of zero has no effect.

The sound is executed in foreground or background depending on the PLAY statement.

Examples:

The following example creates random sounds of short duration:

2500 SOUND RND*1000+37, 2
2600 GOTO 2500

The following table shows the relationship of notes and their frequencies in the two octaves adjacent to middle C.

Table 5

Relationships of Notes and Frequencies

Note Frequency   Note Frequency
C130.810 C*523.250
D146.830 D587.330
E164.810 E659.260
F174.610 F698.460
G196.000 G783.990
A220.000 A880.000
B246.940 B987.770
C261.630 C1046.500
D293.660 D1174.700
E329.630 E1318.500
F349.230 F1396.900
G392.000 G1568.000
A440.000 A1760.000
B493.880 B1975.500

*Middle C.

By doubling or halving the frequency, the coinciding note values can be estimated for the preceding and following octaves.

To produce periods of silence, use the following statement:

SOUND 32767, duration

To calculate the duration of one beat, divide beats per minute into the number of clock ticks in a minute (1092).

The following table illustrates tempos requested by clock ticks:

Table 6

Tempos Requested by Clock Ticks

Tempo Notation Beats/ Minute Ticks/Beat
very slowLarghissimo   
Largo40-6627.3-18.2
Larghetto60-6618.2-16.55
Grave   
Lento   
Adagio66-7616.55-14.37
slowAdagietto   
Andante76-10814.37-10.11
mediumAndantino   
Moderato108-12010.11-9.1
fastAllegretto   
Allegro120-1689.1-6.5
Vivace   
Veloce   
Presto168-2086.5-5.25
very fastPrestissimo