voicehelper.py


Namevoicehelper.py JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/romanin-rf/voicehelper.py
SummaryThese are two neural networks connected by the same module. One for recognition, the other for voice generation.
upload_time2022-12-21 23:00:45
maintainer
docs_urlNone
authorRomanin
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # voicehelper.py
## Описание
Это модуль соединивший в себе две нейронные сети. Для упрощения создания голосового помошника.
## Установка
```cmd
pip install --upgrade voicehelper.py
```

`!!! Р’РќРМЕНРР• !!!` Установка **torch** должна происходить отдельно. [Сайт PyTorch Installation](https://pytorch.org/get-started/locally/#start-locally)

## Название моделей для загрузки
- Для [SpeechSynthesizer](https://github.com/snakers4/silero-models#v3)
- Для [SpeechRecognition](https://github.com/romanin-rf/voicehelper.py-models#for-speechrecognition)


## Пример
- Пример создания Голосового Ассистента
```python
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()
```
- Пример генерации голоса
```python
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"))
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/romanin-rf/voicehelper.py",
    "name": "voicehelper.py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "Romanin",
    "author_email": "semina054@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# voicehelper.py\n## \u0420\u045b\u0420\u0457\u0420\u0451\u0421\u0403\u0420\u00b0\u0420\u0405\u0420\u0451\u0420\u00b5\n\u0420\u00ad\u0421\u201a\u0420\u0455 \u0420\u0458\u0420\u0455\u0420\u0491\u0421\u0453\u0420\u00bb\u0421\u040a \u0421\u0403\u0420\u0455\u0420\u00b5\u0420\u0491\u0420\u0451\u0420\u0405\u0420\u0451\u0420\u0406\u0421\u20ac\u0420\u0451\u0420\u2116 \u0420\u0406 \u0421\u0403\u0420\u00b5\u0420\u00b1\u0420\u00b5 \u0420\u0491\u0420\u0406\u0420\u00b5 \u0420\u0405\u0420\u00b5\u0420\u2116\u0421\u0402\u0420\u0455\u0420\u0405\u0420\u0405\u0421\u2039\u0420\u00b5 \u0421\u0403\u0420\u00b5\u0421\u201a\u0420\u0451. \u0420\u201d\u0420\u00bb\u0421\u040f \u0421\u0453\u0420\u0457\u0421\u0402\u0420\u0455\u0421\u2030\u0420\u00b5\u0420\u0405\u0420\u0451\u0421\u040f \u0421\u0403\u0420\u0455\u0420\u00b7\u0420\u0491\u0420\u00b0\u0420\u0405\u0420\u0451\u0421\u040f \u0420\u0456\u0420\u0455\u0420\u00bb\u0420\u0455\u0421\u0403\u0420\u0455\u0420\u0406\u0420\u0455\u0420\u0456\u0420\u0455 \u0420\u0457\u0420\u0455\u0420\u0458\u0420\u0455\u0421\u20ac\u0420\u0405\u0420\u0451\u0420\u0454\u0420\u00b0.\n## \u0420\u0408\u0421\u0403\u0421\u201a\u0420\u00b0\u0420\u0405\u0420\u0455\u0420\u0406\u0420\u0454\u0420\u00b0\n```cmd\npip install --upgrade voicehelper.py\n```\n\n`!!! \u0420\u2019\u0420\u045c\u0420\u0420\u045a\u0420\u2022\u0420\u045c\u0420\u0420\u2022 !!!` \u0420\u0408\u0421\u0403\u0421\u201a\u0420\u00b0\u0420\u0405\u0420\u0455\u0420\u0406\u0420\u0454\u0420\u00b0 **torch** \u0420\u0491\u0420\u0455\u0420\u00bb\u0420\u00b6\u0420\u0405\u0420\u00b0 \u0420\u0457\u0421\u0402\u0420\u0455\u0420\u0451\u0421\u0403\u0421\u2026\u0420\u0455\u0420\u0491\u0420\u0451\u0421\u201a\u0421\u040a \u0420\u0455\u0421\u201a\u0420\u0491\u0420\u00b5\u0420\u00bb\u0421\u040a\u0420\u0405\u0420\u0455. [\u0420\u040e\u0420\u00b0\u0420\u2116\u0421\u201a PyTorch Installation](https://pytorch.org/get-started/locally/#start-locally)\n\n## \u0420\u045c\u0420\u00b0\u0420\u00b7\u0420\u0406\u0420\u00b0\u0420\u0405\u0420\u0451\u0420\u00b5 \u0420\u0458\u0420\u0455\u0420\u0491\u0420\u00b5\u0420\u00bb\u0420\u00b5\u0420\u2116 \u0420\u0491\u0420\u00bb\u0421\u040f \u0420\u00b7\u0420\u00b0\u0420\u0456\u0421\u0402\u0421\u0453\u0420\u00b7\u0420\u0454\u0420\u0451\n- \u0420\u201d\u0420\u00bb\u0421\u040f [SpeechSynthesizer](https://github.com/snakers4/silero-models#v3)\n- \u0420\u201d\u0420\u00bb\u0421\u040f [SpeechRecognition](https://github.com/romanin-rf/voicehelper.py-models#for-speechrecognition)\n\n\n## \u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0458\u0420\u00b5\u0421\u0402\n- \u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0458\u0420\u00b5\u0421\u0402 \u0421\u0403\u0420\u0455\u0420\u00b7\u0420\u0491\u0420\u00b0\u0420\u0405\u0420\u0451\u0421\u040f \u0420\u201c\u0420\u0455\u0420\u00bb\u0420\u0455\u0421\u0403\u0420\u0455\u0420\u0406\u0420\u0455\u0420\u0456\u0420\u0455 \u0420\u0452\u0421\u0403\u0421\u0403\u0420\u0451\u0421\u0403\u0421\u201a\u0420\u00b5\u0420\u0405\u0421\u201a\u0420\u00b0\n```python\nimport VoiceHelper\nfrom rich.console import Console\n\n# \u0420\u0459\u0420\u0455\u0420\u0405\u0421\u0403\u0420\u0455\u0420\u00bb\u0421\u040a\nc = Console()\n\n# \u0420\u0459\u0420\u00bb\u0420\u00b0\u0421\u0403\u0421\u0403 \u0420\u0405\u0420\u00b5\u0420\u2116\u0421\u0402\u0420\u0455\u0421\u0403\u0420\u00b5\u0421\u201a\u0420\u0451\nc.clear()\nc.rule(\"\u0420\u2014\u0420\u00b0\u0420\u0457\u0421\u0453\u0421\u0403\u0420\u0454\")\n\n# \u0420\u045f\u0421\u0402\u0420\u0455\u0421\u2020\u0420\u00b5\u0421\u0403\u0421\u0403 \u0420\u0451\u0420\u0405\u0420\u0451\u0421\u2020\u0420\u00b0\u0420\u00bb\u0420\u0451\u0420\u00b7\u0420\u00b0\u0421\u2020\u0420\u0451\u0420\u0451\ntry:\n    ssynth = VoiceHelper.SpeechSynthesizer(\n        device_type=\"cuda\"\n    )\nexcept:\n    ssynth = VoiceHelper.SpeechSynthesizer(\n        device_type=\"cpu\"\n    )\nvh = VoiceHelper.VoiceHelper(\n    ssynth,\n    VoiceHelper.SpeechRecognition()\n)\n\n# \u0420\u0459\u0420\u0455\u0420\u0458\u0420\u00b0\u0420\u0405\u0420\u0491\u0421\u2039\n@vh.add_command(\"\u0420\u0457\u0421\u0402\u0420\u0451\u0420\u0406\u0420\u00b5\u0421\u201a\")\ndef Hello(event: VoiceHelper.Event):\n    vh.say(\"\u0420\u0452\u0420\u0456\u0420\u00b0, \u0421\u040f \u0420\u00b7\u0420\u0491\u0420\u00b5\u0421\u0403\u0421\u040a!\")\n\n@vh.add_command([\"\u0421\u0403\u0420\u0454\u0420\u00b0\u0420\u00b6\u0420\u0451 <text>\"])\ndef cSay(event: VoiceHelper.Event, text: str):\n    vh.say(text)\n\n@vh.add_command(\"\u0420\u0457\u0420\u0455\u0420\u0454\u0420\u00b0\")\ndef cGoodBye(event: VoiceHelper.Event):\n    vh.say(\"\u0420\u201d\u0420\u0455 \u0421\u0403\u0420\u0406\u0420\u0451\u0420\u0491\u0420\u00b0\u0420\u0405\u0420\u0451\u0421\u040f!\")\n    vh.stop()\n\n@vh.add_command(\"<text>\")\ndef cLogger(event: VoiceHelper.Event, text: str) -> None:\n    c.print(f\"[red]You[/] [green]->[/] [yellow]{text}[/]\")\n\n# \u0420\u2014\u0420\u00b0\u0420\u0457\u0421\u0453\u0421\u0403\u0420\u0454\nif __name__ == \"__main__\":\n    c.rule(\"\u0420\u203a\u0420\u0455\u0420\u0456\u0420\u0451\")\n    vh.start()\n```\n- \u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0458\u0420\u00b5\u0421\u0402 \u0420\u0456\u0420\u00b5\u0420\u0405\u0420\u00b5\u0421\u0402\u0420\u00b0\u0421\u2020\u0420\u0451\u0420\u0451 \u0420\u0456\u0420\u0455\u0420\u00bb\u0420\u0455\u0421\u0403\u0420\u00b0\n```python\nfrom VoiceHelper.NueroNetworks import SpeechSynthesizer\n\nss = SpeechSynthesizer(sample_rate=48000, thread_count=1) # \u0420\u0457\u0420\u0455 \u0421\u0453\u0420\u0458\u0420\u0455\u0420\u00bb\u0421\u2021\u0420\u00b0\u0420\u0405\u0420\u0451\u0421\u040b \u0421\u0403\u0421\u201a\u0420\u0455\u0420\u0451\u0421\u201a \u0421\u0402\u0421\u0453\u0421\u0403\u0421\u0403\u0420\u0454\u0420\u00b0\u0421\u040f \u0421\u0402\u0420\u00b5\u0421\u2021\u0421\u040a\n\nwith open(\"test.wav\", \"wb\") as file:\n    file.write(ss.get_audio_bytes(\"\u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0406\u0420\u00b5\u0421\u201a!\", \"WAV\", \"PCM_32\"))\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "These are two neural networks connected by the same module. One for recognition, the other for voice generation.",
    "version": "0.1.7",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b79eed1758bdbdb06c0a85fd88fa13a1",
                "sha256": "628e3403e738925922515c73b7dab4d017774d580633838e5ce77fbce0189a3b"
            },
            "downloads": -1,
            "filename": "voicehelper.py-0.1.7-py39-none-any.whl",
            "has_sig": false,
            "md5_digest": "b79eed1758bdbdb06c0a85fd88fa13a1",
            "packagetype": "bdist_wheel",
            "python_version": "py39",
            "requires_python": ">=3.9",
            "size": 100817471,
            "upload_time": "2022-12-21T23:00:45",
            "upload_time_iso_8601": "2022-12-21T23:00:45.143454Z",
            "url": "https://files.pythonhosted.org/packages/9b/e6/952a744170916bcc896e51a3d49f4d6815bf0f42cf4ae161fc833cc8af82/voicehelper.py-0.1.7-py39-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-21 23:00:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "romanin-rf",
    "github_project": "voicehelper.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "voicehelper.py"
}
        
Elapsed time: 0.02778s