Here we have a Dockerfile to create a container that will host unimrcp and swig-wrapper.
You will need to have docker and jq installed:
apt install git docker jq
You will need to have unimrcp and swig-wrapper git repo clones at the same level as this repo.
Basically, fork unimrcp and swig-wrapper to your github account and then do:
cd src
git clone https://github.com/YOUR_NAME/unimrcp
git clone https://github.com/YOUR_NAME/swig-wrapper
So that you end up with this:
src
\unimrcp_experiments
\unimrcp
\swig-wrapper
To build the container image:
./build_image.sh
To start the container do:
./start_container.sh
The container will be started with '--network host' so that we can use mrcp clients running outside the container and listen to audio generated by unimrcp.
At the first time or whenever unimrcp or swig-wrapper code changes do:
./prepare_unimrcp_and_swig-wrapper.sh
To simplify opening apps, there is a tmuxinator session definition file that can be used like this:
cd ~/host/unimrcp_experiments
tmuxinator start -p unimrcp_dev.yml
The above will open a tmux session and will start unimrcpserver and sngrep with MRCP parsing support.
Outside the container (so that you can have access to audio devices), you can use an MRCP client like https://github.com/MayamaTakeshi/mrcp_client
and test Speech Synth:
node speechsynth_client.js 127.0.0.1 8060 en-US somevoice "Hello World"
or Speech Recog:
node speechrecog_client.js 127.0.0.1 8060 en-US artifacts/hello_there.wav builtin:speech/transcribe
However the above will actually generate dummy results as unimrcpserver is configured to use the demo synth and demo recog plugins.
Inside the container you can test with umc. Start it like this:
cd /usr/local/unimrcp/bin
./umc
Then execute commands like:
run synth
or
run recog
To build the minimal_app (the app does nothing. It is just a build smoke test) do:
takeshi@unimrcp_dev:~$ cd ~/host/unimrcp_experiments/minimal_app/
takeshi@unimrcp_dev:~/host/unimrcp_experiments/minimal_app$
takeshi@unimrcp_dev:~/host/unimrcp_experiments/minimal_app$ rm CMakeCache.txt CMakeFiles/ cmake_install.cmake -fr
takeshi@unimrcp_dev:~/host/unimrcp_experiments/minimal_app$ cmake -D USER=`whoami` .
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/takeshi/host/unimrcp_experiments/minimal_app
takeshi@unimrcp_dev:~/host/unimrcp_experiments/minimal_app$ make
Scanning dependencies of target app
[ 50%] Building C object CMakeFiles/app.dir/main.c.o
[100%] Linking C executable app
[100%] Built target app
You can run the app by doing:
takeshi@unimrcp_dev:~/host/unimrcp_experiments/minimal_app$ ./app
OK
To test Speech Synth with the swig-wrapper for python do:
PYTHONPATH=~/src/swig-wrapper/Python/wrapper ~/src/unimrcp_experiments/UniSynth.py "hello"
The above will produce a file UniSynth.pcm that you can move to a folder visible to the host and then you can use
ffplay -f s16le -ar 8k -ac 1 UniSynth.pcm
in the host to hear it.
Then to test Speech Recog with the swig-wrapper for python do:
PYTHONPATH=~/src/swig-wrapper/Python/wrapper ~/src/unimrcp_experiments/UniRecog.py /usr/local/unimrcp/data/grammar.xml UniSynth.pcm
But again, the output for both synth and recog is bogus as we are using the demo plugins.