SOUND

BS1 icon {PBASIC 1.0}

SOUND Example

 

 

 

Syntax: SOUND Pin, (Note, Duration {, Note, Duration...})

Function

Generate square-wave tones for a specified duration.

Note: See FREQOUT for all BS2 models.

Quick Facts

  BS1
Units in Duration

12 ms

Available Sounds

256

Frequency Range

94.8 Hz to 10,550 Hz

Explanation

SOUND generates one of 255 square-wave frequencies on an I/O pin. The output pin should be connected as shown in the circuits below.

The tones produced by SOUND can vary in frequency from 94.8 Hz (1) to 10,550 Hz (127). If you need to determine the frequency corresponding to a given note value, or need to find the note value that will give you best approximation for a given frequency, use the equations below.

Note = 127 - (((1 ÷ Frequency) - 0.000095) ÷ 0.000083)



-- and --



Frequency = (1 ÷ (0.000095 + ((127 - Note) x 0.000083))

 

Note, in the above equations, Frequency is in Hertz (Hz).

Go to PBASIC Language home page

Open Getting Started with Stamps in Class

Open Connection Troubleshooting

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/21/2013