Build a smart voice speaker on K1

Wukong-Robot is a simple, flexible and elegant multi-language voice conversation robot/smart speaker project, which aims to help Chinese Makers and Hackers quickly build personalized smart speakers. The project features support for brain-computer wake-up and integrates a variety of speech recognition and synthesis technologies. This article will guide you on how to build Wukong-Robot in your development environment and realize the functions of a smart voice speaker.

Environmental Requirements

Before you begin, make sure your system meets the following requirements:

  • Python version: Python 3.7 and above is required.
  • Operating system: Applicable to Linux system.

Step 1: Install Wukong-Robot

1.1 Clone the Wukong-Robot repository

Execute the following command in the terminal to clone the Wukong-Robot GitHub repository:

git clone https://github.com/wzpan/wukong-robot.git
cd wukong-robot

1.2 Install the required audio library

Install the required audio library according to your system environment:

Linux

sudo apt-get update -y
sudo apt-get install portaudio19-dev python-pyaudio python3-pyaudio sox pulseaudio libsox-fmt-all ffmpeg
pip3 install pyaudio

1.3 Install dependent Python libraries

Install the dependent libraries required for the project:

pip3 install -r requirements.txt

1.4 Compile offline wake-up engine

Wukong-Robot supports multiple offline wake-up engines, such as Snowboy and Porcupine. In order to use the offline wake-up engine, you need to compile the _snowboydetect.so file.

First, make sure your system has swig installed:

Linux

cd $HOME
wget https://wzpan-1253537070.cos.ap-guangzhou.myqcloud.com/misc/swig-3.0.10.tar.gz
tar xvf swig-3.0.10.tar.gz
cd swig-3.0.10
sudo apt-get install -y libpcre3 libpcre3-dev
./configure --prefix=/usr --without-clisp --without-maximum-compile-warnings
make
sudo make install

Next, build Snowboy:

cd $HOME
wget https://wzpan-1253537070.cos.ap-guangzhou.myqcloud.com/wukong/snowboy.tar.bz2
tar -xvjf snowboy.tar.bz2
cd snowboy/swig/Python3
make
cp _snowboydetect.so ../..

Step 2: Install third-party skill plugins

Wukong-Robot provides a rich plugin library that can expand the robot’s functions. Install the skill plugin library wukong-contrib:

mkdir $HOME/.wukong
cd $HOME/.wukong
git clone http://github.com/wzpan/wukong-contrib.git contrib
pip3 install -r contrib/requirements.txt

Step 3: First run configuration

When you run Wukong-Robot for the first time, the system will automatically generate the configuration file config.yml in the ~/.wukong directory. You can start Wukong-Robot with the following command:

python3 wukong.py

Please make sure the items in the configuration file are configured correctly so that Wukong-Robot can work properly.

Features

Wukong-Robot provides a series of powerful features, including:

  • Modular design: Speech recognition, synthesis and conversational robot functions are highly modular and easy to expand.
  • Support for multiple Chinese languages: Integrates multiple speech recognition and synthesis technologies, including Baidu, iFlytek, etc.
  • Conversational robot: Supports local and online conversational robot access, and provides intelligent conversation functions.
  • Offline wake-up: Supports multiple wake-up methods, including voice commands and shake.
  • Smart home control: Supports linkage with multiple smart home protocols to achieve voice control.
  • Open API: Provides open API interface and supports function expansion.

Conclusion

Through this tutorial, you have successfully built the Wukong-Robot smart voice speaker. This project provides developers with rich functions and flexible configuration options, which can easily realize personalized smart speakers. You can expand the functions as needed to create a smart voice assistant that meets your needs. I hope you have fun in the development process!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top