Consica Labs

Consica Labs
Chapter 6

Sound Blocks

Adding sound clips and configuring pitch effects

Definition

Sound blocks are instructions that play audio files, adjust volume percentages, or change pitch rate metrics. Key concepts include Hat Block.

Think of Sound Blocks as:

Director script
Grid movements
Trigger alarms
Costume racks

Just as an actor changes costume or walks across the theater grid on cue, Sound Blocks dictates sprite behavior.

Real-Life Example

Just as you coordinate actions in real life, Sound Blocks works by structuring logic commands in sequence:

  1. 1 Register the trigger event block.
  2. 2 Run calculations or movements within a continuous control block.
  3. 3 Update values or graphics on the stage viewport.

Key Highlights:

  • Trigger event
  • Logic evaluation
  • Visual update

Interactive Diagram

Launch the interactive diagram to see this in action.

Open Interactive Diagram

The interactive diagram for this chapter demonstrates Sound Blocks. It shows sound blocks (play sound, start sound, change volume, change tempo) with audio visualization.

What to explore:

  • click different sound blocks; hear the sound play; adjust volume and effects; see audio waves
  • sound blocks let you add audio to projects — playing sounds, controlling volume, and creating musical effects

Introduction

Sound is a powerful tool for creating engaging Scratch projects. A game without sound feels flat and lifeless. Add a jump sound, a coin-collect jingle, or background music, and suddenly your project comes alive. Sound Blocks in Scratch let you play, control, and manipulate audio to enhance your games, animations, and stories.

Sound Blocks are in the pink Sound category. They include blocks to play sounds, control volume, change tempo, and use the text-to-speech and music extensions. You can record your own sounds, import audio files, or choose from Scratch's built-in sound library. Sound adds emotional impact, provides feedback to the player, and creates atmosphere.

In this chapter, you will learn how to play sounds, control volume and tempo, use the sound editor, and incorporate music into your projects. By the end, you will know how to make your projects sound as good as they look.

How It Works

The 'play sound () until done' block plays a sound from start to finish and pauses the script until the sound ends. The 'start sound ()' block begins playing a sound and immediately continues to the next block, allowing multiple sounds to play simultaneously. Use 'play sound until done' for sounds that should complete before the next action (like a character speaking), and 'start sound' for background music or sound effects that can overlap.

The 'set volume to ()%' block controls the loudness of all sounds in the project, from 0% (silent) to 100% (full volume). The 'change volume by ()' block adjusts volume incrementally. Each sprite has its own volume setting, and there is also a stage volume that affects the overall project. The 'set tempo to ()' block controls playback speed for the Music extension, measured in beats per minute (BPM).

Household Object Analogy

Think of Sound Blocks like a DJ's mixing board. 'Play sound' is like pressing play on a track. 'Stop all sounds' is like hitting the mute button. Volume control is like the fader slider. The tempo control is like the BPM adjuster. And just as a DJ can layer multiple tracks, you can start multiple sounds simultaneously to create rich audio experiences.

Deeper Dive

The Sounds tab contains the sound editor, where you can record, import, and edit sounds. You can record sounds directly using your computer's microphone. The editor lets you trim the beginning and end of a sound, adjust the volume of selected portions, apply fade-in and fade-out effects, and reverse the sound. You can also add 'louder' and 'softer' effects as well as 'faster' and 'slower' speed changes.

Scratch supports several audio formats. WAV files offer high quality but large file sizes. MP3 files are compressed and smaller. The sound library included with Scratch contains hundreds of pre-recorded sounds organized into categories: Animal, Effects, Instruments, Loops, Music, Percussion, Sounds, Space, and Vocals. You can also upload your own sound files in MP3, WAV, or AIF format.

The Music extension adds blocks for playing musical notes and drum beats using a built-in synthesizer. It includes 'play note () for () beats', 'rest for () beats', 'set instrument to ()' (with 21 instruments from piano to saxophone), and blocks for drum sounds (snare, bass drum, hi-hat, etc.). The tempo can be adjusted to control the speed of playback.

Key Insight

The 'stop all sounds' block is often overlooked but very useful. If background music is playing when a game ends, or if a sound loop needs to be interrupted, 'stop all sounds' instantly silences everything. This is much cleaner than trying to reduce the volume to zero.

Advanced

The Text-to-Speech extension allows sprites to speak any text aloud using synthesized speech. It offers a 'speak ()' block and voice selection (male, female, or alto). This is incredibly powerful for creating talking characters, read-aloud stories, and accessibility features. The speech synthesis happens in real-time using browser or system TTS capabilities.

The Loudness sensor (in the Sensing category) measures the volume of sound detected by your computer's microphone. It returns a value from 0 to 100. You can use this to create sound-controlled projects — for example, a game where you blow into the microphone to move a character (like a flute or whistle game). This Sensing Block makes Scratch responsive to the physical world.

Sound can be combined with motion for interesting effects. For example, you can use the 'loudness' sensor to control sprite size: as the sound gets louder, the sprite grows. Or you can synchronize sprite movements with music beats using tempo and timing. These combinations create projects that respond dynamically to audio input or that create audiovisual performances.

Vocabulary Table

Term Definition
Sound BlocksThe primary technological concept explaining how components interact within the context of Scratch Programming.
Coordinate GridThe X and Y plane representing the Stage layout coordinates.
Hat BlockA block with a rounded top that registers events to launch scripts.
Sensing BlockA block that checks for collisions, touch parameters, or mouse pointer coordinates.

Fun Facts

Scratch's built-in sound library contains over 400 sounds, all created by the Scratch Team and available for free use in any project.

The Music extension's 'play note' block can play notes from C2 (low) to C8 (high) — a range of 6 octaves covering most musical instruments.

The Text-to-Speech extension uses your browser's built-in speech synthesis. Different browsers and operating systems have different voice quality and available languages.

Scratch can recognize sound input through your microphone using the 'loudness' sensor, but it cannot recognize specific words or commands without additional extensions.

The 'drums' in the Music extension are actually synthesized sounds, not recorded samples. This keeps the project file size small.

Common Misconceptions

Misconception: 'Start sound' and 'play sound until done' do the same thing.

Truth: 'Start sound' begins playing and immediately continues to the next block, allowing overlapping sounds. 'Play sound until done' waits for the sound to finish before continuing.

Misconception: Sounds can only be chosen from the library.

Truth: You can record your own sounds, import MP3 and WAV files, or use the Text-to-Speech extension to generate spoken audio.

Misconception: Volume affects only the current sprite.

Truth: Each sprite has its own volume setting. The stage also has a volume that affects the overall project. Changing stage volume affects all sprites.

Misconception: The microphone cannot be used in Scratch.

Truth: Scratch has a 'loudness' Sensing Block that measures microphone input. It can be used to create projects controlled by sound, though it measures volume level, not specific words.

Knowledge Check

1. What is the main role of Sound Blocks?

Answer: To orchestrate behaviors and controls visually

2. Which block shape starts a script stack in Scratch?

Answer: Hat block (curved top)

3. What is the maximum X coordinate limit on the stage?

Answer: 240