File size: 1,285 Bytes
4e59d4c cd3ba6d 4e59d4c cd3ba6d 4e59d4c |
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 |
---
tags:
- TensorFlowTTS
- audio
- text-to-speech
- text-to-mel
language: eng
license: apache-2.0
datasets:
- LJSpeech
widget:
- text: "How are you?"
---
This repository provides a pretrained [FastSpeech](https://arxiv.org/abs/1905.09263) trained on LJSpeech dataset (ENG). For a detail of the model, we encourage you to read more about
[TensorFlowTTS](https://github.com/TensorSpeech/TensorFlowTTS).
## Install TensorFlowTTS
First of all, please install TensorFlowTTS with the following command:
```
pip install TensorFlowTTS
```
### Converting your Text to Mel Spectrogram
```python
import numpy as np
import soundfile as sf
import yaml
import tensorflow as tf
from tensorflow_tts.inference import AutoProcessor
from tensorflow_tts.inference import TFAutoModel
processor = AutoProcessor.from_pretrained("ruslanmv/tts-fastspeech-ljspeech-en")
fastspeech = TFAutoModel.from_pretrained("ruslanmv/tts-fastspeech-ljspeech-en")
text = "How are you?"
input_ids = processor.text_to_sequence(text)
mel_before, mel_after, duration_outputs = fastspeech.inference(
input_ids=tf.expand_dims(tf.convert_to_tensor(input_ids, dtype=tf.int32), 0),
speaker_ids=tf.convert_to_tensor([0], dtype=tf.int32),
speed_ratios=tf.convert_to_tensor([1.0], dtype=tf.float32),
)
```
|