NAO Voice Control is a Python push-to-talk voice interface for a SoftBank NAO robot. It records audio from your computer's microphone, transcribes it with OpenAI, maps common robot-control phrases to NAO actions, and sends everything else to a conversational model for spoken replies.
- Toggle push-to-talk with the Enter key
- Turn on NAO sound awareness so the robot faces nearby sound
- Speak responses with
ALAnimatedSpeechgestures - Auto-wave on greetings and farewells
- Execute built-in voice commands without sending them to the chat model
- Python 3
- A microphone connected to the computer running the script
- A reachable NAO robot with SSH access
qicliavailable on the robot over SSH- An OpenAI API key
Install Python dependencies:
pip3 install openai sounddevice soundfile numpyIf soundfile complains about missing native libraries:
brew install libsndfileOpen nao_voice_ptt.py and set:
OPENAI_API_KEYto your OpenAI API keySYSTEM_PROMPTif you want different robot personality or behaviorCHAT_MODELandTRANSCRIBE_MODELif you want to swap models
Run with the robot hostname:
python3 nao_voice_ptt.py naoOr run with the robot IP:
python3 nao_voice_ptt.py 192.168.1.102- Press
Enterto start listening - Press
Enteragain to stop recording and send audio - Type
qthen pressEnterto quit
These commands are handled directly in the script:
stand upsit downorcrouchwake uprest,sleep, orrelaxopen left handopen right handclose left handclose right handlook leftlook rightlook uplook downwave
If the spoken input does not match one of these patterns, the script sends the conversation to OpenAI chat and speaks the reply back through NAO.
- Audio is recorded locally at 16 kHz.
- The WAV file is transcribed with
gpt-4o-transcribe. - Known robot-control phrases are matched and executed through
qicliover SSH. - Other requests are sent to
gpt-4o-mini. - The robot speaks the response with animated speech and gesture support.
- The script currently expects the API key to be stored directly in the source file.
- Greeting-like replies may trigger an automatic wave.
- Test movement commands in a safe space before using them around people or obstacles.