Level 5

Hear the Sound

Level 5 · Chapter 11

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Combine loops and conditions, even nested ones.

Code 2-AP-12Read the official text

Also practised: 2-AP-17

Common Core State Standards for Mathematics

Statistics & Probability · Grade 6

Describe a set of data with its middle and spread.

Code 6.SP.B.5Read the official text

The short lines are our own words. We matched this lesson to these standards ourselves; the standards' owners have not reviewed or endorsed this course.

Common Core State Standards © 2010 National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

Today you will use microphone loudness to control sprites, creating sound-reactive visuals.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-12 · CSTA 2-AP-17 · ISTE 1.5.c · Standards
🎯 I canuse microphone loudness to control sprites, creating sound-reactive visuals
🧩 New blocks1 block
📝 New words8 words
⏱ Lesson time~40 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students often expect loudness to stay high after a loud sound. It drops back to near 0 almost immediately. Effects need to be applied inside a forever loop to feel continuous.
  • Students may think loudness returns the exact volume in decibels. It returns a Scratch-internal 0–100 scale that approximates perceived loudness.
  • Students expect the sounds list to hold every reading. The delete (1) of [sounds ▾] block drops the oldest item once the list passes five, so the list is a rolling window, not a full recording.

🎯 Differentiation

🐢 Struggling: Focus only on the size-reactive version (step 1). Skip the clap counter until the basic loudness→size mapping works.

🚀 Advanced: Challenge them to make the sprite color-shift based on loudness — map (loudness) to a color effect value, so quiet = blue and loud = red.

💡 During the lesson

  • Warm-UpScratch will ask the browser for microphone permission. Walk students through accepting this before the lesson. If the school network blocks microphone access, run the teacher's setup as a demo and have students observe. The concepts still apply even without microphone access. The microphone is a sensor 🌡️ that reads the room; it measures how loud the sound is, so the sprite can be reactive 🔔, responding the instant the volume changes.
  • Try ItAsk: "If loudness = 50 and we set size to (loudness * 3), how big is the sprite?" (150%.) "If loudness = 0?" (0% — Pico shrinks to a tiny dot! Add a minimum: ((loudness) * (3)) + (20).) This is a good preview of the min/max discussion.
    In the second experiment, cooldown 0 reveals the frame-rate problem from Section 2 (Predict) — claps shoot up by many per clap. Cooldown 0.5 fixes it. The third experiment reuses the cooldown pattern for a visual pulse (change size by) instead of a counter. Ask: "What happens if you change the cooldown wait from 0.5 to 0.1 seconds? From 0.5 to 2 seconds?" Shorter wait = more sensitive, longer wait = misses rapid sounds. The stage's 🎤 loud button reads as 80, so a threshold of 90 never fires there; in a real room, background noise can pass a threshold of 5.
  • PlanThree scripts run from one flag click at the same time. Branch A runs every frame. Branch B fires when loudness crosses the threshold. Branch C stores readings in a list, then walks the list with an inner loop to find the biggest one — a loop inside a loop, which the next chapter uses for sorting.
  • BuildAll three scripts share one green flag. Branch A grows Pico every frame; Branch B counts claps only when loudness crosses the threshold; Branch C keeps a five-item history and scans it. Ask students to predict what a lower threshold (30) does before they test it — the counter becomes more sensitive, so quieter sounds also count. In step 10 the repeat sits inside the forever — point at the nesting and count the two loops out loud. The list half of this build needs no microphone: with the pick random swap from the step 9 tip, the list, the index i, and the scan behave identically, so a classroom with no microphone still gets the list practice the next chapter builds on.