Brain DeCoded with CodeX - Mission 4, Objective 4: Language Patterns

Mission 4 · Objective 4 Lesson Plan

Language Patterns

Students record their own voice on the CodeX and finish a program that counts syllables by finding the peaks and gaps in the sound envelope.

⏱ 45-70 min 🎯 Grades 8-12+ 💻 CodeSpace 🎮 CodeX 🎙 Audio & Sound Waves
View Lesson Outline
📋

Overview

Objectives 2 and 3 searched data someone typed in. This one searches data students make themselves. They record a word through the CodeX microphone, and the program counts the syllables in it.

The idea carrying the lesson is that your brain does not analyze every point in a sound wave. It picks out the essentials, the rhythm and the energy. The program does the same thing by building an envelope, a sketch of how loud the sound is over time, and then looking for peaks and gaps in that sketch instead of in the raw audio.

Students open BRN_syllables from Browse Files, save it as syllables, and add the recording, playback, and quit controls plus the two constants that tune the detection. The CodeX graphs the envelope on screen with red markers at the threshold, so students can see why a count came out the way it did.

🎯 Project Goal: Students add code to a program that detects syllables in spoken language.

🎯

Learning Targets

  • I can explain feature extraction to simplify sound.
  • I can use the CodeX device to record sound and analyze the peaks and gaps.
💡

Key Concepts

  • Your brain does not analyze every tiny detail of sound waves. It zooms in on the essentials.
  • A pattern detection algorithm can search for peaks and gaps in a sound wave to detect syllables.
✅

Assessment Opportunities

  • Turn in the Activity Guide.
  • Complete the program syllables.
☑

Success Criteria

  • Complete the CodeTrek steps
  • Program runs correctly without errors
  • Activity Guide is completed
📂

Digital Resources

🧰

Classroom Materials

  • ▸CodeX device and USB cable, one per student
  • ▸Laptop/computer with Chrome browser
🚀

Extensions & Cross-Curricular

ExtensionThis program uses searching algorithms similar to the programs in Objective 2 and Objective 3. Have students compare and contrast the pattern searching code in all three.
MathThis program uses modulo division. Teach a lesson on integer and modulo division and give practice problems.
ScienceAdd a lesson on what sound waves are and how they are created. Look for physical examples or run a few experiments.
🔤

Vocabulary

▾
Envelope:in audio signal processing, the overall shape of a sound signal's volume over time, leaving out the details of the sound's frequency content. It describes how the intensity of the sound changes.
🐍

New Python Code

▾
x % 4The % symbol is modulo division, which returns the integer remainder of a division. In this example the possible values are limited to 0, 1, 2, or 3.
📐

Standards

▾

Computer Science

9-12.DA.10

English Language Arts & Literacy

RST.9-10.4 RST.11-12.4
📝
Preparing for the Lesson
  • Run the program yourself first and record a few words. You need to know what a good envelope graph looks like before you can help a student whose count is off.
  • Find the microphone on your own CodeX. It sits just to the right of BTN-R, and students will ask.
  • Note that students start from a provided file. They open BRN_syllables through File -> Browse Files, then File -> Save As and rename it syllables. Walk the class through that together so nobody edits the original.
  • Decide how students get the Activity Guide. You can print a copy for each student or assign it digitally.
  • Think about noise. Twenty students recording at once is loud, so plan for turns, spread out, or send pairs to a quieter corner.
  • Pick a few test words at different lengths. One-syllable, two-syllable, and something like "communication" gives students a range to compare.

🧑‍🏫
Teacher Notes
  • The Hints and CodeTrek explain the code. Students should go through them carefully and review with each other to understand what the code does and how it works.
  • The program uses the built-in microphone on the CodeX, located just to the right of BTN-R. Students need to get up close and speak loudly for best results.
  • Getting the right values for the constants is tricky. Read the hints and try those values first. If syllables still are not detected, students can adjust THRESH and MIN_GAP. Try THRESH first: if the sound wave is not reaching the red markers, make THRESH smaller. Then adjust MIN_GAP, the gaps in the sound, to get the correct number of syllables.
  • The program will not count every syllable in every word. Some words have more peaks and gaps than others. That is a good point of discussion.
  • Students should follow the instructions on the Activity Guide and record their results.
  • Button roles are worth posting on the board: A records one second, B plays it back, U processes the word, L starts, R quits.
  • Extensions and cross-curricular projects are included to enhance the concepts in the objective. You can use the extensions to extend students' learning.
🗺️

Lesson Outline

🗣️Warm-up / Hook

Count syllables the human way first.

  • Say a few words out loud and have students clap the syllables: cat, table, communication.
  • Ask: "How did you know where one syllable ended and the next began?"
  • Ask: "You did not think about the sound wave at all. So what were you actually listening for?"
Teaching tip: Students will land on rhythm, or beats, or pauses. Those are the peaks and gaps. Put their words on the board and point back to them when the envelope graph shows up on the CodeX.
🎙️Reading & Discussion

Students work through the reading on simplified sound.

  1. Students read the Sound Simplified section. The brain picks out rhythm, melody, and energy rather than every detail of the wave.
  2. Define envelope: a sketch of the sound that captures loudness and change over time, with the frequency detail left out.
  3. Point students to the Hints, which explain envelopes and how the program works. This is the one objective where the hints are required reading, not optional.
  4. Connect back: peaks are where the sound gets loud, gaps are the quiet between them, and that is all the algorithm needs to guess a syllable count.
Teaching tip: Sketch a lumpy envelope on the board with a horizontal threshold line across it. Students who see that picture once understand what changing THRESH does, instead of guessing at numbers.
💻Student Work Time

Students build syllables and record their voice.

  1. Students open BRN_syllables through File -> Browse Files, then File -> Save As and rename it syllables.
  2. Students work through the CodeTrek steps, setting the constants THRESH and MIN_GAP and adding the button handling for record, playback, and quit.
  3. Students run the program, press A to record a word, B to hear it back, and U to process it.
  4. Students read the graph. If the envelope is not reaching the red markers, lower THRESH. Then adjust MIN_GAP until the count matches.
  5. Students test several words and record the results on the Activity Guide.
Teaching tip: Playback is the fastest way to diagnose a bad count. If a student's recording is too quiet to hear on BTN B, the problem is the microphone distance, not the constants.
✏️Wrap-up & Review

Close on where the algorithm falls short.

  • Compare counts across the room. Which words did the program get right, and which ones did it miss?
  • Ask: "Your ear got every one of these right the first time. Why is this so much harder for the program?"
  • Ask: "What would you need to add to make it work on a whole sentence?"
  • Collect the Activity Guides.
Teaching tip: The misses are the lesson, not a failure of the program. Words like "fire" or "hour" stretch and split unpredictably, which is exactly why speech recognition took decades to get right.