AP CSP CodeX - Mission 5: Micro Musician
Mission 5: Micro Musician
Students play built-in MP3 files on the CodeX and make their code easier to read with blank lines and comments.
Overview
Mission 5 is a short one. Students learn the code for playing pre-loaded MP3 files on the CodeX, then use blank lines and comments to make their code easier to read. Because the coding portion is shorter than Mission 4, there is time to review earlier concepts and introduce analog and digital data before students begin. Students finish by running their program on batteries, with no computer attached.
🎯 Mission Goal: Students will play a built-in MP3 on the CodeX, show an image, and make their code readable with blank lines and comments.
Learning Targets
- I can make the CodeX play music through the speaker or headphones.
- I can add blank lines and comments to my code to increase the readability.
Key Concepts
- Program readability is important and can be accomplished by using blank lines and adding comments to the code.
- Batteries in the CodeX can make your code portable.
- The audio function used in this mission is "blocking," which means no other code will execute while the audio plays. Non-blocking functions are introduced in Mission 13. You can also use the Non-Blocking Audio document.
Assessment Opportunities
- Mission 5 Assignment
- Quiz after Objective 5
- Mission 5 Kahoot Review
- Music1 program
Success Criteria
- Create a program that plays an audio file
- Add readability to the code by adding blank lines and comments
- Debug any errors in the code
Digital Resources
Classroom Materials
- ▸CodeX
- ▸USB-C cable
- ▸Computer
Real-World Applications
Extensions & Cross-Curricular
🔤
Vocabulary
▾
🐍
New Python Code
▾
📐
Standards
▾
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
AP CSP Framework - Learning Objectives
AP CSP Framework - Computational Thinking Practices
- Prepare the assignment to give through your LMS.
- If you have a word wall, or another form of vocabulary presentation, prepare the new terms.
- If you have batteries for the CodeX, have them ready for Objective 6.
- Start the lesson by going over the Analog and Digital Data slides.
-
Something to watch for! Objective 4 has names of MP3 files loaded onto the CodeX. In order to play the files, the folder they are in must be included. Students always need to use the
("sounds/filename")path in their code. -
Something to watch for! Students can use double quotes (
" ") or single quotes (' '). Either one works. - Students are asked to add a multiline comment to the top of their code in Objective 5. The assignment calls this a docstring.
- The Mission 5 Kahoot Review covers concepts and vocabulary from the earlier missions as well.
- Students can add their own audio files to their CodeX. Use the instructions in the Adding Audio to CodeX slides.
-
The
audio.mp3()function is blocking. For a quick look at non-blocking audio functions, refer to the Non-Blocking Audio document. - Refer to the lesson plans in the Python with CodeX Mission Pack Curriculum for additional challenges, cross-curricular suggestions, and additional information.
Lesson Outline
This outline gives the narration for one way to present the lesson.
The coding part of this mission is much shorter than Mission 4. You should have time to do some coding review, and also introduce analog, digital, and music before starting the coding portion. Depending on the length of your warm-up and how quickly students complete the mission, they may have time for an extension.
Review concepts from Mission 4 by playing the Mission 4 Kahoot Review, especially if you did not have time to play it during the mission.
Analog and Digital Data: Use the Analog and Digital Data slides to go over these key concepts and how a computer processes data.
Discuss: Use a discussion strategy, like journaling, working at boards, selecting random students, or a form of think-pair-share. What is analog and digital sound? You can ask students what they already know about these terms and/or music. Use the slides to provide a mental model and definitions. The NBC News video Learn about analog and digital sound is also a really good resource. It is just under 5 minutes long.
Students can work individually or in pairs for pair programming.
Students go to make.firialabs.com and should be at the beginning of Mission 5.
sounds/. To play a built-in file, students must include sounds/ in front of the name. Students can use double quotes or single quotes. Either one works.- Create a string variable for the audio file and use it in your code
- Program several buttons to play music
- Before the music plays, add one or more of these: turn on the color of the pixels, display an image, or fill the screen with a color
✅ The assignment is complete and ready to turn in.
Discuss: Use a discussion strategy, like journaling, working at boards, selecting random students, or a form of think-pair-share. This discussion question is also excellent as a warm-up.
What are some real-world applications of digital music? Some examples include:
- Musical gift cards
- Ringtones
- Drum machines
- Keyboard synthesizers
If this lesson is completed in one class period, the following can be used as a wrap-up. If you are on a block schedule and continuing to the next lesson, a wrap-up isn't necessary.
Formative assessment:
- Daily reflection journal
- Completion of the assignment
- Music1 program
- Mission 5 Kahoot Review (reviews topics from previous missions as well as Mission 5)
- Exit ticket on vocabulary
- Group review on vocabulary