How to make our robot play a sound file? Pro Preview

EV3 MicroPython comes with pre-recorded sound files. Here's how to program your robot to play them.

To access the full video please subscribe to


  • #1627
  • 04 Jun 2020

To play a sound file, you have to use the "ev3.speaker.play_file()" command and set the file you wish to play as an input parameter.

The sound file is called using the "SoundFile" class followed by the name of the sound file.



This command will play the "OKAY" sound file. If we wish to play the "BRAVO", we should change the code to the following:


A full list of the sound files you can use with this class can be found in the "media" section of the PYBRICKS documentation.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Python with LEGO Mindstorms EV3 - Level 2
  • 39
  • 19:58
  • 93
Image for Lesson 1 - Security system.
  • 5
  • 5
  • 10
  • 3d_rotation 1