1212from adafruit_bitmap_font import bitmap_font
1313from adafruit_display_text .bitmap_label import Label
1414
15- from launcher_config import LauncherConfig
15+ try :
16+ from launcher_config import LauncherConfig
17+ except ImportError :
18+
19+ class LauncherConfig :
20+ def __init__ (self ):
21+ self .data = {}
22+ self .audio_output = "headphone"
23+ self .audio_volume_override_danger = 0.75
24+
1625
1726# comment out one of these imports depending on which TTS engine you want to use
1827from tts_aws import WordFetcherTTS
6473
6574word_fetcher = WordFetcherTTS (fj , launcher_config )
6675
76+
6777def play_sound ():
6878 soundPath = None
69- if ' words' in os .listdir (' spell_jam_assets' ):
70- soundPath = ' spell_jam_assets/words/'
79+ if " words" in os .listdir (" spell_jam_assets" ):
80+ soundPath = " spell_jam_assets/words/"
7181 else :
7282 try :
73- sdAssets = os .listdir (' /sd/spell_jam_assets/' )
83+ sdAssets = os .listdir (" /sd/spell_jam_assets/" )
7484 soundPath = f"/sd/spell_jam_assets/{ sdAssets [sdAssets .index ('words' )]} /"
7585 except ValueError :
7686 soundPath = None
@@ -81,11 +91,12 @@ def play_sound():
8191 for sound in os .listdir (soundPath ):
8292 if sound .upper ()[:- 4 ] == lastword .upper ():
8393 if sound [- 4 :] == ".mp3" :
84- fj .play_mp3_file (f' { soundPath } { sound } ' )
94+ fj .play_mp3_file (f" { soundPath } { sound } " )
8595 elif sound [- 4 :] == ".wav" :
86- fj .play_file (f' { soundPath } { sound } ' )
96+ fj .play_file (f" { soundPath } { sound } " )
8797 break
8898
99+
89100def say_and_spell_lastword ():
90101 """
91102 Say the last word, then spell it out one letter at a time, finally say it once more.
0 commit comments