![]() ![]() ![]() paInt16, channels = 1, rate = 16000, input = True, frames_per_buffer = 8192 ) stream. Speak something and you will see your voice converted to text and printed on the console window. Now we going to call the pyaudio to use the microphone to catch the voice. Open your Windows command prompt or any other terminal that you are comfortable using and CD to the path where you have saved the Python script file. Now as usual we have to import the microphone to our code so we import pyaudio Now we going to create a variable called " recognizer " and assign KaldiRecognizer recognizer = KaldiRecognizer (model, 16000 ) What we do here we create a variable called " model " and assign our unzip folder location with the Model speech-recognition/ Now create a variable called " model " and type this model = Model (r "C: \\Users\User\Desktop\python practice \ai \vosk-model-small-en-us-0.15" ) ├─ offline-speech-recognition.py ( python file ) ![]() ├─ vosk-model-small-en-us-0.15 ( Unzip follder ) Here I use " vosk-model-small-en-us-0.15 " as my modelĪfter download, you can see it is a compressed file unzip it in your root folder, like this speech-recognition/ Now we have to download the model for that go to this website and choose your preferred model and download it: Here what we do is import the model and the kaldiRecognizer from the vosk library. first, we need to import all the necessary from vosk import Model, KaldiRecognizer Now our pre-requirements are done, now we have to build the offline speech recognition program. Now we need to install my audio pip install pyaudio to install it on your computer type this command pip3 install vosk In the first article, we talk and building a speech recognition system but it uses the internet to connect to google and use its speech recognition algorithm, today in this article we going to build a speech recognition system when you are offline.įirst of all, there is a python library called, VOSK. ![]()
0 Comments
Leave a Reply. |