User Tools

Site Tools


CIGAL Reference Manual, Chapter 2 (Commands): SOUND

SOUND -- Record or playback sound data, or adjust sound parameters

usage: sound sounddata 0 nplays asynchflag
or: sound sounddata recordflag nsecs
or: sound flag

This is a generic command for handling sound I/O (input and output). If the SOUNDDATA argument is a character string, it is assumed to be a filename and sound data will be read or written directly to or from that file. If SOUNDDATA is a data variable it is read from or written to as a sound resource.

New sounds can be recorded using the RECORDFLAG option, as:

  RECORDFLAG:  1 - record sound using current quality setting
               2 - record sound using 'good' quality
               3 - record sound using 'better' quality (default)
               4 - record sound using 'best' quality
              -1 - initialize with default settings
              -2 - initialize for square-wave synthesizer
              -3 - initialize for wave-table synthesizer
              -4 - initialize for sampled-wave synthesizer (default)

Previously recorded sounds can be played back by specifying RECORDFLAG == 0 (playback is the default mode). For playback the NPLAYS option means:

  NPLAYS:   >0 - replay the sound NPLAYBACK times (default = 1)
            -1 - start playback and abort immediately, return amount of
                 time it would take to play the entire sound in
                 variable r0 (in seconds)

If NPLAYS is 1, the ASYNCHFLAG can be used to specify that the playback should occur asynchronously. In this case, the sound output is initiated and the command returns immediately. For NPLAYS > 1, or ASYNCHFLAG is 0, the command does not return until the sound output has been completed. The default for ASYNCHFLAG is 1, if RECORDFLAG is 0 and NPLAYS is 1.

A sound playing asynchronously can be stopped by another call to the SOUND command. For example:

  sound 0

See Also:
CIGAL Home, CIGAL Manual, Commands List, Manual Help

jvs/cigal/manual/chapter2/sound.txt · Last modified: 2023/02/23 18:43 (external edit)