Skip to main content

کتابخانه تبدیل متن به گفتار فارسی با پشتیبانی از چندین شخصیت صوتی

Project description

PersianTTS

یک کتابخانه فارسی برای تبدیل متن به صدا با شخصیت‌های مختلف.

این کتابخانه به شما امکان می‌دهد متن فارسی را با صدای شخصیت‌های متفاوت به فایل صوتی تبدیل کنید و آن را ذخیره نمایید.


نصب

برای نصب کتابخانه، ابتدا اطمینان حاصل کنید که Python 3.8 یا بالاتر دارید و سپس از pip استفاده کنید:


لیست شخصیت‌ها (Voices)

کلید شخصیت نام شخصیت
woman1 🌼 شیوا
woman2 🌷 مهتاب
woman3 🌺 نگار
woman4 🌹 ریما
man1 🌠 راد
man2 🌠 پیام
man3 🚀 بهمن
man4 🚀 برنا
man5 🚀 برنا-1
man6 🦁 کیان
man7 💧 نیما
man8 ⚡️ آریا
boy1 🌟 آرش
from py_persian_tts import PersianTTS, list_voices
import asyncio

async def main():
    tts = PersianTTS(default_voice="man1")
    
    # نمایش شخصیت‌ها
    print("شخصیت‌ها:", list_voices())
    
    # تبدیل متن به صدا (نسخه async)
    await tts.speak_async("سلام این یک تست است.", voice="man2", filename="tewst.wav")
    print("عملیات با موفقیت انجام شد")



# اجرای تابع async
if __name__ == "__main__":
    asyncio.run(main())

import asyncio
from py_persian_tts import PersianTTS

async def main():
    tts = PersianTTS(default_voice="man1", rate_limit=0.5)  # هر 2 ثانیه یک درخواست

    texts = [
        "سلام این یک تست است",
        "این هم متن دوم برای تست صف TTS.",
        
    ]

    tasks = []
    for i, text in enumerate(texts):
        filename = f"tts_queue_{i+1}.wav"
        # اضافه کردن هر متن به صف و گرفتن Future
        tasks.append(tts.speak_async(text, filename=filename))

    # اجرای همه و گرفتن مسیر فایل‌ها
    results = await asyncio.gather(*tasks)
    for path in results:
        print("فایل صوتی ذخیره شد:", path)

    # پایان کار و توقف پردازش صف
    await tts.shutdown()

# اجرای مثال
asyncio.run(main())


```bash
pip install --upgrade  py-persian-tts 

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

py_persian_tts-1.2.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_persian_tts-1.2.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file py_persian_tts-1.2.2.tar.gz.

File metadata

  • Download URL: py_persian_tts-1.2.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for py_persian_tts-1.2.2.tar.gz
Algorithm Hash digest
SHA256 2bffaaa82cc7ebb45ba6c0e8f0caca6f0cdc6c06737092a6fbd596ec3b822d95
MD5 0391449bbfbfdf6971144faa4b96a41a
BLAKE2b-256 2074cdd64b6e51a360f5c29801048064b91bc0de658d4439cfbef26e808f61e7

See more details on using hashes here.

File details

Details for the file py_persian_tts-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: py_persian_tts-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for py_persian_tts-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6944a50a3a4c93a4aefad5044875c7cf1a2d2db692a27e82b17ef5a83c359fcf
MD5 a2f1d72802918dce436578f2b98121f0
BLAKE2b-256 045ead50066e1403c1fbbb664507af4205906e392ce0f8003a7a69f7d98c9d3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page