Neural Text To Speech (NTTS)
Introduction
The Neural Text To Speech (NTTS) project is an advanced library designed to generate highly realistic and natural-sounding speech from text. This tool is implemented in the Dart programming language and is notable for its ability to function without the need for an internet connection, relying solely on a device's CPU for processing. Such a capability makes it incredibly versatile and accessible for various applications requiring text-to-speech conversion.
Relocation Announcement
The NTTS project has been migrated to a new repository, now known under the AZKADEV PIPER name. This transition is aimed at improving project development and feature expansion.
Demonstration
The project offers a demonstration of its capabilities through a sample video. Users interested in viewing the NTTS demo can watch it on YouTube by clicking the image below:
Call for Support
Continuing the development and maintenance of this project requires resources. The project creator has expressed a need for internet access and adequate computing tools. Donations are welcomed, and contributions can be made through the provided sponsorship link.
System Specifications
NTTS has been tested on a variety of systems to ensure its robustness and efficiency. The systems used include:
- Ubuntu 22.04 & 23.10 with AMD Ryzen 5500U CPU and 8GB of RAM.
- Ubuntu Server 22.04 with Intel Celeron n2940 CPU and 4GB of RAM.
Resources and Downloads
The project utilizes specific TTS models to perform its tasks. One such model is the English (US) voice model, which can be downloaded via MODEL TTS ENGLISH.
Dependencies
To ensure NTTS operates smoothly, several dependencies must be installed, including:
sudo apt-get install espeak-ng mpv
sudo apt-get install gawk bison gcc make -y
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.33.tar.gz
tar -zxvf glibc-2.33.tar.gz && cd glibc-2.33
mkdir glibc-build && cd glibc-build
../configure --prefix=/opt/glibc
make
sudo make install
Installation
The installation of NTTS involves several steps, which include downloading the necessary models and the NTTS software itself:
# download model
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/libritts/high/en_US-libritts-high.onnx
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/libritts/high/en_US-libritts-high.onnx.json
# download ntts
wget https://github.com/azkadev/ntts/releases/download/latest/ntts_dart.deb
# install ntts
sudo dpkg --force-all -i ./ntts_dart.deb
# try ntts
ntts_dart -m "en_US-libritts-high.onnx" -t "Hello World"
Development and Compilation
For developers wishing to explore or contribute, the NTTS code can be cloned and compiled as follows:
git clone https://github.com/azkadev/ntts_dart.git
cd ntts_dart
# compile library
cd native_lib
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
Dart Integration
To integrate NTTS with a Dart project, the library can be added using:
dart pub add ntts_dart
And imported into Dart code as:
import 'package:ntts_dart/ntts_dart.dart';
Quickstart Guide
Users must ensure that the library is compiled and a model is prepared before running the following example:
import 'dart:io';
import 'dart:isolate';
import 'package:ntts_dart/ntts_dart.dart';
void main(List<String> arguments) async {
var res = await Isolate.run<Map>(() {
Ntts ntts = Ntts(
pathLib: "libntts.so",
);
var res = ntts.invokeRaw(
data: CreateVoice.create(
text: "Hello World",
model_path: "./path_to_model.onnx",
output_file: "./file_output.wav",
speaker_id: 0,
).toJson(),
);
return res;
});
print(res);
exit(0);
}
References
NTTS is developed with inspiration and resources from various projects, including:
This comprehensive guide covers all essential aspects of the NTTS project, providing users with a seamless path from understanding to implementation.