[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SOUND()
 Creates tones (melodies) by designating frequency and duration
------------------------------------------------------------------------------
 Syntax

     SOUND(<nFrequency>,<nDuration>,[<lTimer>]) --> cNull

     or:

     SOUND(<cToneSequence>,[<lTimer>]) --> cNull

 Arguments

     <nFrequency>  Designates the tone frequency in hertz.

     <nDuration>  Designates the duration of the tones in 1/100ths
     seconds; or when <lTimer> is set at .T., in intervals of 1/18.2 seconds.

     <lTimer>  Designates whether the tones designated as values are
     created on a basis of 1/100ths seconds (.F.); or 1/18.2 seconds (.T.).
     The default value is 1/100th seconds (.F.).

     or:

     <cToneSequence>  Designates a character string that contains an
     entire melody.  Use the CA-Clipper I2BIN() function to produce 2-byte
     values for frequency and duration.  The string format assumes 2 bytes
     for frequency and 2 bytes for duration, which are alternated until the
     melody is defined.

     <lTimer>  Designates if you want the designated tones values created
     on a basis of 1/100ths seconds (.F.) or 1/18.2 seconds (.T.).  The
     default value is 1/100th seconds (.F.).

 Returns

     SOUND() always returns a null string as a value.

 Description

     Use SOUND() to create tones at intervals of 1/100th seconds, in the
     range of 21 to 65535 hertz, for a maximum of 655.36 seconds.

     To make it compatible with parameters for the CA-Clipper TONE() function
     or various other programming language functions, select the 1/18.2-
     seconds interval.  To achieve this, designate the last parameter as .T..

     The table below shows tones and their frequencies for three octaves at
     1/100th second intervals.  To go one octave higher, double the frequency
     value.

     Table 13-8: Tones and their Frequencies
     ------------------------------------------------------------------------
     Tone    Freq.     Tone    Freq.     Tone    Freq.
     ------------------------------------------------------------------------
     C 3     131       C 4     262       C 5     523
     C#      139       C#      277       C#      554
     D       147       D       294       D       587
     D#      156       D#      311       D#      622
     E       165       E       330       E       659
     F       175       F       349       F       698
     F#      185       F#      370       F#      740
     G       196       G       392       G       784
     G#      208       G#      415       G#      831
     A       220       A       440       A       880
     A#      233       A#      466       A#      932
     B       247       B       494       B       988
     ------------------------------------------------------------------------

     Frequency values that lie below 21 hertz, are not perceived by the human
     ear.  You can use them as pauses.

 Note

     .  You can find additional uses for SOUND() in the sample file
        Melodies.prg.

 Examples

     .  Show the tonal scale:

        SOUND(262, 40)
        SOUND(294, 40)
        SOUND(330, 40)
        SOUND(349, 40)
        SOUND(392, 40)
        SOUND(440, 40)
        SOUND(494, 40)
        SOUND(523, 40)

     .  Call with a string parameter:

        cVar := I2BIN(262) + I2BIN(40) + I2BIN(294) + I2BIN(40)
        SOUND(cVar)

     .  Pause for one-half second:

        SOUND(0, 50)


See Also: MILLISEC()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson