Skip to content
/ ntts Public

Neural Text To Speech Di Dart Cepat Ringan Tanpa Koneksi Internet dan bisa berjalan di cpu

License

Notifications You must be signed in to change notification settings

azkadev/ntts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Text To Speech

Neural Text To Speech Library untuk menghasilkan suara realistis seperti natural di bahasa dart, neural text to speech ini berjalan tanpa perlu koneksi internet dan hanya membutuhkan cpu saja

MOVE TO OTHER REPO

AZKADEV PIPER

Demo

ewfile.mp4

More Update And More Features?

Indonesia: Saya tidak memiliki kuota internet dan komputer memadai untuk melanjutkan ini saya seorang manusia miskin, jika anda ingin saya maintance terus project ini silahkan donate ke saya
English: if you want me to continue to maintain this project please donate to me

TESTED ON

NO OS CPU RAM
1 Ubuntu 22.04 & 23.10 AMD RYZEN 5500U 8GB
2 Ubuntu Server 22.04 Intel Celeron n2940 4GB

Resources

No Name
1 MODEL TTS ENGLISH

Dependencies

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

# 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

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 .

Install

dart pub add ntts_dart

Import Library

import 'package:ntts_dart/ntts_dart.dart';

Quickstart

Sebelum di run pastikan kamu sudah mengcompile library dan menyiapkan model dahulu

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);
}

Full Quickstart

Sebelum di run pastikan kamu sudah mengcompile library dan menyiapkan model dahulu

import 'dart:io';
import 'dart:isolate';

import 'package:general_lib/general_lib.dart';
import 'package:mason_logger/mason_logger.dart';
import 'package:ntts_dart/api/create_voice.dart';
import 'package:ntts_dart/ntts_dart.dart';
import 'package:ntts_dart/scheme/scheme.dart';
import 'package:play/play_dart.dart';
import "package:path/path.dart" as path;

void main(List<String> arguments) async {
  Logger logger = Logger();
  logger.info("Started NTTS DART - AZKADEV");
  Args args = Args(arguments);
  String file_model = args.after("-m") ?? path.join(Directory.current.path, "en_US-libritts-high.onnx");
  Progress progress_load_model = logger.progress("Load Model");
  int speaker_id = int.tryParse(args.after("-s") ?? "10") ?? 10;
  String text = args.after("-t") ??
      """
This sound is created using dart language by azkadev without using any internet

Human: Good afternoon, robot. How are you today?

Robot: I am functioning optimally, thank you. How may I assist you?

Human: I need help with my work. Can you help me sort out my emails?

Robot: Of course, I can help you with that. May I have access to your email account?

Human: Sure, let me give you access.

(After a few seconds)

Robot: I have access to your email account now. What do you want me to do?

Human: Can you sort out my emails by date?

Robot: Certainly. Sorting your emails by date. Please wait a moment.

(After a few seconds)

Robot: Your emails have been sorted by date. Is there anything else I can assist you with?

Human: Yes, can you also search for any important emails that contain the word "urgent"?

Robot: Understood. Searching for any emails containing the word "urgent".

(After a few seconds)

Robot: I have found several emails containing the word "urgent". Would you like me to prioritize them for you?

Human: Yes, please do.

Robot: Prioritizing urgent emails. Is there anything else I can assist you with?

Human: No, that's all for now. Thank you, robot.

Robot: You're welcome. Don't hesitate to contact me if you need further assistance.

"""
          .trim();
  await Future.delayed(Duration(milliseconds: 500));
  File file = File(file_model);
  String file_model_path = file.path;
  progress_load_model.update("Check Model File: ${file.path}");
  await Future.delayed(Duration(milliseconds: 500));
  if (!file.existsSync()) {
    progress_load_model.fail("Not Found Model File: ${file.path}");
    await Future.delayed(Duration(milliseconds: 500));
    exit(0);
  } else {
    progress_load_model.complete("Found Model File: ${file.path}");
    await Future.delayed(Duration(milliseconds: 500));
  }

  File file_ouput = File(path.join(Directory.current.path, "data.wav"));
  String file_output_sound = file_ouput.path;
  if (file_ouput.existsSync()) {
    await file_ouput.delete();
  }

  Progress progress_create_sound = logger.progress("Create Sound");
  await Future.delayed(Duration(milliseconds: 500));
  var res = await Isolate.run<Map>(() {
    Ntts ntts = Ntts(
      pathLib: "libntts.so",
    );

    var res = ntts.invokeRaw(
      data: CreateVoice.create(
        text: text,
        model_path: file_model_path,
        output_file: file_output_sound,
        speaker_id: speaker_id,
      ).toJson(),
    );

    return res;
  });
  await Future.delayed(Duration(milliseconds: 500));
  progress_create_sound.complete("Succes Create Sound");
  await Future.delayed(Duration(milliseconds: 500));
  Voice voice = Voice(res);
  Progress progress_play_sound = logger.progress("Started Play Sound");
  Play play = Play();

  await Future.delayed(Duration(milliseconds: 500));
  await play.open(
    medias: [
      voice.output_file ?? "",
    ],
    play: false,
  );

  await play.play();
  // play.player.stream;
  play.player.stream.completed.listen(
    (event) async {
      if (event) {
        progress_play_sound.complete("Finished");
        await Future.delayed(Duration(seconds: 2));
        exit(0);
      }
    },
    onDone: () async {
      progress_play_sound.complete("Finished");
      await Future.delayed(Duration(seconds: 2));
      exit(0);
    },
  );
}

Refferensi

  1. Piper
  2. Mimic Recording Studio
  3. Espeak
  4. onnxruntime

Global Corporation

Welcome to Global Corporation profile!  

Instagram       Twitter       Twitter       Youtube      

Global Corporation Is a leading company that takes a leading role in accelerating and maintaining enterprise security.

With a sharp focus on innovation and technological excellence

Global Corporation providing effective proactive solutions to secure company operations and prevent potential adverse risks.

With a committed team of experts, advanced technology, and a holistic approach to corporate security, Global Corporation has become a benchmark for other companies that prioritize security and safety as a top priority in their business.

Application / Product / Project Official

Global App

Super Cross-platform application allows you to do social media / chat as well as a place for buying and selling businesses to find work

Global Bot App

Super cross-platform application allows you to handle lots of bots / userbots / AI for your assistants, making it easier for you in all your affairs

Global Studio Developer

The cross-platform Studio Developer application allows you to code on various platforms

Ads Gateway

Applikasi Cross platform advertising allows you to advertise on various platforms easily

Archivon

Applikasi Linux based operating system which will be released

Coinlox

Applikasi Cross Platform Wallet allows you to store money on the internet safely

Global Bot Telegram

Super Bot Telegram allows you to manage various chat groups / private / channels as well as a place to buy and sell the products we sell, you can buy this service from IDR: 25k / bulan $: 1,5 Dollar

Global Userbot Telegram

Super Bot Telegram allows you to manage various chat groups / private / channels as well as a place to buy and sell the products we sell, you can buy this service from IDR: 25k / bulan $: 1,5 Dollar

Global Bot Whatsapp

Super Bot Telegram allows you to manage various chat groups / private / channels as well as a place to buy and sell the products we sell, you can buy this service from IDR: 25k / bulan $: 1,5 Dollar

Social Media

Telegram  

  1. Group Developer Global Public

Product / Services

  1. Clone Bot / Userbot Hi, do you want to have a bot / userbot with lots of features?.
  • Features:
    • Repeat Message
    • Manage Chat Private / Channel / Group
  • Platform Support:
    • Telegram
    • Whatsapp
    • Twitter
    • Github
    • Google
  1. Products
    • Black Products
    • Group / Channel
    • Nsfw
    • Payment Gateway
    • Paid Promote
    • Pre Release / Beta
    • Promo Cheap
    • Source Code Bot / USerbot
    • Trade
  2. Services
    • Developer
    • Goal
    • Partner
    • Promote
    • Recommendation
    • Sortcut Cheat Sheet
    • Terminate
    • Upgrade

How To Buy Services Or Products | Cara Beli Jasa Atau Products

  • Via Telegram Bot

    • Englisth

      If you want to buy, you can use Telegram to automatically process the payment (if the long process is not a SCAM!! it's possible that the server is down so the process could take longer. If in doubt, tap the report menu then fill in a complaint)

      • Open Bot: https://t.me/GLOBAL_CORP_ORG_BOT
      • Fill in personal data / subscribe to the channel
      • Tap Main menu select services / products
      • Select Products / Services
      • Make sure there are enough coins
      • Fill in the required data
    • Indonesia

      Jika kamu ingin membeli bisa lewat telegram automatis pembayaran hingga proses (jika proses lama itu bukan SCAM !! kemungkinan server down jadi proses bisa lebih lama jika ragu tap menu report lalu isi keluhan)

      • Buka Bot: https://t.me/GLOBAL_CORP_ORG_BOT
      • Isi data pribadi / subscribe channel
      • Tap Main menu pilih services / products
      • Pilih Product / Services
      • Pastikan coin mencukupi
      • Isi data yang di butuhkan
  • Via Telegram USER

Video Tutorial Watch the video

  • Lewat App

    • English

      If you want to see a product/service with a full demo, you can buy it via the app

    • Indonesia

      jika kamu ingin melihat product / jasa dengan full demo kamu bisa beli lewat app

📺 Latest YouTube Videos

Userbot LIFE TIME Subsription Telegram Murah Unlimited Akun Ultra FAST | Global Corporation Tolong 😭 Siapapun beli satu jasa aku ntr aku kasih harga seiklasnya / ada yang mau donasi | GLOBAL Cara beli ai telegram versi bot dan cara pakai| Global Corporation Ai Userbot Telegram Demo Cara Pakai Dan Beli | Global Corporation CARA BELI USERBOT TELEGRAM CLOUD  | Global Corporation Cara Top Up Automatis Menggunakan Payment Gateway Di GLOBAL BOT APP