Skip to content

Latest commit

 

History

History
51 lines (31 loc) · 2.17 KB

README.MD

File metadata and controls

51 lines (31 loc) · 2.17 KB

MicroTTS

Simple TTS library for MicroPython that works offline

Tis library is a MicroPython port of concatanative diphone-based speach synthesizer. It uses lexicon database to convert words to phonemes, which was converted from CMU Pronouncing Dictionary (License). Diphones database was converted from diphone collection by Alan W Black and Kevin Lenzo (License).

Installation

  1. Paste folowing code to REPL console to download library

    import mip
    mip.install("github:Voinic/microtts")
  2. Copy lexicon.db and any of diphones.db and diphones_lq.db to SD-card or internal flash (if your have enough space)

Use diphones_lq.db contains recordings with IMA ADPCM compression. You can use it instead of diphones.db if your memory space is limitted. Note that sound quality will decrease.

Usage

from utts import Utterance, Synth

LEXICON_DB = "/sd/lexicon.db"

DIPHONES_DB = "/sd/diphones.db"
DB_COMPRESSED = False

CROSSFADE = 0.025

TEXT = "This is a test"

utterance = Utterance(LEXICON_DB)
synth = Synth(DIPHONES_DB, DB_COMPRESSED)

utterance.process(TEXT)
diphones = utterance.get_diphones()

synth.synthesize(diphones, CROSSFADE)
audio = synth.get_audio()

Usage examples

Creating databases

/db folder contains code and input files that was used for databases creation. Run this code using micropython interpreter, not regular python (I used Unix port of micropython).