moji

moji

lallen on the edge

lallen: swiss German expression for "talking nonsense".

lallen is a python3 script which is leveraging the Microsoft edge speech engine to read pdf files. It's a patchwork of informations fond on the web and is leveraging the edge_tts python library.

lallen came to be from the desire of listening to scientific papers, similarly to an audio book, of course the figures of the papers cant be translated into speech (yet). I use it as support when reading the paper or also to listen to the papers while commuting.

please find the code here

feel free to use it at your discretion.

prerequisite

of course you will need python3 on your system as well as the edge_tts and pypdf libraries

˜ pip3 install edge_tts ˜ pip3 install pypdf

for audio playback you can make use of any mp3 player, such as mpv to playback in the terminal

˜ sudo apt install mpv

usage

lallen takes a pdf file as arguments and writes the audio to a mp3 file with the same name.

˜ ./lallen.py test.pdf

will produce

˜ test.mp3

play it back with mpv

˜ mpv ./test.mp3

you can change the voice (mostly language related) by changing the VOICE constant in the script. to find the list of available voices prompt

˜ edge-tts --list-voices

for some reasons you might need to install also the edge-tts (hyphen!) python library. Also be sure the the python bins library from your system is in your PATH.

˜ pip3 install edge-tts ˜ echo "export PATH=$HOME/.local/bin:$PATH"

lallen also generates a caption text (.vtt) file which displays the read text while being read. mpv works well with vtt, probably mplayer and VLC will work as well (not tested).