<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>
In Sound Words in TurboForth Kernal
Sets sound channel ch# to the pitch pitch with volume volume.
: BusyNoise ( -- )
50 0 DO 50
15 0 DO
DUP I 0 SOUND 10 +
( turn sound off:) 0 15 0 SOUND
Suitable values for pitch can be found in the editor assembler manual on page 318 (note, it is not necessary to adjust the pitch values for each channel as described in the editor assembler book, just use the values given for channel 0 – SOUND modifies the pitch internally for each channel).
Valid vol values are 0 to 15 (0=loudest).
Valid ch# values are 0 to 3 (3 is the noise channel).
For the noise channel, the pitch field is used to describe the noise. Bits 15 and 14 (15=LSB) select the shift rate, and bit 13 selects either periodic or white noise. Other bit positions should not be used.
Note SOUND does not ‘sanity check’ the values passed, so care should be taken to pass in only legal values.
Note the sound tutorial page offers some additional words which gives more control over the sound chip.