Lesson goal: Introduction to making sound

Previous: Drawing polylines in 3D | Home | Next: Compose music

Sounds we hear are made by when air is made to vibrate back and forth at a particular frequency. The speakers in your computer are made to do just this, having a moveable diaphram that pushes on the air when an electrical signal is applied to them. If you want to make sounds as a programmer, all you need is the ability to send signals to your speakers. Here we introduce the sound function, that allows you to do just that--send a signal to your speakers, so you can make them play a sound of any given frequency.
Move the mouse over a dotted box for more information.

Now you try. Try putting in any frequency and duration you want, which can be a number from 100 to 10,000 or so.

Type your code here:

See your results here: