File: sound.py

package info (click to toggle)
morse-simulator 1.4-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 187,116 kB
  • sloc: ansic: 108,311; python: 25,694; cpp: 786; makefile: 126; xml: 34; sh: 7
file content (27 lines) | stat: -rw-r--r-- 605 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
""" MORSE Sound example

You can control this actuator using any middleware, here using pymorse:

    from pymorse import Morse
    sim = Morse()
    sim.robot.sound.publish({"mode":"stop"})
    sim.robot.sound.publish({"mode":"play"})
    sim.robot.sound.publish({"mode":"pause"})
    sim.close()
"""
from morse.builder import *

robot = ATRV()

keyboard = Keyboard()
keyboard.properties(Speed=3)
robot.append(keyboard)

sound = Sound()
# TODO edit the path to an existing file on your system
sound.open("/path/to/file.mp3")
sound.add_stream('socket')
robot.append(sound)

env = Environment('outdoors')