Piper & Python Reqs Setup
Install Python Requirements
This project uses Piper for text to speech, Ollama Python bindings to interact with an LLM from Python code, and Requests to fetch weather data. All of them are included in the requirements.txt file that is in the project bundle.
Be sure to activate the project virtual environment if it isn't already active, then install all the requirements following command.
source ~/venvs/translator_venv/bin/activate pip install -r requirements.txt
The requirements.txt file is embedded below.
ollama piper-tts requests
For more information about the Ollama Python bindings and a demo script to verify the installation worked see the Python Integration page in the Local LLMs on Raspberry Pi guide.
Download Piper Voice Files
In order to synthesize strings of text into wave audio files containing speech, Piper needs to download the voice files that will be used during synthesis. There are many different voices and languages available for download. This project uses 6 voices, one for each of the languages supported by SmolLM3: English, Spanish, French, Italian, Portuguese, and German.
Individual voice files can be downloaded with a command like:
python -m piper.download_voices it_IT-paola-medium
where it_IT-paola-medium can be any valid language file identifier. See the Piper voice sample page and look in the drop downs to find the full list of available language files.
For convenience the project bundle includes the file download_voices.sh which is a shell script that downloads all of the voices used by the project.
Run it with this command:
./download_voices.sh
Contents of download_voices.sh are embedded below.
# SPDX-FileCopyrightText: 2025 Tim Cocks for Adafruit Industries # # SPDX-License-Identifier: MIT python -m piper.download_voices es_MX-claude-high python -m piper.download_voices de_DE-kerstin-low python -m piper.download_voices fr_FR-upmc-medium python -m piper.download_voices it_IT-paola-medium python -m piper.download_voices pt_BR-jeff-medium python -m piper.download_voices en_US-amy-medium
To test that the Piper library and voices are installed and working correctly, run these commands.
python -m piper -m en_US-amy-medium -f test.wav "Hello world" aplay test.wav
This will generate a wave audio file containing some test speech and then play it with aplay.
Page last edited November 03, 2025
Text editor powered by tinymce.