Brain DeCoded with CodeX - Mission 4, Objective 4: Language Patterns
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.
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
🔤
Vocabulary
▾
🐍
New Python Code
▾
% 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
English Language Arts & Literacy
- 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.
- 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
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?"
Students work through the reading on simplified sound.
- Students read the Sound Simplified section. The brain picks out rhythm, melody, and energy rather than every detail of the wave.
- Define envelope: a sketch of the sound that captures loudness and change over time, with the frequency detail left out.
- 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.
- 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.
Students build syllables and record their voice.
- Students open BRN_syllables through File -> Browse Files, then File -> Save As and rename it syllables.
-
Students work through the CodeTrek steps, setting the constants
THRESHandMIN_GAPand adding the button handling for record, playback, and quit. - Students run the program, press A to record a word, B to hear it back, and U to process it.
- Students read the graph. If the envelope is not reaching the red markers, lower THRESH. Then adjust MIN_GAP until the count matches.
- Students test several words and record the results on the Activity Guide.
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.