I tried running the offline speech recognition system Julius with python in the Docker virtual environment

I will post my first article.

Julius

Julius is a voice recognition system developed by Kyoto University, and although its accuracy is poor, it has the advantage of being free and can be operated offline.

In the current article, I felt annoyed because there were only things that could not be done without using socket communication to analyze Julius with python, so I hit the command to move Julius directly from python and the code to analyze the result I summarized it as a class.

Below github source code https://github.com/rirma/JuliusVoiceAnalyzer.git

Please note that unnecessary libraries will also be installed. If you don't need it, delete the pip3 installation at the bottom.

Flow to move Julius

① Create a docker container by hitting the following command in the downloaded folder.

$ docker-compose up -d --build

② Enter the created container.

$ docker-compose exec python bash

③ Move to the folder where VoiceAnalyzer.py is located and execute the program.

# cd opt/public/src
# python3 VoiceAnalyzer.py

④ If you say something and get the following execution result, you are successful.

start record
Saved.
20201005220733.wav
enter filename->...........................................................................................................................................................................................................enter filename->1 files processed
Good morning.

Program for voice analysis

A class is defined in VoiceAnalyzer.py to facilitate voice analysis in Julius.

Initialization

def __init__(self, chunk = 1024, format = pyaudio.paInt16, channels = 1, rate = 44100, record_seconds = 2, threshold = 0.1)

Parameters to change as needed

chunk: audio file chunk channels: Channels for audio files rate: sampling rate record_seconds: length to record (seconds) threshold: Loudness (0 ~ 1) to start recording, to prevent recording from starting due to noise

Start recording

def start_record(self, dir_name = '../sound/')

dir_name: Directory name where the audio file is saved Return value: Saved file name (directory name omitted)

Voice analysis

def analyze_voice(self, file_path)

file_path: File to analyze (eg'../sound/20201005220733.wav') Return value: File voice recognition result string

Finally

Julius isn't very accurate, but I think it's useful when you want to create your own startup sound, such as "Hey Siri". I uttered the startup sounds I wanted Julius to recognize many times and absorbed the error by listing them. We hope you find it useful for interactive apps.

Recommended Posts

I tried running the offline speech recognition system Julius with python in the Docker virtual environment
I set the environment variable with Docker and displayed it in Python
I tried running prolog with python 3.8.2.
Movement that changes direction in the coordinate system I tried Python 3
Environment maintenance made with Docker (I want to post-process GrADS in Python
Prepare the execution environment of Python3 with Docker
I tried "differentiating" the image with Python + OpenCV
I tried the least squares method in Python
Create a virtual environment with conda in Python
Install the python package in an offline environment
I tried "binarizing" the image with Python + OpenCV
I tried running faiss with python, Go, Rust
Work in a virtual environment with Python virtualenv.
I tried running Deep Floor Plan with Python 3.6.10.
I installed Pygame with Python 3.5.1 in the environment of pyenv on OS X
When I tried to create a virtual environment with Python, it didn't work
Speech recognition in Python
virtual environment in python
Virtual environment with Python 3.6
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
I tried to graph the packages installed in Python
Japanese can be used with Python in Docker environment
I tried using TradeWave (BitCoin system trading in Python)
I tried to solve the soma cube with python
I tried running TensorFlow in AWS Lambda environment: Preparation
I tried to solve the problem with Python Vol.1
I tried hitting the API with echonest's python client
[New Corona] Is the next peak in December? I tried trend analysis with Python!
The 15th offline real-time I tried to solve the problem of how to write with python
I tried to find the entropy of the image with python
I tried fp-growth with python
I tried scraping with Python
Try running python in a Django environment created with pipenv
I tried "gamma correction" of the image with Python + OpenCV
I tried to simulate how the infection spreads with Python
I tried the accuracy of three Stirling's approximations in python
I tried using the Python library from Ruby with PyCall
I tried the super-resolution algorithm "PULSE" in a Windows environment
How to write offline real time I tried to solve the problem of F02 with Python
I tried running Movidius NCS with python of Raspberry Pi3
I evaluated the strategy of stock system trading with Python.
Reflect the virtual environment created with Miniconda in Jupyter notebook
Prepare python3 environment with Docker
I tried face recognition from the video (OpenCV: python version)
I tried programming the chi-square test in Python and Java.
After enabling the python virtual environment in the batch file, run the python file
I tried to implement the mail sending function in Python
I also tried to imitate the function monad and State monad with a generator in Python
I tried gRPC with Python
I tried scraping with python
I wrote a doctest in "I tried to simulate the probability of a bingo game with Python"
I tried to divide the file into folders with Python
Is the Serverless environment more than 600 times slower? ~ I tried benchmarking with Go, Node.js and Python! ~
A story that didn't work when I tried to log in with the Python requests module
I tried scraping the ranking of Qiita Advent Calendar with Python
I tried to describe the traffic in real time with WebSocket
I tried to solve the ant book beginner's edition with python
I tried running the Python Package Repository (Warehouse) that supports PyPI
[Understanding in the figure] Management of Python virtual environment by Pipenv
[System trade] I tried playing with Stochastic Oscillator by decomposing with python ♬
I tried to process the image in "sketch style" with OpenCV