Skip to content

Commit

Permalink
Play random 'boot' chime (from nabd/sounds/boot) on startup or reconfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
f-laurens committed Apr 25, 2021
1 parent 8a8712d commit 3f838d9
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nabd/nabd.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, nabio):
self._ears_moved_task = None
self.playing_cancelable = False
self.playing_request_id = None
self.boot = True
Nabd.leds_boot(self.nabio, 2)
if self.nabio.has_sound_input():
from . import i18n
Expand All @@ -84,6 +85,7 @@ async def reload_config(self):
"""
Reload configuration.
"""
self.boot = True
if self.nabio.has_sound_input():
from . import i18n
from .asr import ASR
Expand All @@ -107,6 +109,15 @@ async def reload_config(self):
self.nlu = NLU(self._nlu_locale)
Nabd.leds_boot(self.nabio, 4)
self.nabio.set_leds(None, None, None, None, None)
await self.boot_playsound()

async def boot_playsound(self):
"""
Play sound indicating end of boot.
"""
if (self.boot):
await self.nabio.play_sequence([{"audio":["boot/*.mp3"]}])
self.boot = False

async def _do_transition_to_idle(self):
"""
Expand All @@ -116,10 +127,12 @@ async def _do_transition_to_idle(self):
"""
left, right = self.ears["left"], self.ears["right"]
await self.nabio.move_ears_with_leds((255, 0, 255), left, right)
await self.boot_playsound()
self.nabio.pulse(Led.BOTTOM, (255, 0, 255))

async def sleep_setup(self):
self.nabio.set_leds(None, None, None, None, None)
await self.boot_playsound()
await self.nabio.move_ears(
Nabd.SLEEP_EAR_POSITION, Nabd.SLEEP_EAR_POSITION
)
Expand Down
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime01.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime02.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime03.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime04.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime05.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime06.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime07.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime08.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime09.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime10.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime11.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime12.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime13.mp3
1 change: 1 addition & 0 deletions nabd/sounds/boot/Chime14.mp3

0 comments on commit 3f838d9

Please sign in to comment.