Class Sound

Support beep, play wav files, or convert text to speech.

Declaration

class Sound(object)
source link

Documentation

Examples:

from ev3dev2.sound import Sound

spkr = Sound()

# Play 'bark.wav':
spkr.play_file('bark.wav')

# Introduce yourself:
spkr.speak('Hello, I am Robot')

# Play a small song
spkr.play_song((
    ('D4', 'e3'),
    ('D4', 'e3'),
    ('D4', 'e3'),
    ('G4', 'h'),
    ('D5', 'h')
))

In order to mimic EV3-G API parameters, durations used in methods exposed as EV3-G blocks for sound related operations are expressed as a float number of seconds.

Methods

Reexports