Hello everyone, I am a ruffian balance, is a serious technical ruffian. Today, ruffian Heng is to introduce to you the speech processing tool pzh-py-Speech birth environment.
To write Pzh-py-Speech, you need to set up the development environment first. The following table lists all the software/toolkits that will be used during development:
1. List of tools involved
tool | function | Download address |
---|---|---|
Python 2.7.14 | Official Python package (interpreter) | www.python.org/ |
PyAudio 0.2.11 | Cross-platform open source Audio I/O libraryPortAudioThe Python package | People.csail.mit.edu/hubert/pyau… |
Matplotlib 2.2.3 | A very powerful Python 2D drawing library | matplotlib.org/ Github.com/matplotlib/… |
NumPy 1.15.0 | Basic Python Scientific computing package | www.numpy.org/ www.scipy.org/ |
SpeechRecognition 3.8.1 | A multi-engine Python speech recognition (ASR) library | Github.com/Uberi/speec… |
PocketSphinx 0.1.15 | Carnegie-mellon open source speech recognition engineCMU SphinxThe Python package | Github.com/bambocher/p… Pypi.org/project/poc… |
Pyttsx3 2.7 | PyTTS, a continuation of the PyTTsX project, is a lightweight Python text synthesis engine | Github.com/nateshmbhat… Pypi.org/project/pyt… |
ESpeak 1.48.04 | An open source TTS that saves transformation results as WAV | espeak.sourceforge.net/ |
WxPython 4.0.3 | Cross-platform open source GUI librarywxWidgetsPython wrapper library | www.wxpython.org/ Pypi.org/project/wxP… |
WxFormBuilder 3.8.0 | WxPython GUI interface building tool | Github.com/wxFormBuild… |
PyCharm Community 2018.02 | A popular Python integrated development environment | www.jetbrains.com/pycharm/ |
Python + PyAudio + Matplotlib + NumPy
The pzh-py-Speech tool is a fully developed application based on Python language. Install Python 2.7.14, and install C: tools_mcu\Python27. Make sure to include the path (C:\tools_mcu\Python27) in the system environment variables after the installation is complete, as this path contains python.exe, which will be called by subsequent Python commands. PIP is a Python package management tool that allows you to install PyAudio and Matplotlib packages (NumPy is included in Matplotlib) :
PS C:\tools_mcu\Python27\Scripts> .\pip.exe install pyaudio
Collecting pyaudio Downloading https://files.pythonhosted.org/packages/94/3e/430d4e4e24e89b19c1df052644f69e03d64c1ae2e83f5a14bd365e0236de/PyAudio-0.2.1 1-CP27-CP27M-WIN_AMD64. WHL (52kB) Installing COLLECTED packages: Pyaudio Successfully installed Pyaudio-0.2.11Copy the code
PS C:\tools_mcu\Python27\Scripts> .\pip.exe install matplotlib
Collecting matplotlib Downloading https://files.pythonhosted.org/packages/f7/5b/4bc804df462961a3f0d138243611ce24b7899db04e6043e46df0ff1080e9/matplotlib-2. 2.3- CP27-CP27M-WIN_AMD64. WHL (8.4MB) Downloading backports. Functools-lru-cache (from Matplotlib) Downloading https://files.pythonhosted.org/packages/03/8e/2424c0e65c4a066e28f539364deee49b6451f8fcd4f718fefa50cc3dcf48/backports.fun WHL Requirement Already satisfied, skipping upgrade: Collecting pytz (from matplotlib) six>=1.10 in C :\tools_mcu\python27\lib\site-packages (from matplotlib) (1.11.0) Collecting Pytz (from matplotlib) Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-p Y2.py3-none-any. WHL (510kB) Collecting cycler>=0.10 (from Matplotlib) Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0 -py2.py3-none-any. WHL Collecting Kiwisolver >= Downloading from matplotlib https://files.pythonhosted.org/packages/e0/3a/2fda27dacdfafcf8f40cce2be09890b1443af3e65c3ab8f7294216a2946b/kiwisolver-1. 0.1-CP27-none-win_AMd64. WHL (64kB) Downloading python-dateutil>=2.1 (from Matplotlib) Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateut Il - 2.7.3 - py2. Py3 - none - any. WHL (211 KB) Collecting pyparsing! = 2.0.4,! = 2.1.2,! = 2.1.6, > = 2.0.1 (from matplotlib) Downloading https://files.pythonhosted.org/packages/6a/8a/718fd7d3458f9fab8e67186b00abdd345b639976bc7fb3ae722e1b026a50/pyparsing-2.2 0-py2.py3-none-any. WHL (56kB) Collecting Numpy >=1.7.1 (from Matplotlib) Downloading https://files.pythonhosted.org/packages/3d/d6/f04730ad69240be04584b3979dcd2f0b25f9e58463547df6fcafa139c567/numpy-1.15.0- Cp27-none-win_amd64. WHL (13.5MB) Requirement already satisfied, skipping upgrade: Setuptools in C: tools_mcu python27 lib site-packages (from Kiwisolver >=1.0.1->matplotlib) (28.8.0) Installing COLLECTED packages: backports.functools-lru-cache, pytz, cycler, kiwisolver, python-dateutil, pyparsing, numpy, Functools-lru-cache-1.5 cycler-0.10.0 kiwisolver-1.0.1 matplotlib Successfully installed backports. Functools-lru-cache-1.5 cycler-0.10.0 kiwisolver-1.0.1 matplotlib 2.2.3 Numpy - 1.15.0 pyparsing - 2.2.0 python - dateutil - 2.7.3 pytz - 2018.5Copy the code
With PyAudio you can read and write Audio, and with Matplotlib you can graphically display Audio as a waveform. With these two tools installed, the Python infrastructure for JaysPySPEECH tool development is ready.
Note: For the installation of GUI and debugging tools (wxPython, wxFormBuilder, PyCharm), please refer to tinyPyCOM, another work of Ruffian.
SpeechRecognition + PocketSphinx + PyTTSX3 + eSpeak
Pzh-py-speech was originally designed to support speech recognition and text-to-speech conversion, as we needed to install Python libraries. SpeechRecognition is a popular Python library that supports multiple engines for speech recognition. It’s your choice for Pzh-py-Speech. The voice recognition engine is PocketSphinx, which can work offline. The installation is as follows:
PS C:\tools_mcu\Python27\Scripts> .\pip.exe install SpeechRecognition
Collecting SpeechRecognition Downloading https://files.pythonhosted.org/packages/26/e1/7f5678cd94ec1234269d23756dbdaa4c8cfaed973412f88ae8adf7893a50/SpeechRecogni Wine-3.8.1-py2. py3-none-any. WHL (32.8MB) Installing COLLECTED packages: SpeechRecognition Successfully installed SpeechRecognition - 3.8.1Copy the code
PS C:\tools_mcu\Python27\Scripts> python -m pip install –upgrade pip setuptools wheel
Requirement already up-to-date: PIP in C: tools_mcu python27 lib site-Packages (18.0) Downloading setuptools Downloading https://files.pythonhosted.org/packages/66/e8/570bb5ca88a8bcd2a1db9c6246bb66615750663ffaaeada95b04ffe74e12/setuptools-40 .2.0-Py2. Py3-none-any. WHL (568kB) Downloading Wheel https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1- py2.py3-none-any.whl (41kB) Installing collected packages: setuptools, wheel Found existing installation: Setuptools 28.8.0 Uninstalling setuptools - 28.8.0: Successfully uninstalled setuptools-28.8.0 Successfully installed setuptools-40.2.0 wheel-0.31.1Copy the code
PS C:\tools_mcu\Python27\Scripts> .\pip.exe install –upgrade pocketsphinx
Collecting pocketsphinx Downloading https://files.pythonhosted.org/packages/38/d3/192476022e989377ab00cb84fb0b18790e400bbd58e464155c58cb4622f8/pocketsphinx- 0.1.15-CP27-CP27m-WIN_AMD64. WHL (29.1MB) Installing COLLECTED packages: Pocketsphinx Successfully installed pocketsphinx - 0.1.15Copy the code
Pyttsx3 is a lightweight Python library, which is a continuation of the classic pyTTS and PyTTSX projects. Its core is Microsoft Speech API (SAPI5), which can work offline. Specific installation is as follows:
PS C:\tools_mcu\Python27\Scripts> .\pip.exe install pyttsx3
Collecting pyttsx3 Downloading https://files.pythonhosted.org/packages/24/4e/580726c73272344d3e74b7aaffae55ff6b6450061fbecb8cc6e112531c02/pyttsx3-2.7.t ar.gz Requirement already satisfied: pypiwin32 in c:\tools_mcu\python27\lib\site-packages (from pyttsx3) (223) Requirement already satisfied: pywin32>=223 in c:\tools_mcu\python27\lib\site-packages (from pypiwin32->pyttsx3) (223) Building wheels for collected packages: pyttsx3 Running setup.py bdist_wheel for pyttsx3 ... done Stored in directory: C:\Users\nxa07314\AppData\Local\pip\Cache\wheels\a2\8a\fe\11112aca9c89142c3a404bc67ef3393a7ad530da26639a05d4 Successfully built PyTTSX3 Installing collected packages: PyTTSX3 Successfully installed PyTTSX3-2.7Copy the code
Pyttsx3 can only speak online and cannot be saved to WAV files, so we need a TTS that can save WAV files. At this point, the Python environment for pzh-py-Speech tool development is complete.
With that, the environment for the birth of pzh-py-Speech is over, where is the applause ~~~
Welcome to subscribe to
The article will be published on my blog park homepage, CSDN homepage and wechat public account platform at the same time.
Wechat search “ruffian balance embedded” or scan the following two-dimensional code, you can see the first time on the phone oh.