Skip to main content

These are two neural networks connected by the same module. One for recognition, the other for voice generation.

Project description

voicehelper.py

Описание

Это модуль соединивший в себе две нейронные сети. Для упрощения создания голосового помошника.

Установка

pip install --upgrade voicehelper.py

!!! Р’РќРМЕНРР• !!! Установка torch должна происходить отдельно. Сайт PyTorch Installation

Название моделей для загрузки

Пример

  • Пример создания Голосового Ассистента
import VoiceHelper
from rich.console import Console

# Консоль
c = Console()

# Класс нейросети
c.clear()
c.rule("Запуск")

# Процесс иницализации
try:
    ssynth = VoiceHelper.SpeechSynthesizer(
        device_type="cuda"
    )
except:
    ssynth = VoiceHelper.SpeechSynthesizer(
        device_type="cpu"
    )
vh = VoiceHelper.VoiceHelper(
    ssynth,
    VoiceHelper.SpeechRecognition()
)

# Команды
@vh.add_command("привет")
def Hello(event: VoiceHelper.Event):
    vh.say("Ага, я здесь!")

@vh.add_command(["скажи <text>"])
def cSay(event: VoiceHelper.Event, text: str):
    vh.say(text)

@vh.add_command("РїРѕРєР°")
def cGoodBye(event: VoiceHelper.Event):
    vh.say("До свидания!")
    vh.stop()

@vh.add_command("<text>")
def cLogger(event: VoiceHelper.Event, text: str) -> None:
    c.print(f"[red]You[/] [green]->[/] [yellow]{text}[/]")

# Запуск
if __name__ == "__main__":
    c.rule("Логи")
    vh.start()
  • Пример генерации голоса
from VoiceHelper.NueroNetworks import SpeechSynthesizer

ss = SpeechSynthesizer(sample_rate=48000, thread_count=1) # по умолчанию стоит русская речь

with open("test.wav", "wb") as file:
    file.write(ss.get_audio_bytes("Привет!", "WAV", "PCM_32"))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

voicehelper.py-0.1.7-py39-none-any.whl (100.8 MB view hashes)

Uploaded Python 3.9

Supported by

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