Click here to return to the KiXtart HelpDesk main page...

KiXtart 2001 Manual

Play

Action: Allows you to play music on the computer's speaker by using the SPK file format described below, or on your sound card by playing a WAV file.
 
Syntax:

PLAY [FILE "path\filename.spk"] | "string" | "path\filename.wav"

There are four possible syntax forms:

  PLAY FILE "Jbond.spk"
  PLAY "0g256t 0g8d247f 4d165f 247f 8d262f 4d165f 262f 8d277f 4d165f"
  PLAY FILE "Ding.wav"
  PLAY "Chimes.wav"

The string or file consists of a sequence of commands indicating the frequency and duration of the tones to play. The following commands are available:

  F or f - frequency
This command causes a tone to be produced at the current frequency. The initial current frequency is 1000Hz. To change the value, indicate the desired frequency immediately followed by the f character. For example, to produce a tone at 1500Hz, specify 1500F.

  G or g - gap
This command sets the number of timer ticks (1 second = 18 ticks) of silence between individual tones. The number of timer ticks between tones is specified as a number immediately followed by G. The initial value is 0.

  D or d - duration
This command sets the length (in timer ticks) of each tone. For example, to make each tone last about a third of a second, use the command 6d.

  T or t - tempo
This command scales the duration of each tone. This allows you to change the duration of a series of tones globally, without having to change each of the individual duration commands.

A tempo value of 256 indicates normal tempo. A value of 4df lasts:

  2 timer ticks, when the tempo is set to 128
  4 timer ticks, when the tempo is set to 256
  8 timer ticks, when the tempo is set to 512
 

Remarks:

KiXtart automatically selects the appropriate action based on the file name extension you provide.
 

See Also: Beep
 
Examples:

; * This plays the part of the James Bond theme *
PLAY "0g256t 0g8d247f 4d165f 247f 8d262f 4d165f
262f 8d277f 4d165f 277f 8d262f 4d165f 262f 8d247f
4d165f 247f 8d262f 4d165f 262f 8d277f 4d165f 277f
8d262f"