TensorFlowTTS / README.md
ruslanmv's picture
Updates
cd3ba6d
|
raw
history blame
1.29 kB
metadata
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 trained on LJSpeech dataset (ENG). For a detail of the model, we encourage you to read more about TensorFlowTTS.

Install TensorFlowTTS

First of all, please install TensorFlowTTS with the following command:

pip install TensorFlowTTS

Converting your Text to Mel Spectrogram

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),
)