element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Upcycle It
  • Challenges & Projects
  • Design Challenges
  • Upcycle It
  • More
  • Cancel
Upcycle It
Blog Upcycle It - Funeka - The Skull #8 : Ask me I'll tell you!
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: sakthi.1260
  • Date Created: 14 May 2017 3:27 PM Date Created
  • Views 1221 views
  • Likes 4 likes
  • Comments 6 comments
  • python
  • pocket_sphinx
  • upcycled_funeka
  • upcycle
  • intel edison
Related
Recommended

Upcycle It - Funeka - The Skull #8 : Ask me I'll tell you!

sakthi.1260
sakthi.1260
14 May 2017

Hello guys.

 

This weeks writeup is using the PocketSphinx to recognize voice commands.

 

The complete documentation can be found here -> CMUSphinx Wiki.

 

Esther Kim Jun has written a great Documentation on Installation and Application Procedures in her Github repository.

 

So what I've done is, I've used the PocketSphinx to call out the gmail.py and the weather.py scripts done in the previous part.

 

The Setup.

Its simple,just plugged in the Microphone into the USB sound card. Looks lil clumsy, have soldered plenty of wires over there.

 

image

 

But I've used a separator cable, since the Headset I'm using is  4-pole jacked (Mic and Speaker comes in same pin)

 

image

I found this guy around , checked it...was broken but the leds were working thought of using it as a notification light when recording happens in speech recognition mode

 

image

 

 

The Code.

import os
import subprocess
import mraa
import time
import pyaudio
import wave
import pocketsphinx as ps
import sphinxbase

LED_GPIO =10
onled=mraa.Gpio(LED_GPIO)
onled.dir(mraa.DIR_OUT)
onled.write(0)

LMD   = "/Skull/6838/6838.lm"
DICTD = "/Skull/6838/6838.dic"
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
RECORD_SECONDS = 2
PATH = 'output'
    
def decodeSpeech(speech_rec, wav_file):
    wav_file = file(wav_file,'rb')
    wav_file.seek(44)
    speech_rec.decode_raw(wav_file)
    result = speech_rec.get_hyp()
    return result[0]

def main():
     
    if not os.path.exists(PATH):
        os.makedirs(PATH)

    p = pyaudio.PyAudio()
    speech_rec = ps.Decoder(lm=LMD, dict=DICTD)

    while True:
        # Record audio
        stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK)
        print("* recording")
        frames = []
        for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
            data = stream.read(CHUNK)
            frames.append(data)
        print("* done recording")
        stream.stop_stream()
        stream.close()
                
        fn = "o.wav"
        wf = wave.open(os.path.join(PATH, fn), 'wb')
        wf.setnchannels(CHANNELS)
        wf.setsampwidth(p.get_sample_size(FORMAT))
        wf.setframerate(RATE)
        wf.writeframes(b''.join(frames))
        wf.close()

         wav_file = os.path.join(PATH, fn)
        recognised = decodeSpeech(speech_rec, wav_file)
        rec_words = recognised.split()        
       # print(str(rec_words))
        if "MAIL" in rec_words :
            subprocess.check_output(['python','/Skull/gmail.py'])
        if "WEATHER" in rec_words :
            subprocess.check_output('python', '/Skull/weather.py'])

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        print "Keyboard interrupt received. Cleaning up..."
       

 

You can also create a custom words Library and Dictionary Files. All you need to do is make a txt file will all the words and upload it to Sphinx Knowledge Base Tool  VERSION 3.

and replace these lines.

LMD   = "/Skull/6838/6838.lm"
DICTD = "/Skull/6838/6838.dic"

 

and here comes the output...

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

The EL sequencer came in....thanks to Workshopshed for suggesting them..

tried playing with them for some time(Sorry couldn't capture a video) , also fitted the EL wire to the skull.

 

imageimage

Got some old Mild Steel pieces from scraps, some welding and tada we got a support for the Skull image

image

 

Also I just wanted to mention things that have been upcycled.

 

 

 

               A LCD Screen

 

               USB Sound Card  

  

               Radio shack Speakers and Amps

 

               Old Headphones with Mic

 

Yet to use :

 

Motors from the CD drive 1 stepper and 1 DC, I already tried using the lasers but it was too hot, got my finger burnt twice so thought of dropping it.

and some components to be desoldered from those scrap boards for decoration.

 

the next week update will be on eye movement, the following week i'll be finishing out the skull.

 

Cheers image

  • Sign in to reply

Top Comments

  • Workshopshed
    Workshopshed over 8 years ago +3
    Looking good, I do like EL wires but have yet to find an excuse to use them. Perhaps can inspire the family to let me do a Halloween project
  • dougw
    dougw over 8 years ago +3
    Nice job so far. I'm envious of your capability to weld up a nice stand.
  • sakthi.1260
    sakthi.1260 over 8 years ago in reply to Workshopshed +2
    And with the sequencer you could do really amazing stuffs, I actually started to design a sequencer board for Arduino mega with 16 Inputs , will share gerber files once done.
Parents
  • dougw
    dougw over 8 years ago

    Nice job so far.

    I'm envious of your capability to weld up a nice stand.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to dougw

    I though the same thing seeing the images Doug, welding iron is something I miss.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to dougw

    I though the same thing seeing the images Doug, welding iron is something I miss.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube