๐Ÿ”Š Soundsยถ

If you plug in a USB audio device into your Tingbot, you can play sounds.

Example: Simple sounds appยถ
import tingbot
from tingbot import *

sound = Sound('car_chirp.wav')

@left_button.press
def on_press():
    sound.play()

@every(seconds=1.0/30)
def draw():
    screen.fill(color='black')
    screen.text('Press the left button to play a sound.')

tingbot.run()
class Sound(filename)ยถ

Loads a sound ready for playing. Currently WAV and OGG files are supported.

play(loop=False)ยถ

Starts the playback of the sound.

Parameters:loop (bool) – Pass True to loop the sound until stop() is called.
stop()ยถ

Stops the sound.