BEEP
Format: var = BEEP (X,Y, Z)
Supported by: Telmac SBASIC v 24.3
Similar commands:
COMX BASIC V1.00: TONE / MUSIC
Floating Point BASIC 2.2: TONE / FREQ
Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0: TONE
The BEEP command sends out a continuous tone. It is in the form, BEEP (X,Y, Z), where X determines the frequency, and can vary from 0, 1, 2, ... to 127.
Y determines the octave, and can vary from 0, 1, 2, ... to 7.
Z determines the amplitude and can vary from 0, 1,... to 15.
The actual generated tone frequency is calculated as follows:
Input frequency
Tone frequency =
X + 1
Where the Input frequency is calculated based on the octave, specified by Y. see table 1 below.
Y |
Input frequency (Hz) CPU: 3.58 |
---|---|
1 | 6990.2344 |
2 | 13980.469 |
3 | 27960.938 |
4 | 55921.875 |
5 | 111843.750 |
6 | 223687.50 |
7 | 447375.00 |
8 | 894750.00 |
Note that the value returned from the BEEP command represents the value of bit 0 to 15 from OUT 4 as in the following table.
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
0 |
Tone |
Off |
Range |
Tone volume |