Skip to main content

3.2.1 USB Microphone Usage Guide

Clone Repository

Please clone the example code repository and enter the NLP example directory using the following commands:

git clone https://gitee.com/bianbu/spacemit-demo.git
cd spacemit_demo/examples/NLP

Install Runtime Environment

Execute the following commands to install required dependencies and create a Python virtual environment:

sudo apt install libportaudio2 libopenblas-dev python3-venv python3-pip

python3 -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

Start Audio Capture Program

Run the following command to start the audio capture program:

python 02_capture_audio.py

After the program starts, press Enter to begin audio capture. The maximum duration for a single capture session is 4 seconds, and the recorded file will be saved as record.pcm.