audio/__main__.py
Go to the documentation of this file.
1 # Copyright 2017 Mycroft AI Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 """
16  Mycroft audio service.
17 
18  This handles playback of audio and speech
19 """
20 from mycroft.configuration import Configuration
21 from mycroft.messagebus.client.ws import WebsocketClient
22 from mycroft.util import reset_sigint_handler, wait_for_exit_signal, \
23  create_daemon, create_echo_function, check_for_signal
24 from mycroft.util.log import LOG
25 
26 import mycroft.audio.speech as speech
27 from .audioservice import AudioService
28 
29 
30 def main():
31  """ Main function. Run when file is invoked. """
33  check_for_signal("isSpeaking")
34  bus = WebsocketClient() # Connect to the Mycroft Messagebus
35  Configuration.init(bus)
36  speech.init(bus)
37 
38  LOG.info("Starting Audio Services")
39  bus.on('message', create_echo_function('AUDIO', ['mycroft.audio.service']))
40  audio = AudioService(bus) # Connect audio service instance to message bus
41  create_daemon(bus.run_forever)
42 
44 
45  speech.shutdown()
46  audio.shutdown()
47 
48 
49 main()
def create_daemon(target, args=(), kwargs=None)
def check_for_signal(signal_name, sec_lifetime=0)
Definition: signal.py:105
def create_echo_function(name, whitelist=None)


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:40