Speech recognition: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
/////under construction/////<br />
== Ubuntu/ Mac ==


For Ubuntu:
''Requirements: Python 3.3+''<br />


''Requirements: Python2.6, 2.7, or 3.3+''<br />
https://pypi.python.org/pypi/SpeechRecognition
https://pypi.python.org/pypi/SpeechRecognition
# Install SpeechRecognition 3.8.1
# SpeechRecognition 3.8.1
#*<small>pip install SpeechRecognition</small>
#*<small>pip install SpeechRecognition</small>
#*To quickly try it out, run <small>python -m speech_recognition</small> after installing.
#*To quickly try it out, run <small>python -m speech_recognition</small> after installing.
# PyAudio (for microphone users):
# PyAudio (for microphone users):
#*Install PyAudio using APT: execute <small>sudo apt-get install python-pyaudio python3-pyaudio</small> in a terminal.
#*Install PyAudio using APT: execute <small>sudo apt-get install python-pyaudio python3-pyaudio</small> in a terminal.
# Install pocketsphinx: <small>pip3 install pocketsphinx</small>
# Pocketsphinx:
::[https://bangladroid.wordpress.com/2017/02/16/installing-cmu-sphinx-on-ubuntu/ some tips in case of errors]
## One way:
# Transcribe an audio file: execute <small>python3 [https://github.com/Uberi/speech_recognition/blob/master/examples/audio_transcribe.py audio_transcribe.py]</small>
##*install dependencies: <small>sudo apt-get install gcc automake autoconf libtool bison swig python-dev libpulse-dev</small>
##*Follow the instructions: https://bangladroid.wordpress.com/2017/02/16/installing-cmu-sphinx-on-ubuntu/
## Another way (not sure if it is different or supplementary):
##*<small>pip3 install pocketsphinx</small>
## Test+Errors:
##*Try this: <small>pocketsphinx_continuous</small>
##*If you find this error <span style="color: red">error while loading shared libraries: libpocketsphinx.so.3: cannot open shared object file: No such file or directory</span> do this <small>sudo nano /etc/ld.so.conf</small> and add
##::::::::::::::<small>include usr/local/lib</small>
##::::::::::::::<small>include usr/</small>
##[https://github.com/Uberi/speech_recognition/blob/master/reference/pocketsphinx.rst Install other languages]
# [https://github.com/bambocher/pocketsphinx-python Pocketsphinx Python]:
#:<small>pip install --upgrade pip setuptools wheel</small>
#:<small>pip install --upgrade pocketsphinx</small>
# Examples:
## Transcribe an audio file: run <small>python3 [https://github.com/Uberi/speech_recognition/blob/master/examples/audio_transcribe.py audio_transcribe.py]</small>
## Save audio data to an audio file: run <small>python3 [https://github.com/Uberi/speech_recognition/blob/master/examples/write_audio.py write_audio.py]</small>
 
== Windows ==
 
=== A solution: ===
Install Ubuntu in Windows<br />
https://tutorials.ubuntu.com/tutorial/tutorial-ubuntu-on-windows#0
 
* Open the start page and search for CMD (Command Prompt). Open it and type ''bash''. Now you are in the Ubuntu environment.
* Install git: ''sudo apt install git''
* Install python3:
*:''sudo apt-get update''<br />
*:''sudo apt-get install python3.6''
* Install pip:
*:''sudo apt-get install python-pip python-dev build-essential''
*:''sudo pip install --upgrade pip''
*:''sudo pip install --upgrade virtualenv''
* Install GNU make:
*:''sudo apt-get install build-essential''
* ''sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools''
* Follow the instructions of the Ubuntu version above
 
=== B solution: ===
* Install python3: https://tutorial.djangogirls.org/en/installation/
* Install git: https://git-scm.com/download/win
* Install pocketsphinx: https://cmusphinx.github.io/wiki/tutorialpocketsphinx/#windows OR
<br />
* Install Windows SDC
* Install Visual C++ 2015 Tools for Windows Desktop
 
(...needs development)
 
== Mac ==
(haven't tried it)
https://github.com/watsonbox/homebrew-cmu-sphinx

Latest revision as of 15:13, 6 July 2018

Ubuntu/ Mac

Requirements: Python 3.3+

https://pypi.python.org/pypi/SpeechRecognition

  1. SpeechRecognition 3.8.1
    • pip install SpeechRecognition
    • To quickly try it out, run python -m speech_recognition after installing.
  2. PyAudio (for microphone users):
    • Install PyAudio using APT: execute sudo apt-get install python-pyaudio python3-pyaudio in a terminal.
  3. Pocketsphinx:
    1. One way:
    2. Another way (not sure if it is different or supplementary):
      • pip3 install pocketsphinx
    3. Test+Errors:
      • Try this: pocketsphinx_continuous
      • If you find this error error while loading shared libraries: libpocketsphinx.so.3: cannot open shared object file: No such file or directory do this sudo nano /etc/ld.so.conf and add
      include usr/local/lib
      include usr/
    4. Install other languages
  4. Pocketsphinx Python:
    pip install --upgrade pip setuptools wheel
    pip install --upgrade pocketsphinx
  5. Examples:
    1. Transcribe an audio file: run python3 audio_transcribe.py
    2. Save audio data to an audio file: run python3 write_audio.py

Windows

A solution:

Install Ubuntu in Windows
https://tutorials.ubuntu.com/tutorial/tutorial-ubuntu-on-windows#0

  • Open the start page and search for CMD (Command Prompt). Open it and type bash. Now you are in the Ubuntu environment.
  • Install git: sudo apt install git
  • Install python3:
    sudo apt-get update
    sudo apt-get install python3.6
  • Install pip:
    sudo apt-get install python-pip python-dev build-essential
    sudo pip install --upgrade pip
    sudo pip install --upgrade virtualenv
  • Install GNU make:
    sudo apt-get install build-essential
  • sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools
  • Follow the instructions of the Ubuntu version above

B solution:


  • Install Windows SDC
  • Install Visual C++ 2015 Tools for Windows Desktop

(...needs development)

Mac

(haven't tried it) https://github.com/watsonbox/homebrew-cmu-sphinx