From 3f838d95d5acf406e14c899c8a37588b7e8f5000 Mon Sep 17 00:00:00 2001 From: Fabrice Laurens Date: Sun, 25 Apr 2021 16:07:58 +0200 Subject: [PATCH] Play random 'boot' chime (from nabd/sounds/boot) on startup or reconfig. --- nabd/nabd.py | 13 +++++++++++++ nabd/sounds/boot/Chime01.mp3 | 1 + nabd/sounds/boot/Chime02.mp3 | 1 + nabd/sounds/boot/Chime03.mp3 | 1 + nabd/sounds/boot/Chime04.mp3 | 1 + nabd/sounds/boot/Chime05.mp3 | 1 + nabd/sounds/boot/Chime06.mp3 | 1 + nabd/sounds/boot/Chime07.mp3 | 1 + nabd/sounds/boot/Chime08.mp3 | 1 + nabd/sounds/boot/Chime09.mp3 | 1 + nabd/sounds/boot/Chime10.mp3 | 1 + nabd/sounds/boot/Chime11.mp3 | 1 + nabd/sounds/boot/Chime12.mp3 | 1 + nabd/sounds/boot/Chime13.mp3 | 1 + nabd/sounds/boot/Chime14.mp3 | 1 + 15 files changed, 27 insertions(+) create mode 120000 nabd/sounds/boot/Chime01.mp3 create mode 120000 nabd/sounds/boot/Chime02.mp3 create mode 120000 nabd/sounds/boot/Chime03.mp3 create mode 120000 nabd/sounds/boot/Chime04.mp3 create mode 120000 nabd/sounds/boot/Chime05.mp3 create mode 120000 nabd/sounds/boot/Chime06.mp3 create mode 120000 nabd/sounds/boot/Chime07.mp3 create mode 120000 nabd/sounds/boot/Chime08.mp3 create mode 120000 nabd/sounds/boot/Chime09.mp3 create mode 120000 nabd/sounds/boot/Chime10.mp3 create mode 120000 nabd/sounds/boot/Chime11.mp3 create mode 120000 nabd/sounds/boot/Chime12.mp3 create mode 120000 nabd/sounds/boot/Chime13.mp3 create mode 120000 nabd/sounds/boot/Chime14.mp3 diff --git a/nabd/nabd.py b/nabd/nabd.py index 42075cec..cd198bea 100644 --- a/nabd/nabd.py +++ b/nabd/nabd.py @@ -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 @@ -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 @@ -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): """ @@ -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 ) diff --git a/nabd/sounds/boot/Chime01.mp3 b/nabd/sounds/boot/Chime01.mp3 new file mode 120000 index 00000000..84e75550 --- /dev/null +++ b/nabd/sounds/boot/Chime01.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration01.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime02.mp3 b/nabd/sounds/boot/Chime02.mp3 new file mode 120000 index 00000000..e21e51ff --- /dev/null +++ b/nabd/sounds/boot/Chime02.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration02.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime03.mp3 b/nabd/sounds/boot/Chime03.mp3 new file mode 120000 index 00000000..e2bac316 --- /dev/null +++ b/nabd/sounds/boot/Chime03.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration03.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime04.mp3 b/nabd/sounds/boot/Chime04.mp3 new file mode 120000 index 00000000..be41e0b0 --- /dev/null +++ b/nabd/sounds/boot/Chime04.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration04.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime05.mp3 b/nabd/sounds/boot/Chime05.mp3 new file mode 120000 index 00000000..6d5b0b65 --- /dev/null +++ b/nabd/sounds/boot/Chime05.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration05.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime06.mp3 b/nabd/sounds/boot/Chime06.mp3 new file mode 120000 index 00000000..606c6679 --- /dev/null +++ b/nabd/sounds/boot/Chime06.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration06.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime07.mp3 b/nabd/sounds/boot/Chime07.mp3 new file mode 120000 index 00000000..26cb4ff1 --- /dev/null +++ b/nabd/sounds/boot/Chime07.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration07.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime08.mp3 b/nabd/sounds/boot/Chime08.mp3 new file mode 120000 index 00000000..e203d44f --- /dev/null +++ b/nabd/sounds/boot/Chime08.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration08.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime09.mp3 b/nabd/sounds/boot/Chime09.mp3 new file mode 120000 index 00000000..c93951fd --- /dev/null +++ b/nabd/sounds/boot/Chime09.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration09.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime10.mp3 b/nabd/sounds/boot/Chime10.mp3 new file mode 120000 index 00000000..0a2e7090 --- /dev/null +++ b/nabd/sounds/boot/Chime10.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration10.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime11.mp3 b/nabd/sounds/boot/Chime11.mp3 new file mode 120000 index 00000000..2ef4d559 --- /dev/null +++ b/nabd/sounds/boot/Chime11.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration11.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime12.mp3 b/nabd/sounds/boot/Chime12.mp3 new file mode 120000 index 00000000..9c0ccc8e --- /dev/null +++ b/nabd/sounds/boot/Chime12.mp3 @@ -0,0 +1 @@ +../../../nabsurprised/sounds/nabsurprised/respirations/Respiration12.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime13.mp3 b/nabd/sounds/boot/Chime13.mp3 new file mode 120000 index 00000000..9dd94f8f --- /dev/null +++ b/nabd/sounds/boot/Chime13.mp3 @@ -0,0 +1 @@ +../../../nabmastodond/sounds/nabmastodond/respirations/Respiration13.mp3 \ No newline at end of file diff --git a/nabd/sounds/boot/Chime14.mp3 b/nabd/sounds/boot/Chime14.mp3 new file mode 120000 index 00000000..7b809361 --- /dev/null +++ b/nabd/sounds/boot/Chime14.mp3 @@ -0,0 +1 @@ +../../../nabmastodond/sounds/nabmastodond/respirations/Respiration14.mp3 \ No newline at end of file