Join Barron Stone for an in-depth discussion in this video Generating sound and colors, part of Code Clinic: Python.
- In this video I'll show you how I generate sounds and…draw colors to the canvas when a mouse event occurs.…As I mentioned in an earlier video, for this solution…I use the pygame package to play sounds and I…imported two modules from the pygame package.…I imported the sndarray and the mixer module.…The mixer module contains classes for loading…sounds and controlling playback and the sndarray…module contains functions for converting…between numpy arrays and sound objects.…I also imported the numpy package as np up here.…
Now before I can use the mixer module I first…have to initialize it and that's what I did in…the last line of my init constructor method.…Here I called the mixer.init function and I configured…the mixer to use a sample rate of 22,050 Hertz, to use…signed 16 bit values for the sample values and to only…use a single channel so it'll just be a mono sound.…Now let's look at what happens when the user presses…their mouse and the mouse down event occurs.…
When the user presses their mouse and the mouse_down…
Barron introduce challenges and provides an overview of his solutions in Python. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, Java, PHP, and Ruby.
Skill Level Intermediate
Q: Why can't I access the Lake Pend Orielle site (http://lpo.dt.navy.mil)?
A: The Lake Pend Orielle site is not accessible in some geographical areas. We have contacted the owner of the server to try to resolve this issue.
Q: I am unable to access the Lake Pend Oreille data from outside the U.S.
A: A static copy of this data is provided here for lynda.com members outside of the U.S
Problem One: Exploring Lake Pend Oreille
Problem Two: Image Analysis
Problem Three: Eight Queens
Problem Four: Accessing Peripherals
Problem Five: Recursion and Directories
Problem Six: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.