Code Monkey home page Code Monkey logo

tpocketsphinx's Introduction

TPocketSphinx

The minimal set of pocketpshinx (and sphinxbase) headers, translated to Object Pascal. Custom thread wrapper TPocketSphinx is capable of recognizing English speech live from a default audio source in Windows and Linux, call back with status and hypothesis if available.

Building examples

  1. Demos: colors and anyword were designed in Lazarus (version 1.6.4 used). Demo anyword-delphi was tested in Delphi 10.2 Tokyo.

  2. Linux only: pocketsphinx installation is explained in this tutorial. Basically ./configure and make install for sphinxbase and pocketsphinx (in this order).

  3. Build any of the examples:
    examples\colors\PocketSphinxColors.lpi - Recognition of few words defined in grammar and dictionary files: black, blue, green, red, yellow, white. This demo will initialize very quickly and use minimum resources, since dictionary file contains only few words and search scope is limited to them.
    examples\anyword\PocketSphinxAnyWord.lpi - Recognition of any word from a US English dictionary (~135k words), in Ngram language model search mode.
    examples\anyword-delphi\PocketSphinxDelphi.dproj - Above demo but for Delphi

    If building in Lazarus for Linux, change build configuration respectively (Windows configuration is default).

  4. Download and unpack latest pocketsphinx (pocketsphinx-5prealpha-win32.zip originally used).
    Copy files:

    • all files and subdirectories pocketsphinx\model\en-us to bin\en-us Windows:
    • pocketsphinx\bin\Release\Win32\pocketsphinx.dll to bin\pocketsphinx.dll
    • pocketsphinx\bin\Release\Win32\sphinxbase.dll to bin\sphinxbase.dll
  5. Make sure your recording device is set to microphone in system, since examples make use of default audio device.

  6. Execute built demo and speak. If PocketSphinx fails to initialize - rebuild demo with Debug configuration, ps.log file is created with full log.
    In Windows if you get an error: "missing MSVCR110D.DLL", try installing Microsoft Visual C++ 2012 Redistributable in your system.

Creating new grammar

Colors demo explains how to limit acceptable words via JSpeech Grammar Format file bin\colors\colors.gram
To create a new list of "accepted" words that can be used in your "command and control" type of application:

  • Define words in grammar file, accordingly to your set of rules (words combine, repetitions etc.)
  • Create dictionary file with all of those words, and their pronunciation with tools listed below
  • Load dictionary and add new search with LoadDictionary and AddGrammarSearchFile
Multiple words to pronunciation (.dic) file Single word to pronunciation
LOGIOS Lexicon Tool The CMU Pronouncing Dictionary
http://www.speech.cs.cmu.edu/tools/lextool.html http://www.speech.cs.cmu.edu/cgi-bin/cmudict

Make sure that words in your dictionary and grammar file are lowercase or uppercase for both (not mixed), otherwise PocketSphinx will fail to initialize.

Donate

PayPal: Donate with PayPal Bitcoin: Donate with Bitcoin

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.