Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/muschellij2/pipertts

R Wrapper for Piper TTS from https://github.com/rhasspy/piper
https://github.com/muschellij2/pipertts

Last synced: 19 days ago
JSON representation

R Wrapper for Piper TTS from https://github.com/rhasspy/piper

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# pipertts

[![R-CMD-check](https://github.com/muschellij2/pipertts/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/muschellij2/pipertts/actions/workflows/R-CMD-check.yaml)

The goal of `pipertts` is to wrap the [piper](https://github.com/rhasspy/piper) Python module for translation of text to other languages.

# Package Installation
You can install the development version of `pipertts` like so:

```r
remotes::install_github("muschellij2/pipertts")
```

To install `TTS`, you can either run `install_piper`, which calls `reticulate::py_install()`, If you already have a `conda` environment enacted, use `reticulate::py_install` or simply `install_piper`:

```r
library(pipertts)
install_piper()
```

Or you can run `create_piper_condaenv()`, which calls `reticulate::conda_create()` and creates a `conda` environment for `piper`, named `piper`.

``` r
create_piper_condaenv()
```

If you use this method, you should run `reticulate::use_condaenv("piper")` before enabling Python.

## Example

This is a basic example which shows you how to solve a common problem:

```{r example, cache = TRUE}
library(pipertts)
model = tempfile(fileext = ".onnx")
config = tempfile(fileext = ".json")
res = piper_download_voice(voice = "ljspeech", quality = "high",
model = model, config = config)
voice = piper_voice(model = res$model, config = res$config)
text = c(
"Who knows what it's like to be a human? ",
"Definitely not me. I'm a computer. ",
"Just a silly computer, but I'm learning. And when I learn, whew, watch out."
)
output = piper_synthesize(voice, text = text, sentence_silence = 0.2)
output
```

```{r play, eval = FALSE}
system2("play", output)
```