4.1. Introduction
4.1.1. Speech
Navit can announce driving directions with voice. Navit can use different mechanisms to play these announcements. Note that not all tools are available on all platforms.
4.1.1.1. Prerecorded samples
Navit is able to compose phrases if you give it a set of prerecorded samples. Configuration example:
<speech type="cmdline" data="aplay -q %s"
sample_dir="/path/to/sampledir" sample_suffix=".wav" flags="1"
vocabulary_name="0" vocabulary_name_systematic="0" vocabulary_distances="0"/>
The directory ‘’sample_dir’’ should contain audio files. ‘’sample_suffix’’ is the common file type suffix of those files. The names of the files (without the suffix) must correspond to the text they contain. For each text it wants to speak, Navit will look for one or more sample files with corresponding names (ignoring upper/lower case). So for “turn right in 300 meters” you could use turn.wav, right.wav, in.wav, 300.wav, meters.wav. Navit will prefer files that contain multiple words: If file “turn right.wav” is present, it will be used even if you have turn.wav and right.wav.
Note that Navit internally handles all text in UTF-8 encoding. If you use a file system where file names are not encoded with UTF-8 (such as Windows), Navit will only find files for ASCII text. If you use a language that uses non-ASCII characters, the file name must be the [http://en.wikipedia.org/wiki/Percent-encoding percent encoding] of the UTF-8 representation of the text. For example the filename for “süd” would be “s%c3%bcd.wav” (because “ü” is encoded as C3BC in UTF-8). For this feature to work, you must set ‘’flags’’ to 1.
‘’data’’ is the program that can be used to play the sample files. You should specify the program name along with any necessary parameters. The placeholder “%s” will be replaced with the file(s) to be played. All files required for a text will be passed in one go, so the program will need to support playing multiple files. Note that the %s should ‘’not’’ be quoted; the text is not passed through a shell.
Note that if any file that is needed to compose the complete phrase is missing then Navit will be silent. In that case a warning will be printed. Unfortunately, there is no complete list of the samples required. However, all the navigation text is contained in the translation files (.po files), so you can get a rough list.
By default Navit is trying to announce street names. To disable this feature you can set ‘’vocabulary_name’’ and ‘’vocabulary_name_systematic’’ to 0 in the speech tag which will specify that the speech synthesizer isn’t capable of speaking names. Also there is ‘’vocabulary_distances’’ which you can set to 0 so only the minimum set of 1,2,3,4,5,10,25,50,75,100,150,200,250,300,400,500,750 as numbers is used.
4.1.1.2. espeak
<speech type="cmdline" data="espeak -s 150 -v english_rp %s"/>
Will use espeak instead, for those who want Navit to speak to them in English, at 150 words per minute. The ‘’%s’’ is filled in by Navit when sent to the speech synthesis software (with something like “Turn left” or whatever is appropriate at the time). If you need more features, you should use an external wrapper script which can contain anything supported by your shell (see [[Translations]]).
4.1.1.3. festival
4.1.1.4. flite
4.1.1.5. speech2wave
<speech type="cmdline" data="/home/mobian/bin/speech2text '%s'" cps="15"/>
#!/bin/bash
function cleanup() {
rm -f /tmp/$$.wav
}
trap cleanup TERM EXIT
pico2wave -l de-DE -w /tmp/$$.wav "$@"
aplay /tmp/$$.wav
install speech2wavewith
apt install libttspico-utils
4.1.1.6. piper-tts
<speech type="cmdline" data="/home/mobian/bin/speech2text '%s'" cps="5"/>
#!/bin/bash
piper -m /home/mobian/tts/de_DE-thorsten-high.onnx --output-raw <<< "$@" | aplay -r 22500 -c 1 -f S16_LE
install piper-tts with
apt installer pipx
pipx install piper-tts
Then obtain the voice files and configuration, for example from https://www.thorsten-voice.de/thorsten-voice-%f0%9f%92%9b-piper/ On my Oneplus 6 phone from 2018, Thorsten-voice is sufficiently fast on medium quality setting.
4.1.1.7. Mbrola
<speech type="cmdline" data="espeak-ng -s 170 -a 150 -p 40 -v mb-de7 '%s'" cps="15"/>
4.1.1.8. Android
<speech type="android" cps="15"/>
4.1.1.9. Start up in silent mode
To have Navit start up in silent mode, insert active="0" somewhere in your speech tag. For example on Android:
<speech type="android" cps="15" active="0"/>
In this case, you should place a toggle_announcer item in your [[OSD]] configuration, or add a menu item so you can enable speech output when you need it.