Jarvis Tutorial
Jarvis Tutorial
of a process.
Google has a great Speech Recognition API. This API
converts spoken text (microphone) into written text
(Python strings), briefly Speech to Text. You can simply
speak in a microphone and Google API will translate this
into written text. The API has excellent results for English
language.
In python the with keyword is used when working with
unmanaged resources (like file streams).
PyAudio provides Python bindings for PortAudio, the
cross-platform audio I/O library. With PyAudio, you can
easily use Python to play and record audio on a variety of
platforms, such as GNU/Linux, Microsoft Windows, and
Apple Mac OS X / macOS.
The primary purpose of a Recognizer instance is, of course, to
recognize speech. Each instance comes with a variety of settings
and functionality for recognizing speech from an audio source.
r = sr.Recognizer()
Each recognize_*() method will throw
a speech_recognition.RequestError exception if the API is
unreachable.
Now, instead of using an audio file as the source, you will use the
default system microphone. You can access this by creating an
instance of the Microphone class.
mic = sr.Microphone()
r.recognize_google(audio)
... r.adjust_for_ambient_noise(source)