CSc 101: Section 15 – Sound!
In this section you will be working with the processing sound library.
Remember that you will need to download the sound library before using it in processing!
Also, feel free to refer to the slides or example programs from class if you get stuck, or forget how to use the library.
Each problem is accompanied by a short video clip, rather than an animated gif.
This is because each clip has some sound associated with it.
It may take a little longer for the videos to load, so hang tight (or, refresh the page a few times).
You can play, pause, and scrub the videos.
Make sure to turn your volume up!
Problem 1
|
Write a sketch named secton_15_1 .
In this problem, you will write a program that simply plays one sound file.
Your program does not need to repeat or loop the file, and you don't need to draw anything onto the canvas - just leave it blank.
You can choose on of these three sound files:
dub1.mp3,
dub2.mp3,
dub3.wav.
|
Problem 2
|
Write a sketch named secton_15_2 .
In this problem, you will modify your code from the previous problem to add a stop/start functionality.
When the program starts up, the background will be red and will not play any sound.
When the user clicks on the background, it changes to green and plays the song from the beginning.
The user can continue to click to stop and restart the song, as shown in the video.
You can use the same sound track from problem 1.
|
Problem 3
|
Write a sketch named secton_15_3 .
In this problem, you should write a program that can play all of the three dubstep tracks from problem 1.
You should create a 300x150 pixel canvas, separated into three differently-colord buttons, as shown in the video.
When you click on the green button, it will play the first song.
Clicking in the middle button will play the second song, and the last button starts the last song.
Notice that it doesnt play the sounds over eachother.
Whenever the mouse is clicked, all of the previous sounds are stopped.
You can do this using the stop() method on the SoundFile variable.
Also, you don't need to draw the black circles.
Those are just there to indicate the clicks.
|
Problem 4
|
Write a sketch named secton_15_4 .
In this simple problem, you are going to recreate the "halo sheild recharge" sound example that we did in class.
Play the video for an example of what sound the program should make.
You can use the code from class as a starting point (posted in the lecture ouline area of the site).
|
Problem 5
|
Write a sketch named secton_15_5 .
In this simple problem, you should modify the code from the previous problem.
You should use the pulse oscillator to create a fire-truck siren sound.
Also, draw a circle that moves back-and-forth across the screen and changes color along with the siren, as shown in the video.
|
If you complete all of the problems with time remaining, work on the assignment!
Solutions will be posted the day after section
All sound files taken from freesound.org
The links are provided below for credit:
- https://freesound.org/people/MarkoVujic92/sounds/271576/
- https://freesound.org/people/LittleJest/sounds/361093/
- https://freesound.org/people/TheNikonProductions/sounds/171003/