# 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.
sound(freq,duration)
play()

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

Remember, you are coding now, so you don't have to program in sounds one at a time. You can use a for-loop to make all kinds of interesting sequences, like this

 for f=500,600,10 do sound(f,0.5) end play() 

or

 for f=100,5000,100 do sound(f,0.01) end play() 

Show a friend, family member, or teacher what you've done!