Sound Block

The Sound block makes sound using the speaker inside the EV3 Brick. You can play pre-recorded sound files or specify a musical note or tone.
Choose the Sound Mode


Mode Selector
File Name input
Inputs

Select which kind of sound you want to make using the Mode Selector. After you have selected the mode, you can choose values for the inputs. The inputs available will change depending on the mode. The modes and inputs are described below.
Modes
Play File
The Play File mode plays a pre-recorded sound file.

The File Name input is at the top of the block. It lets you choose from a list of sound effects, spoken words and phrases. The sounds in the “LEGO Sounds” category are the sound files that are included with the EV3 Software. The sounds listed in the “Project Sounds” category are the sounds that have already been used in your project. This makes it easy to use the same sound multiple times in a program or project.

If you choose “Wired” from the File Name input on the top of the block, a File Name input appears in the inputs area of the Sound block. This allows you to supply the name of the sound file with a Data Wire.

Note that you need to add the sound file to your Project first by selecting it in the File Name input.

The Volume input controls how loud the sound will be.

The Play Type input controls whether the block will wait for the sound to finish before the program continues to the next block, and whether the sound will repeat.
Example 1
This program will make the EV3 Brick say “Turn Right” by playing two different sound files and waiting for each to complete.
Tips and Tricks
The EV3 Brick can only play spoken word sounds that are stored in pre-recorded sound files. The text in the File Name input must be the name of an existing sound file.
Example 2
This program will make a continuous laughing sound at the same time as driving the robot forward for 10 seconds. It does this by using Repeat for the Play Type input.
Play Tone


The Play Tone mode plays a tone of a specified frequency. The frequency of the tone controls the pitch, in other words, how high or low the sound is.

The Frequency input specifies the frequency of the tone in Hz (cycles per second). You can type a number for the frequency or choose a frequency from the list of standard musical note frequencies.

The Duration input controls how long the tone will last, in seconds.
Tips and Tricks
The tones played by the Play Tone mode sound the same as the musical notes played by the Play Note mode, but you can specify an exact frequency using Play Tone.
The Volume input controls how loud the sound will be.

The Play Type input controls whether the block will wait for the sound to finish before the program continues to the next block, and whether the sound will repeat.
Example
This program will make a tone vary in frequency, based on the position of a motor rotation sensor. When you turn the motor by hand, the tone will change.
Play Note


The Play Note mode plays a musical note.

The Note input lets you choose the note from a piano keyboard control.

The Duration input controls how long the note will last in seconds.
Tips and Tricks
You can use a decimal point in the Duration input to get an exact amount of time, including very short intervals. For example, 0.1 seconds will play the note for one tenth of a second.
The Volume input controls how loud the sound will be.

The Play Type input controls whether the block will wait for the sound to finish before the program continues to the next block, and whether the sound will repeat.
Example
This program will play a short tune by playing three different notes.
Stop


The Stop mode stops any sound that is currently being played by the EV3 Brick. This is usually used to stop a sound that was started earlier in the program by a Sound Block that didn’t wait for the sound to complete.
Example
This program will play a tone until a touch sensor is pressed and then stop the tone.
Inputs
The inputs of the Sound block control the details of the sound that is played. You can enter the input values directly into the block. Alternatively, the values can be supplied by Data Wires from the outputs of other Programming Blocks.
InputTypeAllowed ValuesNotes
File Name TextName of an existing sound fileFor example, “Laughing 2”
Note Text“C” through “B”, followed optionally by “#”, followed by “4” through “6”.A-G is a musical note name.
4-6 is an octave number.
“#” means “sharp”.

Examples: “C4” is “middle C” on a standard piano, and “C#4” is one half step higher.
Frequency Number300 to 10000Tone frequency in Hz
Duration Number≥ 0Duration of note or tone in seconds
Volume Control Number0 to 100A percentage of full volume
Play Type Number0, 1, or 20 = Wait for Completion: The sound plays once, and the program waits for the sound to finish before continuing.

1 = Play Once: The sound plays once, and the program continues immediately.

2 = Repeat: The sound will be repeated continuously until another Sound Block is executed, and the program continues immediately.
A-GDo,Ré,Mi
CDo
EMi
FFa
GSol
ALa
BSi
Sound
Quick links