La synthèse vocale de Cortana avec Piper
Objectif : télécharger les modèles et faire parler Cortana avec la synthèse vocale Piper.
Télécharger du modèles
Modèle voix Home Assistant (réponse sub-seconde) ollama pull llama3.2:3b # ~2 Go
Piper TTS — Voix de Cortana
La voix exacte de Cortana (Microsoft) est propriétaire.
Plus proche en open source : en_US-hfc_female-medium via Piper.
cd /opt/data/piper
python3 -m venv venv
source venv/bin/activate
pip install piper-tts
mkdir -p /opt/data/piper/voices
# Voix principale
wget -O /opt/data/piper/voices/cortana.onnx \
"https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx"
wget -O /opt/data/piper/voices/cortana.onnx.json \
"https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx.json"
# Alternative à tester à l'oreille
wget -O /opt/data/piper/voices/cortana-alt.onnx \
"https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/amy/medium/en_US-amy-medium.onnx"
wget -O /opt/data/piper/voices/cortana-alt.onnx.json \
"https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/amy/medium/en_US-amy-medium.onnx.json"
Modelfile voix :
nano /opt/models/ollama-modelfiles/Modelfile-voice
FROM llama3.2:3b
PARAMETER temperature 0.5
PARAMETER top_p 0.85
PARAMETER num_predict 128
PARAMETER num_ctx 4096
SYSTEM """
Tu es Cortana, assistante vocale de Major.
Réponds en UNE phrase courte, orale, sans markdown, en français.
Directe, légèrement sèche. Jamais plus d'une phrase.
"""
ollama create cortana-voice -f /opt/models/ollama-modelfiles/Modelfile-voice
Test :
echo "Cortana en ligne. Prête, Major." | \
/opt/data/piper/venv/bin/python3 -m piper \
--model /opt/data/piper/voices/cortana.onnx --output_file /tmp/test.wav
aplay /tmp/test.wav
sudo nano /etc/systemd/system/piper-tts.service
[Unit]
Description=Piper TTS — Voix de Cortana
After=network.target
[Service]
Type=simple
User=TON_USER
Group=TON_USER
WorkingDirectory=/opt/data/piper
ExecStart=/opt/data/piper/venv/bin/python3 -m piper.http_server \
--model /opt/data/piper/voices/cortana.onnx \
--host 0.0.0.0 --port 5500
Restart=on-failure
RestartSec=5
Environment="PATH=/opt/data/piper/venv/bin:/usr/local/bin:/usr/bin:/bin"
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now piper-tts