| --- |
| 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/tensorflowtts") |
| fastspeech = TFAutoModel.from_pretrained("ruslanmv/tensorflowtts") |
| |
| 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), |
| ) |
| ``` |
|
|
|
|
|
|
|
|
|
|
|
|