Добавить
Уведомления

Make your own Jarvis - Speech, Libraries and Functions - Tutorial 4

In this video we develop our first module for your voice assistant. Giving Jarvis a voice. To accomplish this we need a basic introduction to libraries and how to install them on your computer, as well as an introduction to functions. This module can then be called upon anywhere in your code where you want Jarvis to say something. The function contains many lines of code, but your main call, is one simple command. Code (Also available at https://github.com/Graemelawrie84/JarvisCode): - #Libraries import pyttsx3 #Functions def Speak(text): rate = 100 #Sets the default rate of speech engine = pyttsx3.init() #Initialises the speech engine voices = engine.getProperty('voices') #sets the properties for speech engine.setProperty('voice', voices[0].id) #Gender and type of voice engine.setProperty('rate', rate+50) #Adjusts the rate of speech engine.say(text) #tells Python to speak variable 'text' engine.runandWait() #runs the previous line and waits for it to complete #Main program Speak("Hello World") #calls Speak function and passes text to be said #Notes """ In this chunk of code we call on a function called Speak. This code will only work if you have installed PYTTSX3 library. Use 'Pip Install PYTTSX3' in Command prompt to install library"""

Иконка канала Геймеры и Легенды
14 подписчиков
12+
15 просмотров
2 года назад
12+
15 просмотров
2 года назад

In this video we develop our first module for your voice assistant. Giving Jarvis a voice. To accomplish this we need a basic introduction to libraries and how to install them on your computer, as well as an introduction to functions. This module can then be called upon anywhere in your code where you want Jarvis to say something. The function contains many lines of code, but your main call, is one simple command. Code (Also available at https://github.com/Graemelawrie84/JarvisCode): - #Libraries import pyttsx3 #Functions def Speak(text): rate = 100 #Sets the default rate of speech engine = pyttsx3.init() #Initialises the speech engine voices = engine.getProperty('voices') #sets the properties for speech engine.setProperty('voice', voices[0].id) #Gender and type of voice engine.setProperty('rate', rate+50) #Adjusts the rate of speech engine.say(text) #tells Python to speak variable 'text' engine.runandWait() #runs the previous line and waits for it to complete #Main program Speak("Hello World") #calls Speak function and passes text to be said #Notes """ In this chunk of code we call on a function called Speak. This code will only work if you have installed PYTTSX3 library. Use 'Pip Install PYTTSX3' in Command prompt to install library"""

, чтобы оставлять комментарии