Skip to main content

3.2.1 Audio Capture with USB Microphone

Last Version: 10/09/2025

This guide shows how to set up a USB microphone on your SpacemiT development board, install the required runtime environment, and capture audio using a Python example program.

Clone Repository

Clone the example code repository and navigate to the NLP example directory:

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

Install Runtime Environment

Install required system packages, create a Python virtual environment, and install Python dependencies:

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
  • Press Enter to begin audio capture.
  • Maximum capture duration per session is 4 seconds.
  • The recorded audio file is saved as record.pcm.