Natural Persian Text-to-Speech. One command.
Project description
Persian Speech
Natural Persian Text-to-Speech. One command.
Install
pip install persian-speech
python -c "import urllib.request, os; os.makedirs('models', exist_ok=True); urllib.request.urlretrieve('https://huggingface.co/MahtaFetrat/Mana-Persian-Piper/resolve/main/fa_IR-mana-medium.onnx', 'models/fa_IR-mana-medium.onnx'); urllib.request.urlretrieve('https://huggingface.co/MahtaFetrat/Mana-Persian-Piper/resolve/main/fa_IR-mana-medium.onnx.json', 'models/fa_IR-mana-medium.onnx.json'); print('Done')"
Usage
Command line:
speech "سلام به همگی" output.wav
Python:
from persian_speech_runtime import talk
talk("سلام به همگی", "output.wav")
Server:
python -c "from persian_speech_runtime import PiperSpeechEngine; from http.server import HTTPServer, BaseHTTPRequestHandler; from urllib.parse import urlparse, parse_qs; tts = PiperSpeechEngine(); exec('class H(BaseHTTPRequestHandler):\\n def do_GET(self):\\n q = parse_qs(urlparse(self.path).query)\\n t = q.get(\"text\",[\"سلام\"])[0]\\n self.send_response(200)\\n self.send_header(\"Content-Type\",\"audio/wav\")\\n self.end_headers()\\n self.wfile.write(tts.stream(t))'); HTTPServer(('0.0.0.0',8000), H).serve_forever()"
# http://localhost:8000/tts?text=سلام
Model
Built on Mana-Persian-Piper, trained on 114 hours of Persian speech from the Mana-TTS dataset.
API
from persian_speech_runtime import PiperSpeechEngine, talk
# One-liner
talk("سلام به همگی", "output.wav")
# Engine
tts = PiperSpeechEngine()
tts.save("سلام به همگی", "output.wav") # Save to file
tts.stream("سلام به همگی") # Get WAV bytes
tts.synthesize("سلام به همگی") # Get numpy array
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
persian_speech-1.0.1.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file persian_speech-1.0.1.tar.gz.
File metadata
- Download URL: persian_speech-1.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c64de953cc4b76a5f7af30d9c1ab8854c71aa95c0b375fb42ca8781dd17b2647
|
|
| MD5 |
50405d26c089dc931e522e58e2eaf97a
|
|
| BLAKE2b-256 |
dd61c73bfa4b285a9fc61fcaddc970868ef5f8621648009501b7b9b91dec449e
|
File details
Details for the file persian_speech-1.0.1-py3-none-any.whl.
File metadata
- Download URL: persian_speech-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
505afe8eecfcdc0fc0e31bd12d3a5fe4321da5e7a14611fdcf13237beb21c106
|
|
| MD5 |
7775d20f3a508d9240d0b4d490c8fd20
|
|
| BLAKE2b-256 |
a66f04d064d947f24cb8fad392e84d355636a0a0e7fe437dea0c8c646e4f54b4
|