🤖
Artificial Intelligence for Idiot
  • Introduction
  • What is Machine Learning
  • Python Basics
    • Random Number
  • Data Manipulation
    • Numpy
    • Pandas
  • Data Visualization
    • Matplotlib
      • Simple drawing
      • Simple line and point
      • Any line and label
      • Annotation in reality
  • Dataset Searching
  • Keras
    • Data preparation
    • Build the simplest model
  • Robot
    • Speech to Text
Powered by GitBook
On this page
  • Installation
  • Give it a try
  • Let's go
  • links may helpful

Was this helpful?

  1. Robot

Speech to Text

Installation

sudo apt-get install python-pyaudio python3-pyaudio

sudo pip3 install speechrecognition

Give it a try

python3 -m speech_recognition

Let's go

import speech_recognition as sr

r = sr.Recognizer()
mic = sr.Microphone()

def get_text(wav_bytes):
    result = here_is_a_function_which_take_voice_then_return_text(wav_bytes)
    return result

while 1:
    print("\nPlease try to speak something...")
    with mic as source:
        r.adjust_for_ambient_noise(source)
        audio = r.listen(source)
        audio_data = audio.get_wav_data(convert_rate=16000)
        print("\nGot you, now I'm trying to recognize that...")
        text = get_text(audio_data)
        print(f"\n{text}")

links may helpful

https://realpython.com/python-speech-recognition/

PreviousRobot

Last updated 6 years ago

Was this helpful?