<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


SOUND Search:

In Sound Words in TurboForth Kernal

Word Name: SOUND
Type: Standard word
Data Stack Signature: pitch vol ch#
Return Stack Signature: --
Availability: V1.0  V1.1  V1.2
Description:

Sets sound channel ch# to the pitch pitch with volume volume.

Example:

: BusyNoise ( -- )
  50 0 DO 50
    15 0 DO
      DUP I 0 SOUND 10 +
    LOOP DROP
  LOOP
  ( turn sound off:) 0 15 0 SOUND
;

Comment:

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.

See Also: None listed

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>