In this assignment, you will practice the following computer science concepts:
- Creating and Using Objects
Computer Science Principles Curriculum
- Big Idea: Creativity: EU 1.1, LO 1.1.1, EK 1.1.1B, EU 1.2, LO 1.2.2, EK 1.2.2A, EK 1.2.2B
Common Core Standards
- Standards For Mathmatical Practice: CCSS.Math.Practice.MP1, CCSS.Math.Practice.MP2, CCSS.Math.Practice.MP4, CCSS.Math.Practice.MP5, CCSS.Math.Practice.MP6, CCSS.Math.Practice.MP7, CCSS.Math.Practice.MP8
In this assignment, you will write a program that simulates the sounds of a 3D environment. You will play sounds associated with a jungle, setting their positions in 3D space in order to create an "audio scene." Download this zip folder for a template to help you get started.
Goal 1: Creating and Using Objects
Open the provided template and navigate to the main.quorum file. There are five different sound files included in the project template. They contain sounds that represent birds, crickets, frogs, water, and wind. We will use these sounds and position them in 3D space to create the illusion of standing in the middle of a jungle.
Since there are five audio files, we need to create five
Before we can create the Audio objects, though, we must tell Quorum that we want access to the
Audio library by adding the
use statement for that library. Create the five
Audio objects and use the
Load action to load the audio files to those objects.
Some of the audio files are louder than the others.
We may want to adjust the volumes of the audio objects based on this.
Adjusting the volume can also help make the sounds appear to be coming from further away.
Experiment with different volumes to discover what sounds best.
In order to make the sounds appear to be coming from different points in space, we need to set their positions in a virtual 3D space that the Quorum Audio Library supports.
Audio objects have variables that help determine their positions in a virtual 3D space, including the x, y, and z coordinates of the sound.
We can set the x, y, and z coordinates of the
Audio objects by using the
SetZ actions on each of our
Example: Using the SetX, SetY, and SetZ action on an Audio Object
// this line sets the x position of our birds audio object. // the sound will be coming from our right birds:SetX(0.60) // this line sets the y position of our birds audio object. // the sound will be coming from above our heads birds:SetY(0.9) // this line sets the z position of our birds audio object // the sound will be coming from slightly behind us birds:SetZ(-0.2)
In the above example, we set the position of the bird sound. With respect to the x-axis, where a value of 0 represents the "middle" of the scene, our bird sound will originate from the right of us, the listeners, in the scene. With respect to the y-axis, the bird sounds originate from near the top of the scene. This makes sense for birds, because birds live in trees and fly around, so bird chirping noises will come from above our head. With respect to the z-axis, our bird sounds will come from slightly behind us.
Activity: Set the x, y, and z positions for the other
Set the 3D positions for the audio objects representing the crickets, frogs, water, and wind sounds. Set the positions in a way that makes sense for the scene. For example, the water sound should be coming from below us while the wind sound should be heard above our heads. The frogs sound may come from close to the water sound. Play around with different positions.
Each student may position his or her sounds differently, so each program will produce a unique overall sound.
In the next tutorial, we will discuss Challenge 2.3, which describes how work Animation Sheets in Quorum..