Introduction: Speech to Text(Intel IoT)

Picture of Speech to Text(Intel IoT)

Hi everyone this is a project

how to make intel edison as SpeechRecognition module

Step 1: Overview:

Picture of Overview:

This project is about making intel Edison Speech recognition system.

This is an module which can use any where in our IoT project

for example: you can use this module in a remote car , you can control the car using your voice instruction.

First of all configure your edison's ALSA configuration

choose your active microphone Intel can connect with microphone in two ways 1. via USB, 2. via Bluetooth.

I used Bluetooth first but I have some issues in my but device so I shifted to USB device.

Step 2: Hardware Needed for This Experiment:

Intel Edison with extension board

USB sound card

Head set with microphone.

okay lets start hack..

First of all configure your edison's ALSA configuration
choose your active microphone Intel can connect with microphone in two ways 1. via USB, 2. via Bluetooth. I used Bluetooth first but I have some issues in my but device so I shifted to USB device.

Connect your USB sound card to edison

then,

root@edison1:~# lsusb

Bus 001 Device 002: ID 047f:da41 Plantronics, Inc. <<< This is my device Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

root@edison1:~# aplay -Ll

sysdefault:CARD=Headset
Plantronics USB Headset, USB Audio Default Audio Device **** List of PLAYBACK Hardware Devices **** card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]

.....

......

root@edison1:~# cat /etc/asound.conf

pcm.!default sysdefault:Headset

test:

root@edison1:~# aplay /usr/share/sounds/alsa/erumbil.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono root@edison1:~#

if you her song you configure right else you should go through these steps again

Step 3: How to Configure

First of all configure your edison's ALSA configuration
choose your active microphone Intel can connect with microphone in two ways 1. via USB, 2. via Bluetooth. I used Bluetooth first but I have some issues in my but device so I shifted to USB device. Connect your USB sound card to edison then, root@edison1:~# lsusb Bus 001 Device 002: ID 047f:da41 Plantronics, Inc. <<< This is my device Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub root@edison1:~# aplay -Ll sysdefault:CARD=Headset Plantronics USB Headset, USB Audio Default Audio Device **** List of PLAYBACK Hardware Devices **** card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] ..... ...... root@edison1:~# cat /etc/asound.conf pcm.!default sysdefault:Headset test: root@edison1:~# aplay /usr/share/sounds/alsa/erumbil.wav Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono root@edison1:~# if you her song you configure right else you should go through these steps again

make sure you installed python

install python pip.

using pip install pypi,

install speech_recognition,

instal PyAudio.

Step 4: Code

Then use this code and execute for speech recognition

import speech_recognition as sr

r = sr.Recognizer() with sr.WavFile("test.wav") as source: # use "test.wav" as the audio source

r.energy_threshold = 4000 audio = r.record(source) # extract audio data from the file

try:

print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition except IndexError: # the API key didn't work

print("No internet connection")

except KeyError: # the API key didn't work

print("Invalid API key or quota maxed out")

except LookupError: # speech is unintelligible

print("Could not understand audio")

#************

Comments

seamster (author)2015-08-24

Nice, thank you for sharing!

vinnarasan (author)seamster2015-08-24

It's okay.. is it useful for u??

seamster (author)vinnarasan2015-08-24

I'm not working on anything currently where I need a speech to text application, but someday I might be :)

It's always good to share your knowledge with others, though, and we're glad you're here and sharing what you make!

vinnarasan (author)seamster2015-08-24

Thanks...

About This Instructable

5,495views

16favorites

License:

More by vinnarasan:Speech to Text(Intel IoT)
Add instructable to: