Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Proclip2 Library - <b> sound() </b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SOUND() 

          Similar in general concept to the Clipper TONE() command, SOUND()
          provides the programmer with the added flexibility of creating
          sounds for a shorter duration of time.  The Clipper TONE() command
          is driven off the internal timer of the computer which "pulses"
          18.2 times per second.  Due to this the TONE() command has a
          "resolution" of 1/18th of a second in that it cannot generate a
          tone for a shorter duration of time.  With SOUND() it is possible
          to create a sound for as little as 1/100th of a second.  Although
          1/100th of a second is the same from computer to computer, software
          can have difficultly calculating what 1/100th of a second is due to
          timing differences between computers.  SOUND() does not have this
          problem as it automatically calculates the exact timing necessary
          for 1/100th of a second to pass, regardless of CPU speed.


      Format: 

               sound(tone, duration [,type])


      Parameters: 

               tone......Numeric variable or constant which informs the
                         function of the frequency you wish to use.  The
                         frequency is the number of Hertz (cycles per
                         second).  The higher the frequency the higher the
                         tone, the lower the frequency the lower the tone.
                         Allowable range for this parameter is 37 through
                         32767.

               duration..Numeric variable or constant which informs the
                         function of the duration to use.  The duration is
                         the amount of time the speaker will generate the
                         tone before shutting off.  As two duration
                         resolutions are available (timer and internal), this
                         value will have different meanings.  See the "type"
                         description below.

               type.... OPTIONAL .  Logical variable or constant which
                         informs the function as to the type of duration to
                         use.

                         .T.            DEFAULT.  Instructs the function to
                                        use timer ticks as the duration
                                        count.  A duration of 5 would last
                                        for 5 timer ticks or 5/18ths of a
                                        second.  Resolution range in this
                                        mode is 1/18th of a second to 3,640
                                        seconds (approx 1 hour).

                         .F.            Instructs the function to use
                                        1/100ths as the duration count.  A
                                        duration of 5 would last for 5/100ths
                                        (1/20th) of a second.  Resolution
                                        range in this mode is 1/100th of a
                                        second to 655 seconds (10.9 minutes).


      Examples: 

               1.   Generate a good tone for an error message.  Use the
                    "internal timing" of 1/100ths of a second.  Each tone
                    will be generated for 3/100ths of a second.

                    .
                    .
                    .
                    sound(2000,3,.F.)
                    sound(500,3,.F.)
                    sound(2000,3,.F.)
                    .
                    .
                    .

               2.   Generate a tone indicating a different condition than
                    above.  Use the default timing of "timer ticks".  Each
                    sound will be generated for 1/18th of a second.

                    .
                    .
                    .
                    sound(2000,1)
                    sound(1000,1)
                    .
                    .
                    .

      Returns: 

               Nothing.


      Cautions: 

               None.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson