From the course: Learning CircuitPython with Circuit Playground Express

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Making sounds

Making sounds - Python Tutorial

From the course: Learning CircuitPython with Circuit Playground Express

Start my 1-month free trial

Making sounds

- [Instructor] Lights are great, but the Circuit Playground Express also has a speaker and can play tones and other sounds. And you can connect to an external amplifier and speaker if you want a better sound. The speaker on the Circuit Playground Express is the large, dark square located just below button A. We won't use it in this video, but there's also an external audio output that you can enable, located on pad A0. There are several functions in the CPX module to make playing tones easy. The play tone function plays a tone for a specific length of time. Start tone starts a tone going in the background, then proceeds with your program. Stop tone, stops a tone from playing. Sound frequencies are expressed as a number of cycles per second, or hertz. If you want to play musical notes, here's a table of notes and their approximate frequencies covering several octaves. You can also play short sound files using the play…

Contents