02. Regarding Voice Prompts - larry-athey/rpi-smart-still GitHub Wiki
The RPi Smart Still controller uses voice prompts rather than pop-ups or pop-overs that get in the way of the display that require manual interaction to clear from the screen. Sound is produced via the 1/8" analog audio output jack of the Raspberry Pi as well as through your web browser if you have autoplay enabled for the IP address of your controller.
On a normal computer web browser, you can go to your settings and search for the word autoplay and it will locate the section where you can enable it globally for all sites, or create an exception for one site. This is disabled by default because of a bunch of websites that abused this capability when the < audio > and < video > HTML tags were new.
Please note that this isn't possible for all mobile web browsers and may actually be dependent upon an operating system setting. This is due to the fact that many alternative mobile web browsers don't actually use their own built-in HTML rendering engine and use the webview feature that's already built into the OS (for example, all Apple devices). These won't play on my iPad no matter what browser I use, but they'll play in the Brave browser on my Android phone.
Sound from the analog output of the Raspberry Pi is delayed by a processing loop (possibly up to 5 seconds) after your action and sound from a web browser can be delayed by up to 10 seconds. This is because the hidden div that plays the audio files is only refreshed every 10 seconds so as to provide enough time to download the MP3 file and play it.
Are you hearing double? Let me guess, you're using a full desktop OS and you hear one voice prompt, then you hear it again 5 seconds later. Right? You're hearing the voice prompts from the undercarriage as well as from your web browser. The paragraph right above this explains the 5 seconds delay. The solution is to turn off autoplay in your Firefox settings, then go to about:config
in the address bar, search for media.autoplay.blocking_policy
and set its value to 2 (sometimes Firefox will fail to honor its general settings if you restore a previous session on startup).
Voice prompts are created in the /usr/share/rpi-smart-still/voice-prompts.php
script using the Linux espeak program. It uses the english-us language file by default, which gives it that Stephen Hawking sound. You may edit the file /usr/share/rpi-smart-still/config.ini
to change the language file, or use a completely different speech synthesis program all together. Below is the command currently used by the system.
VOICE_PROMPTER=/usr/bin/espeak -v english-us -s 160 {MSG} --stdout
The {MSG} variable is replaced at execution time with the text to be converted to speech. Keep in mind that these prompts should only take up to 9 seconds to play because the autoplay in a user's web browser refreshes every 10 seconds whether the prompt is done playing or not. Test things with the valve calibration, those prompts take about 9 seconds with the default voice. Commenting out this configuration line will make the system fall back to the default voice.
NOTE: If you are using a full Raspbian 12 desktop installation, LXDE will hijack the audio subsystem and the loop that plays the voice prompts locally will not output anything. You will absolutely need to enable autoplay in your web browser in order to hear the voice prompts. Yet one more reason that I strongly suggest only using Raspbian 11 on the Raspberry Pi.