EasyManua.ls Logo

SunFounder PiCrawler Kit - Page 51

Default Icon
141 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder PiCrawler Kit
(continued from previous page)
music.sound_play_threading('./sounds/sign.wav')
sleep(0.5)
elif key == "t":
words = "Hello"
tts.say(words)
if __name__ == "__main__":
main()
How it works?
Functions related to background music include these:
music = Music() : Declare the object.
music.music_set_volume(20) : Set the volume, the range is 0~100.
music.music_play(./musics/sports-Ahjay_Stelino.mp3) : Play music files, here is the sports-
Ahjay_Stelino.mp3 file under the ./musics path.
music.music_stop() : Stop playing background music.
Note: You can add different sound effects or music to musics or sounds folder via Filezilla Software.
Functions related to sound effects include these:
music = Music()
music.sound_play('./sounds/talk1.wav'): Play the sound effect file, here is the talk1.wav file under the
./musics path.
music.sound_play_threading('./sounds/talk1.wav'): Play the sound effect file in a new thread mode
without suspending the main thread.
Functions related to Text to Speech include these:
tts = TTS()
tts.say(words) : Text audio.
tts.lang("en-US") : Set the language.
Note: Set the language by setting the parameters of lang("") with the following characters.
Table 1: Language
zh-CN Mandarin (Chinese)
en-US English-United States
en-GB English-United Kingdom
de-DE Germany-Deutsch
es-ES España-Español
fr-FR France-Le français
it-IT Italia-lingua italiana
3.5. Sound Effect 47

Other manuals for SunFounder PiCrawler Kit

Related product manuals