Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voinic/microtts
Simple TTS library for MicroPython that works offline
https://github.com/voinic/microtts
diphone-based micropython speech-synthesis tts
Last synced: about 1 month ago
JSON representation
Simple TTS library for MicroPython that works offline
- Host: GitHub
- URL: https://github.com/voinic/microtts
- Owner: Voinic
- License: mit
- Created: 2024-06-18T16:54:14.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-07-23T16:39:26.000Z (4 months ago)
- Last Synced: 2024-10-10T22:22:15.999Z (about 1 month ago)
- Topics: diphone-based, micropython, speech-synthesis, tts
- Language: Python
- Homepage:
- Size: 15.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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](http://www.speech.cs.cmu.edu/cgi-bin/cmudict) ([License](https://raw.githubusercontent.com/Voinic/microtts/master/db/cmudict_license.txt)). Diphones database was converted from diphone collection by Alan W Black and Kevin Lenzo ([License](https://raw.githubusercontent.com/Voinic/microtts/master/db/diphones_license.txt)).
## Installation
1. Paste folowing code to REPL console to download library
```python
import mip
mip.install("github:Voinic/microtts")
```2. Copy [lexicon.db](https://raw.githubusercontent.com/Voinic/microtts/master/db/lexicon.db) and any of [diphones.db](https://raw.githubusercontent.com/Voinic/microtts/master/db/diphones.db) and [diphones_lq.db](https://raw.githubusercontent.com/Voinic/microtts/master/db/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
```python
from utts import Utterance, SynthLEXICON_DB = "/sd/lexicon.db"
DIPHONES_DB = "/sd/diphones.db"
DB_COMPRESSED = FalseCROSSFADE = 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
- [examples/save_to_wav.py](https://github.com/Voinic/microtts/blob/master/examples/save_to_wav.py) - Converts given text to speach and saves result into WAV file.
- [examples/direct_playback.py](https://github.com/Voinic/microtts/blob/master/examples/direct_playback.py) - Prompts user for input text and sends output audio to I2S DAC.## 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).