-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
111 lines (77 loc) · 2.9 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# coqui
<!-- badges: start -->
<!-- badges: end -->
The goal of coqui is to wrap the [TTS](https://github.com/coqui-ai/TTS) (but really [this version](https://github.com/idiap/coqui-ai-TTS)) Python module for translation of text to other languages.
# TTS Installation
You must install the `coqui-tts` Python module. You'll likely do this via:
```r
install_coqui()
```
## Why not the TTS module?
The https://github.com/coqui-ai/TTS repo is no longer maintained. This is where the `TTS` Python module comes from (when you run `pip install TTS`). The fork of https://github.com/idiap/coqui-ai-TTS is being actively maintained (by Idiap Research Institute), so we are using that, and the module name is `coqui-tts`. **Note**: the name of the module in Python is still `TTS`.
## Mac OSX
In Mac OSX, you need to install some dependencies for the Python `TTS` version to work. We will install these via [Homebrew](https://brew.sh/).
``` bash
brew install mecab
```
``` bash
brew install espeak
brew link espeak
```
### Troubleshooting
If you get something like this
```
return match.group("version")
^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'
```
If you trace the error back, it'll likely say something like:
```bash
_DEF_ESPEAK_VER = get_espeak_version()
```
Try going to the command line and run:
```bash
espeak --version
```
And that will hopefully show you where the error is coming from.
# Package Installation
You can install the development version of `coqui` like so:
To install `TTS`, you can either run `install_coqui`, which calls `reticulate::py_install()`, If you already have a `conda` environment enacted, use `reticulate::py_install` or simply `install_coqui`:
```r
library(coqui)
install_coqui()
```
Or you can run `create_coqui_condaenv()`, which calls `reticulate::conda_create()` and creates a `conda` environment for `coqui`, named `coqui`.
``` r
create_coqui_condaenv()
```
If you use this method, you should run `reticulate::use_condaenv("coqui")` before enabling Python.
## Example
This is a basic example which shows you how to solve a common problem:
```{r example, cache = TRUE}
library(coqui)
text = c(
"Hello, my name is coqui. I am a personal assistant to help talk to you.",
"I hope you like how I sound!")
random_file = cq_tts(text)
text = c(
"Hello, my name is coqui. I am a personal assistant to help talk to you.",
"I hope you like how I sound!")
res = cq_tts(text, path = "README_cache/example.wav")
```
![[Example Wav](https://github.com/jhudsl/coqui/README_cache/example.wav)](https://github.com/jhudsl/coqui/raw/refs/heads/main/README_cache/example.wav)
```r
system2("play", res)
```