Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  The computer's internal speaker has no volume control of any kind and,
  like all speakers, varies in how well it responds to different
  frequencies; some frequencies may sound louder than others. In the case of
  a crude speaker like that found in most PCs and PS/2s, the loudness of the
  sound varies widely with the frequency. You can use the following program
  to test this--it may help you choose the best sound pitch for your
  purpose:

  10 PLAY "MF"                            ' plays each sound separately
  20 FREQUENCY = 37
  30 WHILE FREQUENCY < 32000              ' use all frequencies to
                                            32000 Hz
  40   PRINT USING "##,###"; FREQUENCY    ' display frequency
  50   SOUND FREQUENCY, 5                 ' produce sound with
                                            duration of 5
  60   FREQUENCY = FREQUENCY * 1.1        ' increment frequency by 1/10
  70 WEND

  Be aware that the speakers in the various PC and PS/2 models may not sound
  alike, partly because the materials of each system housing resonate
  differently as speaker enclosures. Try the following samples on two
  different models and be prepared for these variations in sound:

  100 'sound samples
  110 '
  120 'warble (two rapidly alternating tones)
  130 FOR N% = 0 TO 5
  140  SOUND 440, .7
  150  SOUND 466.16, .5
  160 NEXT
  170 WHILE(INKEY$="") : WEND     ' wait for a keystroke
  180 '
  190 'two tones played quickly
  200 SOUND 900, .1
  210 SOUND 760, 1
  220 WHILE(INKEY$="") : WEND
  230 '
  240 'random noise
  250 X = INP(&H61) AND &HFC
  260 I=20                        ' changing I changes the noise
  270 FOR N% = 0 TO 500
  280  IF (RND * 100 < I) THEN OUT &H61,X OR 2 : OUT &H61,X
  290 NEXT

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