SunFounder PiCar-X Kit
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/car-double-horn.wav') : Play the sound effect file.
• muisc.sound_play_threading('../sounds/car-double-horn.wav') : Play the sound effect file in a
new thread mode without suspending the main thread.
The eSpeak software is used to implement the functions of TTS.
Import the TTS module in robot_hat, which encapsulates functions that convert text to speech.
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
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook!
Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Why Join?
• Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• Learn & Share: Exchange tips and tutorials to enhance your skills.
• Exclusive Previews: Get early access to new product announcements and sneak peeks.
• Special Discounts: Enjoy exclusive discounts on our newest products.
• Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Ready to explore and create with us? Click [] and join today!
4.5. 3. Text to Speech & Sound Effect 57