annotate service/speechMusic/speechMusic.py @ 1258:f0bbab217983

speechmusic can now fetch from http Ignore-this: 111d84089591287c786f9119bbe546a darcs-hash:29345c38a1f76d6aaf0f58a34d26c5344b234356
author drewp <drewp@bigasterisk.com>
date Fri, 19 Apr 2019 14:24:09 -0700
parents c0721332a9fe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
1 #!bin/python
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
2 """
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
3 play sounds according to POST requests.
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
4 """
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
5 from __future__ import division
1258
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
6 import sys, tempfile, itertools
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
7 from pyjade.ext.mako import preprocessor as mako_preprocessor
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
8 from mako.lookup import TemplateLookup
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
9 from twisted.internet import reactor
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
10 from cyclone.httpclient import fetch
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
11 from generator import tts
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
12 import xml.etree.ElementTree as ET
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
13 from klein import Klein
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
14 from twisted.web.static import File
1164
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
15 from logsetup import log
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
16 import pygame.mixer
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
17 class URIRef(str): pass
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
18
1258
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
19 soundCount = itertools.count()
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
20 templates = TemplateLookup(directories=['.'],
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
21 preprocessor=mako_preprocessor,
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
22 filesystem_checks=True)
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
23
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
24 def makeSpeech(speech, fast=False):
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
25 speechWav = tempfile.NamedTemporaryFile(suffix='.wav')
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
26
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
27 root = ET.Element("SABLE")
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
28 r = ET.SubElement(root, "RATE",
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
29 attrib=dict(SPEED="+50%" if fast else "+0%"))
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
30 for sentence in speech.split('.'):
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
31 div = ET.SubElement(r, "DIV")
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
32 div.set("TYPE", "sentence")
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
33 div.text = sentence
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
34
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
35 speechSecs = tts(speech, speechWav.name)
1164
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
36 return pygame.mixer.Sound(speechWav.name), speechSecs
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
37
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
38 class LOADING(object): pass
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
39
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
40 class SoundEffects(object):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
41 def __init__(self):
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
42 self.buffers = {} # URIRef : pygame.mixer.Sound
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
43 self.playingSources = []
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
44 self.queued = []
1256
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
45 self.volume = 1 # level for the next sound that's played (or existing instances of the same sound)
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
46
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
47 def _getSound(self, uri):
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
48 def done(resp):
1258
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
49 path = '/tmp/sound_%s' % next(soundCount)
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
50 with open(path, 'w') as out:
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
51 out.write(resp.body)
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
52 log.info('write %s bytes to %s', len(resp.body), path)
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
53 self.buffers[uri] = pygame.mixer.Sound(path)
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
54
1258
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
55 return fetch(uri).addCallback(done).addErrback(log.error)
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
56
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
57 def playEffect(self, uri):
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
58 if uri not in self.buffers:
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
59 self.buffers[uri] = LOADING
1258
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
60 self._getSound(uri).addCallback(lambda ret: self.playEffect(uri))
f0bbab217983 speechmusic can now fetch from http
drewp <drewp@bigasterisk.com>
parents: 1257
diff changeset
61 return
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
62 if self.buffers[uri] is LOADING:
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
63 # The first playback loads then plays, but any attempts
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
64 # during that load are dropped, not queued.
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
65 return
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
66 snd = self.buffers[uri]
1256
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
67 snd.set_volume(self.volume)
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
68 return self.playBuffer(snd)
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
69
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
70 def playSpeech(self, txt, preEffect=None, postEffect=None, preEffectOverlap=0):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
71 buf, secs = makeSpeech(txt)
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
72 t = 0
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
73 if preEffect:
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
74 t += self.playEffect(preEffect)
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
75 t -= preEffectOverlap
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
76
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
77 reactor.callLater(t, self.playBuffer, buf)
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
78 t += secs
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
79
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
80 if postEffect:
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
81 self.playBufferLater(t, self.buffers[postEffect])
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
82
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
83 def playBufferLater(self, t, buf):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
84 self.queued.append(reactor.callLater(t, self.playBuffer, buf))
813
d17164dbd15f speechMusic: don't fail on missing 'name' attr
drewp <drewp@bigasterisk.com>
parents: 809
diff changeset
85
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
86 def playBuffer(self, buf):
1164
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
87 buf.play()
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
88
1164
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
89 secs = buf.get_length()
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
90 self.playingSources.append(buf)
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
91 reactor.callLater(secs + .1, self.done, buf)
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
92 return secs
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
93
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
94 def done(self, src):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
95 try:
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
96 self.playingSources.remove(src)
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
97 except ValueError:
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
98 pass
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
99
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
100 def stopAll(self):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
101 while self.playingSources:
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
102 self.playingSources.pop().stop()
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
103 for q in self.queued:
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
104 q.cancel()
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
105 # doesn't cover the callLater ones
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
106
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
107 class Server(object):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
108 app = Klein()
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
109 def __init__(self, sfx):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
110 self.sfx = sfx
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
111
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
112 @app.route('/static/', branch=True)
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
113 def static(self, request):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
114 return File("./static")
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
115
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
116 @app.route('/', methods=['GET'])
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
117 def index(self, request):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
118 t = templates.get_template("index.jade")
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
119 return t.render(effectNames=[
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
120 dict(name=k, postUri='effects/%s' % k)
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
121 for k in self.sfx.buffers.keys()])
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
122
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
123 @app.route('/speak', methods=['POST'])
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
124 def speak(self, request):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
125 self.sfx.playSpeech(request.args['msg'][0])
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
126 return "ok"
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
127
1256
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
128 @app.route('/playSound', methods=['POST'])
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
129 def effect(self, request):
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
130 uri = request.args['uri'][0]
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
131 self.sfx.playEffect(uri)
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
132 return "ok"
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
133
a723efcf6476 WIP updating to read sounds from http
drewp <drewp@bigasterisk.com>
parents: 1164
diff changeset
134 @app.route('/volume', methods=['PUT'])
1257
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
135 def volume(self, request, name):
c0721332a9fe WIP speechmusic to load from http, but pulseaudio out is broken
drewp <drewp@bigasterisk.com>
parents: 1256
diff changeset
136 self.sfx.setVolume(float(request.args['v'][0]))
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
137 return "ok"
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
138
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
139 @app.route('/stopAll', methods=['POST'])
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
140 def stopAll(self, request):
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
141 self.sfx.stopAll()
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
142 return "ok"
1164
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
143
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
144 pygame.mixer.init()
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
145 sfx = SoundEffects()
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
diff changeset
146
880
89e37684b362 big rewrite of speechMusic to use klein and openal
drewp <drewp@bigasterisk.com>
parents: 841
diff changeset
147 server = Server(sfx)
1164
1fe67fedf5ac move speech_music into docker and into pygame
drewp <drewp@bigasterisk.com>
parents: 1020
diff changeset
148 server.app.run(endpoint_description=r"tcp6:port=9049:interface=\:\:")