sound_overview - Anobium/Great-Cow-BASIC-Help GitHub Wiki
Introduction:
These Great Cow BASIC methods generate tones of a given frequency and duration.
Method | Controls |
---|---|
Tone | Generate a specified tone for a specified duration in terms of a frequency of a specified Mhz and units of 10ms |
ShortTone | Generate a specified tone for a specified duration in terms of a frequency of a 10Mhz and units of 1ms |
Play | Play a tune string. The format of the string is the QBASIC play command. |
PlayRTTTL | Play a tune string. The format of the string is the Nokia cell phone RTTTL format. |
Relevant Constants:
These constants are used to control settings for the tone generation
routines. To set them, place a line in the main program file that uses
#define
to assign a value to the particular constant.
Constant Name | Controls | Default Value |
---|---|---|
SoundOut |
The output pin to produce sound on | N/A - Must be defined |
Note: If an exact frequency is required, or a smaller program is needed, these routines should not be used. Instead, you should use code like this:
Repeat count
PulseOut SoundOut, period us
Wait period us
End Repeat
Set count
and period
to the appropriate values as follows:
period
to 1000000 / desired frequency / 2
count
to desired duration / period.