Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install tts with reticulate #16

Open
2 tasks
howardbaik opened this issue May 9, 2023 · 2 comments
Open
2 tasks

Install tts with reticulate #16

howardbaik opened this issue May 9, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@howardbaik
Copy link
Contributor

If we can't programmatically find tts, and the user knows that tts isn't installed on their system, we install it for them with pip install tts using reticulate

Tasks

  • Figure out if installing tts in a Python environment like virtualenv or Conda environment named "r-reticulate" will allow system2() to properly locate the tts exe
  • If it does, then use menu() : "Yes" or "No". If "Yes", install with reticulate pip install tts. If "No,", give them a warning message.
@howardbaik howardbaik added the enhancement New feature or request label May 9, 2023
@muschellij2
Copy link
Collaborator

I'll defer to you, but I think adding reticulate as a dependency is a large lift for this package. If you do go this route, make sure it's a most a Suggests not Imports.

@howardbaik
Copy link
Contributor Author

howardbaik commented May 10, 2023

I agree that adding reticulate is a heavy dependency for this package. And we have to decide whether text2speech wants to call tts through a virtual environment using reticulate or keep it as is and just have the user use terminal to supply the path.

One benefit of using reticulate to run tts in Python is voice cloning:

Screenshot 2023-05-10 at 1 00 33 PM

Me and @cansavvy agree we can put this issue on the shelf while we work on other issues.

For posterity

Using reticulate to call tts

I was able to install tts using reticulate:

library(reticulate)

# Create a new environment 
virtualenv_create("r-reticulate")
# Install TTS
virtualenv_install(packages = "TTS")
# Use r-reticulate as virtual environment
use_virtualenv("r-reticulate")

If you get this error message ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168, remove urllib3 and install urllib3<2.0:

# Do `pip uninstall urllib3` 
virtualenv_remove("urllib3")
# Do `pip install 'urllib3<2.0'`
virtualenv_install("urllib3<2.0")

Create a Python script (script.py):

from TTS.api import TTS

# List available 🐸TTS models and choose the first one
model_name = TTS.list_models()[0]
# Init TTS
tts = TTS(model_name)
# Run TTS
# Text to speech to a file
tts.tts_to_file(text="Hello world!", speaker=tts.speakers[0], language=tts.languages[0], file_path="output.wav")

⚠️ This crashes RStudio for some reason...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants