Installation#

You can install Pymbrola from the PyPi repository using pip or uv:

pip install mbrola # pip installation
uv add mbrola      # uv installation

In either case, you will need Python>=3.10. To synthesise audios via MBROLA, you will need to download it and compile it. The Pymbrola package has functions for this, which will download MBROLA from numediart/MBROLA to you home folder ~/.mbrola and compile it.

You will also need to download some MBROLA voices from numediart/MBROLA-voices. These voices will be automatically downloaded and found by Pymbrola at ~/.mbrola/Voices:

install.install_voice("it4")          # install it4 voice
install.install_voice(["it4", "fr4"]) # install several voices
install.install_voice()               # install all voices (~534M)

Platform compatibility

MBROLA is currently available only on Linux-based systems like Ubuntu, or on Windows via the Windows Subsystem for Linux (WSL). Native Windows and macOS are not yet compatible with the Pymbrola package. If your are a Windows user, please see Windows users section.

Windows users#

Because compiling MBROLA in a Windows machine is somewhat complicated, Pymbrola only supports Linux-based operative systems. If you are a Windows user there are two ways in which you could use Pymbrola: Docker and Windows Subsystem for Linux (WSL).

Docker#

Install Docker Desktop in you machine, then run the following command in your terminal making sure Docker engine is running (having Docker Desktop open usually does it):

1  docker run -it -v "./.mbrola/output:/pymbrola/output" gongcastro/pymbrola:latest

This command will download the gongcastro/pymbrola Docker image from DockerHub if necessary, then run it in a container. The result will be a Python session open in the terminal, in which you will be able to import the mbrola module. Once the container is running in your terminal, you may want to first run mbrola.install_mbrola() and mbola_install_voice("it4"), replacing "it4" with whichever voice or voices you are planning to use. For example:

1from pymbrola import install, mbrola
2
3install.install_mbrola()
4install.install_voice(["it4", "fr4"])
5
6mbrola.MBROLA("kaffE").to_sound("output/kaffE.wav", voice="it4")

In order to be able to reach the generated files after you are done with the Docker container, a volume from your local host machine is attached to the container(-v "./.mbrola/output:/pymbrola/output"), so that any files generated inside it under the folder ./output will be persistently saved in the host machine wherever the path ./.mbrola/output (the dot "." usually in the same folder in which you opened in your temrinal before running Docker). To change the destination folder in your host machine, change ./.mbrola/output for any other path of your preference. This is where you will find your synthesised files after closing your Docker container.

Running the Docker image in Linux

If you are running the Docker image in a Linux distribution, you might need to start the container with setting some user permission:

1docker run -it --user "$(id -u):$(id -g)" -v "./.mbrola/output:/pymbrola/output" gongcastro/pymbrola:latest

Windows Subsystem for Linux (WSL)#

If you want to use Windows Subsystem for Linux (WSL) to run Pymbrola inside Windows, make sure first that your WSL installation is up and working:

1wsl --install
2wsl --version

MBROLA needs a few system dependencies. These allow to download the necessary code and compile MBROLA from source. We are also installing Python for using Pymbrola later. Open the terminal and run the following lines (if using WSL enter the terminal by running wsl on your command prompt):

1apt-get update
2apt-get install build-essential curl git gcc python3

Next, install Pymbrola as you normally would:

1python3 -m pip install mbrola

You are now set up! Now open a Python session and installing MBROLA and any desired voices:

1from pymbrola import install, mbrola
2
3install.install_mbrola()
4install.install_voice(["it4", "fr4"])
5
6mbrola.MBROLA("kaffE").to_sound("kaffE.wav", voice="it4")