Skip to content

vindar/MBROLA_T4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MBROLA_T4

MBROLA_T4 is a port of the MBROLA diphone-based speech synthesizer engine, adapted for the Teensy 4.0 and 4.1 microcontrollers.

This library enables real-time speech synthesis using MBROLA voice databases, with full integration into the Teensy Audio Library. Voices are compiled into code which can be stored into PROGMEM or external FLASH.


🚀 Key Features

  • Port of the original MBROLA engine (written in C).
  • Compatible with the Teensy Audio Library.
  • Voices are included in .h/.cpp format (converted from MBROLA .bin)
  • Selectable A-law, μ-law, compression for voices.
  • Low RAM requirement: a voice take around 1.5MB of storage in ROM/flash but the engine itself uses only around 60KB of (statically) allocated RAM which can be located in DTCM, DMAMEM or even EXTMEM.
  • Voice engine fully encapsulated: multiple voices may be played simultaneously.
  • Low CPU usage with real-time audio synthesis at 44.1 kHz

📦 Based on

This project is based on both:

  • the original MBROLA engine (MBROLA project) by the Faculté Polytechnique de Mons
  • and the open-source port Mimbrola by Ethan Akira

This library is released under the GNU Affero GPL v3 (same as the orignal MBROLA code)


🛠 Getting Started

Voice Conversion

Before you can synthesize speech, you need to convert a MBROLA voice database. Voices may be downloaded from the official MBROLA voice repository (beware the voices are not open source: check license terms before usage).

Once downloaded, the voice must be converted into C++ source files that can be compiled into your Teensy project.

Use the provided voice2cpp utility located in the /tools/ subdirectory of this library. For example, to convert the French voice fr4, use:

cd tools
gcc voice2cpp.c -o voice2cpp
./voice2cpp -u2 /path/to/fr4_binary_file

The parameter -u2 selects µ-law compression with downsampling, to reduce flash usage.
This will generate two files:

  • mbrola_voice_fr4_u2.h
  • mbrola_voice_fr4_u2.cpp

You can then include them in your sketch or project.

Each voice generates a corresponding derived class of AudioPlayMBROLA, named as:
AudioPlayMBROLA_<voice>_<compressiontype>, e.g. AudioPlayMBROLA_fr4_u2.


Basic Usage

#include "mbrola_voice_fr4_u2.h"  // Include the generated voice

AudioPlayMBROLA_fr4_u2 mbrola;   // Use the generated voice object

void setup() {
  // Initialize audio system
  AudioMemory(16);
  
  // Play a short phrase
  mbrola.speak(
    "b 80\n"
    "oU 90\n"
    "S 80\n"
    "_ 200\n"
  );
}

See the subdirectory /examples/ for a complete working code.

About

Port of the MBROLA speech synthesizer for Teensy 4/4.1

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors