lame:- Install Lame:
sudo apt-get install lame - Convert:
lame -V2 output.wav output.mp3
lame: sudo apt-get install lamelame -V2 output.wav output.mp3 $ pip install piper-tts
Since you installed it via pip, you can use the piper command directly in your terminal. Because Piper is a "neural" text-to-speech engine, it doesn't come with voices built-in; you have to provide a model file (.onnx) and its configuration file (.json).
Here is the workflow to convert your text file:
If you haven't already, download a voice from the official repository. You need both files for a specific voice (e.g., en_US-lessac-medium.onnx and en_US-lessac-medium.onnx.json).
To convert a text file (let's call it input.txt) into an audio file (output.wav), use the following syntax:
piper --model /path/to/voice.onnx < input.txt --output_file output.wav
If your text file is named script.txt and your model is in the same folder, run:
cat script.txt | piper --model en_US-lessac-medium.onnx --output_file speech.wav
Adjusting Speed: Use the --length_scale flag. A higher number makes it slower, a lower number makes it faster.
Example (Slower): --length_scale 1.5
Adding Pause/Sentence Gap: Use the --sentence_silence flag to add seconds of silence between sentences.
Example: --sentence_silence 0.5
Batch Processing: If you want to listen to the file immediately without saving it, you can pipe it to a player like aplay (built-in to Ubuntu):
cat script.txt | piper --model en_US-lessac-medium.onnx --output-raw | aplay -r 22050 -f S16_LE -t raw
Quick Note: If you get a "command not found" error, your pip script folder might not be in your PATH. You can usually fix this by running python3 -m piper instead of just piper at the start of the command.
Do you have a specific voice or language in mind, or are you looking for recommendations on the best-sounding models?
Sorry, I open the page, but can not find en_US-lessac-medium.onnx and en_US-lessac-medium.onnx.json
# Download the .onnx model file
wget -O en_US-lessac-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx?download=true"
# Download the .json config file
wget -O en_US-lessac-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json?download=true"
# Download the .onnx model file (approx. 114MB)
wget -O en_GB-cori-high.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/cori/high/en_GB-cori-high.onnx?download=true"
# Download the .json config file
wget -O en_GB-cori-high.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/cori/high/en_GB-cori-high.onnx.json?download=true"
Once those are finished, use this command to convert your text file (e.g., input.txt) to a UK-voiced audio file:
cat input.txt | piper --model en_GB-cori-high.onnx --output_file uk_speech.wav
Here are the commands for some of the most popular British (UK) voice models available for Piper. Each model has a slightly different personality and quality level.
This is a standard, clear male British voice.
# Model
wget -O en_GB-alan-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/alan/medium/en_GB-alan-medium.onnx?download=true"
# Config
wget -O en_GB-alan-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/alan/medium/en_GB-alan-medium.onnx.json?download=true"
Despite being "low" quality, it is very fast and efficient, with a distinct southern accent.
# Model
wget -O en_GB-southern_english_female-low.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/southern_english_female/low/en_GB-southern_english_female-low.onnx?download=true"
# Config
wget -O en_GB-southern_english_female-low.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/southern_english_female/low/en_GB-southern_english_female-low.onnx.json?download=true"
The VCTK model is unique because it contains dozens of different British speakers in one file. You can switch between them using the --speaker flag (e.g., --speaker 0, --speaker 1, etc.).
# Model
wget -O en_GB-vctk-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/vctk/medium/en_GB-vctk-medium.onnx?download=true"
# Config
wget -O en_GB-vctk-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/vctk/medium/en_GB-vctk-medium.onnx.json?download=true"
Just swap the model name in your command. For example, to use the Alan voice:
cat temp03.txt | piper --model en_GB-alan-medium.onnx --output_file output_alan.wav
Since you've had issues with corrupted downloads before, you can run this quick "check" after downloading to see if the file is valid:
# This will show the size; Alan should be ~15MB, VCTK ~45MB
ls -lh *.onnx
If you ever want to try a Northern English accent, there is also a northern_english_male model available—just let me know and I'll grab those links for you!
Yes, please. Thank you!
The Northern English voice is a great choice—it has a very distinct, warm character compared to the standard "Received Pronunciation" (London-style) voices.
Here are the commands for the Northern English Male model (Medium quality):
# Download the .onnx model file (approx. 63MB)
wget -O en_GB-northern_english_male-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx?download=true"
# Download the .json config file
wget -O en_GB-northern_english_male-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx.json?download=true"
Use this command to hear the new accent:
cat temp03.txt | piper --model en_GB-northern_english_male-medium.onnx --output_file northern_uk.wav
Since you've downloaded several voices now, your folder might be getting a bit crowded. You can verify all your available models at once with:
ls -lh *.onnx
Common Model Sizes for Comparison:
Cori (High): ~114 MB
Northern English (Medium): ~63 MB
Alan (Medium): ~15 MB
If any of these files show a size of only a few KB, they didn't download correctly—just delete that specific file and run the wget command for it again.
Enjoy the new voice! It’s one of the more unique ones in the British collection.
marker-pdf package, and then use the command-line interface. ocrmypdf or tesseract. # Install required apt packages
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev libffi-dev python3-dev
# Install tesseract and ghostscript related dependencies
sudo apt-get install -y libleptonica-dev libtesseract-dev pkg-config
sudo apt-get install -y ocrmypdf ghostscript
python3 -m venv marker_env
source marker_env/bin/activate
pip install torch torchvision torchaudio
# For PDF conversion only
pip install marker-pdf
# For full functionality (PDFs, images, etc.)
# pip install 'marker-pdf[full]'
marker_single.--output_format [markdown|json|html|chunks]: Specify the format for the output results.--output_dir PATH: Directory where output files will be saved. Defaults to the value specified in settings.OUTPUT_DIR.Install 'pandoc' software
How to install pandoc?
$ sudo apt update
$ sudo apt install pandoc
How to use pandoc?
$ tldr pandoc
Tips on how to use Narakeet to create phone greetings https://www.narakeet.com/languages/canadian-accent-text-to-s...
====================================================
English
==============================================
Mandarin
https://ttsfree.com/text-to-speech/chinese-mandarin-simplified
==============================================
Cantonese
https://ttsfree.com/text-to-speech/chinese-cantonese-traditional
======================
Concatenate Audio files
$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
For Windows:
(echo file 'first file.mp4' & echo file 'second file.mp4' )>list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy output.mp4How to read a file, which only contains a string, into Python, and then convert the string into a list?
from pathlib import Path
txt = Path('filename.txt').read_text()
list_ = list(txt.split('; '))
How to convert a pandas dataframe into a python list, and a python list into a pandas dataframe?
1. To convert a pandas dataframe into a python list
email_list = df['Email'].to_list()
or
email_list = df[['Name', 'Email']].to_list()
2. To convert a python list into a pandas dataframe
Examples
>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
... {'a': 100, 'b': 200, 'c': 300, 'd': 400},
... {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }]
>>> df = pd.DataFrame(mydict)
>>> df
a b c d
0 1 2 3 4
1 100 200 300 400
2 1000 2000 3000 4000