MSpeechPy


NameMSpeechPy JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryConverter texto para voz
upload_time2024-09-24 17:17:28
maintainerNone
docs_urlNone
authorPauloCesar-dev404
requires_pythonNone
licenseMIT
keywords tts mspeechpy converter texto para voz text for voice azure tts
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
<h1>MSpeechPy</h1>
<i>Converter textos para voz usando Python!</i>  


![Versão](https://img.shields.io/badge/version-0.2.2-orange)
![Licença](https://img.shields.io/badge/license-MIT-orange)
[![Sponsor](https://img.shields.io/badge/💲Donate-yellow)](https://apoia.se/paulocesar-dev404)

</div>
    
  
---

## Funcionalidades

- Obter todas as vozes locais.
- Filtrar vozes por localidade.
- Listar vozes multilíngues.
- Obter detalhes de uma voz específica.
- Converter texto para áudio usando uma voz selecionada.

## Obter todas as vozes locais

```python
from MSpeechPy import SpeechpyClient

# Inicializa o cliente
engine = SpeechpyClient()

# Obter todas as vozes locais
voices = engine.get_voices.get_all_local_voices()  
print("Todas as vozes locais:")
for v in voices:
    print(v)
```

## Obter vozes por localidade

```python
from MSpeechPy import SpeechpyClient

engine = SpeechpyClient()

# Obter vozes por localidade
local = 'Portuguese (Brazil)'
voices_pt_br = engine.get_voices.filter_voices_by_locale_name(local)  
print(f"\nVozes para a localidade '{local}':")
for v in voices_pt_br:
    print(v)
```

## Obter vozes multilíngues

```python
from MSpeechPy import SpeechpyClient

engine = SpeechpyClient()

# Obter vozes multilíngues
voices_multilingual = engine.get_voices.get_all_multilingual()  
print("\nTodas as vozes multilíngues:")
for v in voices_multilingual:
    print(v)
```

## Obter detalhes de uma voz específica

```python
from MSpeechPy import SpeechpyClient

# Inicializa o cliente
engine = SpeechpyClient()

# Nome curto da voz
short_name = 'pt-BR-Daniel'

# Obtém as informações da voz pelo nome curto
voice_info = engine.get_voices.filter_voices_by_voice_name(short_name=short_name)

# Imprime os detalhes da voz
print(f"Voice Type: {voice_info.voice_type}")
print(f"Sample Rate Hertz: {voice_info.sample_rate_hertz}")
print(f"Name: {voice_info.name}")
print(f"Short Name: {voice_info.short_name}")
print(f"Status: {voice_info.status}")
print(f"Output Format: {voice_info.get_output_format}")
print(f"Display Name: {voice_info.display_name}")
print(f"Gender: {voice_info.gender}")
print(f"Locale Name: {voice_info.locale_name}")
print(f"Style List: {voice_info.style_list}")
print(f"Words Per Minute: {voice_info.words_per_minute}")
```

## Converter texto para voz usando uma voz

```python
import os
from MSpeechPy import SpeechpyClient

# Inicializa o cliente
engine = SpeechpyClient()

# Nome curto da voz
short_name = 'pt-BR-Daniel'

# Obtém as informações da voz pelo nome curto
voice_info = engine.get_voices.filter_voices_by_voice_name(short_name=short_name)

# Verifica se a voz foi encontrada
if not voice_info:
    print(f"Nenhuma voz encontrada com o nome curto '{short_name}'")
    exit()

# Texto para conversão
text = "Eu sou o Daniel e vou me livrar da maldição dizendo olá mundo!"

# Diretório de saída
out_dir = 'daniel_teste'
os.makedirs(out_dir, exist_ok=True)

try:
    # Converte o texto em áudio
    audio_file_path = engine.text_to_speech.text_to_speech(
        text=text,
        voice_name=short_name,
        output_name='daniel_helloWorld',  # Nome do arquivo
        volume='loud',  # Ajusta o volume da voz
        pitch='-50%',   # Adiciona o valor do pitch (tom de voz)
        output_format='audio-16khz-128kbitrate-mono-mp3',  # Formato de saída
        output_dir=out_dir
    )

    # Verifica se o arquivo foi gerado corretamente
    if os.path.exists(audio_file_path):
        print(f"Arquivo de áudio gerado com sucesso: {audio_file_path}")
    else:
        print("Falha ao gerar o arquivo de áudio.")
except Exception as e:
    print(f"Ocorreu um erro: {e}")
```

## Contribuições e Suporte

Se tiver dúvidas ou sugestões, abra uma [issue aqui](https://github.com/PauloCesar-dev404/youtube_analyzer/issues)
<br>
---
[![Sponsor](https://img.shields.io/badge/Documentação-green)](https://github.com/PauloCesar-dev404/MSpeechPy/tree/main/doc)






            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "MSpeechPy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "tts, MSpeechPy, converter texto para voz, text for voice, azure tts",
    "author": "PauloCesar-dev404",
    "author_email": "paulocesar0073dev404@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9a/23/8c767864422dd4df94b439348d82189d40b2f05afb3f77d0ac7f6aab11d5/mspeechpy-0.2.2.tar.gz",
    "platform": "any",
    "description": "<div align=\"center\">\r\n<h1>MSpeechPy</h1>\r\n<i>Converter textos para voz usando Python!</i>  \r\n\r\n\r\n![Vers\u00e3o](https://img.shields.io/badge/version-0.2.2-orange)\r\n![Licen\u00e7a](https://img.shields.io/badge/license-MIT-orange)\r\n[![Sponsor](https://img.shields.io/badge/\ud83d\udcb2Donate-yellow)](https://apoia.se/paulocesar-dev404)\r\n\r\n</div>\r\n    \r\n  \r\n---\r\n\r\n## Funcionalidades\r\n\r\n- Obter todas as vozes locais.\r\n- Filtrar vozes por localidade.\r\n- Listar vozes multil\u00edngues.\r\n- Obter detalhes de uma voz espec\u00edfica.\r\n- Converter texto para \u00e1udio usando uma voz selecionada.\r\n\r\n## Obter todas as vozes locais\r\n\r\n```python\r\nfrom MSpeechPy import SpeechpyClient\r\n\r\n# Inicializa o cliente\r\nengine = SpeechpyClient()\r\n\r\n# Obter todas as vozes locais\r\nvoices = engine.get_voices.get_all_local_voices()  \r\nprint(\"Todas as vozes locais:\")\r\nfor v in voices:\r\n    print(v)\r\n```\r\n\r\n## Obter vozes por localidade\r\n\r\n```python\r\nfrom MSpeechPy import SpeechpyClient\r\n\r\nengine = SpeechpyClient()\r\n\r\n# Obter vozes por localidade\r\nlocal = 'Portuguese (Brazil)'\r\nvoices_pt_br = engine.get_voices.filter_voices_by_locale_name(local)  \r\nprint(f\"\\nVozes para a localidade '{local}':\")\r\nfor v in voices_pt_br:\r\n    print(v)\r\n```\r\n\r\n## Obter vozes multil\u00edngues\r\n\r\n```python\r\nfrom MSpeechPy import SpeechpyClient\r\n\r\nengine = SpeechpyClient()\r\n\r\n# Obter vozes multil\u00edngues\r\nvoices_multilingual = engine.get_voices.get_all_multilingual()  \r\nprint(\"\\nTodas as vozes multil\u00edngues:\")\r\nfor v in voices_multilingual:\r\n    print(v)\r\n```\r\n\r\n## Obter detalhes de uma voz espec\u00edfica\r\n\r\n```python\r\nfrom MSpeechPy import SpeechpyClient\r\n\r\n# Inicializa o cliente\r\nengine = SpeechpyClient()\r\n\r\n# Nome curto da voz\r\nshort_name = 'pt-BR-Daniel'\r\n\r\n# Obt\u00e9m as informa\u00e7\u00f5es da voz pelo nome curto\r\nvoice_info = engine.get_voices.filter_voices_by_voice_name(short_name=short_name)\r\n\r\n# Imprime os detalhes da voz\r\nprint(f\"Voice Type: {voice_info.voice_type}\")\r\nprint(f\"Sample Rate Hertz: {voice_info.sample_rate_hertz}\")\r\nprint(f\"Name: {voice_info.name}\")\r\nprint(f\"Short Name: {voice_info.short_name}\")\r\nprint(f\"Status: {voice_info.status}\")\r\nprint(f\"Output Format: {voice_info.get_output_format}\")\r\nprint(f\"Display Name: {voice_info.display_name}\")\r\nprint(f\"Gender: {voice_info.gender}\")\r\nprint(f\"Locale Name: {voice_info.locale_name}\")\r\nprint(f\"Style List: {voice_info.style_list}\")\r\nprint(f\"Words Per Minute: {voice_info.words_per_minute}\")\r\n```\r\n\r\n## Converter texto para voz usando uma voz\r\n\r\n```python\r\nimport os\r\nfrom MSpeechPy import SpeechpyClient\r\n\r\n# Inicializa o cliente\r\nengine = SpeechpyClient()\r\n\r\n# Nome curto da voz\r\nshort_name = 'pt-BR-Daniel'\r\n\r\n# Obt\u00e9m as informa\u00e7\u00f5es da voz pelo nome curto\r\nvoice_info = engine.get_voices.filter_voices_by_voice_name(short_name=short_name)\r\n\r\n# Verifica se a voz foi encontrada\r\nif not voice_info:\r\n    print(f\"Nenhuma voz encontrada com o nome curto '{short_name}'\")\r\n    exit()\r\n\r\n# Texto para convers\u00e3o\r\ntext = \"Eu sou o Daniel e vou me livrar da maldi\u00e7\u00e3o dizendo ol\u00e1 mundo!\"\r\n\r\n# Diret\u00f3rio de sa\u00edda\r\nout_dir = 'daniel_teste'\r\nos.makedirs(out_dir, exist_ok=True)\r\n\r\ntry:\r\n    # Converte o texto em \u00e1udio\r\n    audio_file_path = engine.text_to_speech.text_to_speech(\r\n        text=text,\r\n        voice_name=short_name,\r\n        output_name='daniel_helloWorld',  # Nome do arquivo\r\n        volume='loud',  # Ajusta o volume da voz\r\n        pitch='-50%',   # Adiciona o valor do pitch (tom de voz)\r\n        output_format='audio-16khz-128kbitrate-mono-mp3',  # Formato de sa\u00edda\r\n        output_dir=out_dir\r\n    )\r\n\r\n    # Verifica se o arquivo foi gerado corretamente\r\n    if os.path.exists(audio_file_path):\r\n        print(f\"Arquivo de \u00e1udio gerado com sucesso: {audio_file_path}\")\r\n    else:\r\n        print(\"Falha ao gerar o arquivo de \u00e1udio.\")\r\nexcept Exception as e:\r\n    print(f\"Ocorreu um erro: {e}\")\r\n```\r\n\r\n## Contribui\u00e7\u00f5es e Suporte\r\n\r\nSe tiver d\u00favidas ou sugest\u00f5es, abra uma [issue aqui](https://github.com/PauloCesar-dev404/youtube_analyzer/issues)\r\n<br>\r\n---\r\n[![Sponsor](https://img.shields.io/badge/Documenta\u00e7\u00e3o-green)](https://github.com/PauloCesar-dev404/MSpeechPy/tree/main/doc)\r\n\r\n\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Converter texto para voz",
    "version": "0.2.2",
    "project_urls": {
        "Bugs/Melhorias": "https://github.com/PauloCesar-dev404/MSpeechPy/issues",
        "Documenta\u00e7\u00e3o": "https://github.com/PauloCesar-dev404/MSpeechPy/wiki",
        "GitHub": "https://github.com/PauloCesar-dev404/MSpeechPy"
    },
    "split_keywords": [
        "tts",
        " mspeechpy",
        " converter texto para voz",
        " text for voice",
        " azure tts"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0ccdaa7dee8b67d0e38f2abaa603cef7d5871d31a2820fb9a5aca318a7e804c",
                "md5": "21113e473d3d22dd4a51fca79108f03d",
                "sha256": "0346f5bbeb0b54b38297a299419e50ffe6a914382ddc226128e622fcfeaacf73"
            },
            "downloads": -1,
            "filename": "MSpeechPy-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21113e473d3d22dd4a51fca79108f03d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11671,
            "upload_time": "2024-09-24T17:17:27",
            "upload_time_iso_8601": "2024-09-24T17:17:27.035254Z",
            "url": "https://files.pythonhosted.org/packages/a0/cc/daa7dee8b67d0e38f2abaa603cef7d5871d31a2820fb9a5aca318a7e804c/MSpeechPy-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a238c767864422dd4df94b439348d82189d40b2f05afb3f77d0ac7f6aab11d5",
                "md5": "3d22b50d0af2f10ac746d2a968470d7a",
                "sha256": "93ac91b950203b8c0e848ead3a3914206843719cca7de15a97c49a83b38f4a1f"
            },
            "downloads": -1,
            "filename": "mspeechpy-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3d22b50d0af2f10ac746d2a968470d7a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21063,
            "upload_time": "2024-09-24T17:17:28",
            "upload_time_iso_8601": "2024-09-24T17:17:28.587398Z",
            "url": "https://files.pythonhosted.org/packages/9a/23/8c767864422dd4df94b439348d82189d40b2f05afb3f77d0ac7f6aab11d5/mspeechpy-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-24 17:17:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PauloCesar-dev404",
    "github_project": "MSpeechPy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mspeechpy"
}
        
Elapsed time: 4.44490s