I've managed to pull together some functionality without a lot of coding, adding theme-based sound events to my printer.
Part of the functionality is delivered natively in the Raspberry Pi 3 computer itself since it has a stereo jack and in Raspbian because it includes the alsa-utils collection of sound-related code
Part of the functionality is delivered via the GCODE System Commands plugin, allowing you to run command-based activities with a newly-assigned (mock) GCODE command
Part of the functionality is delivered via the extensibility of the Controls tab by editing the ~/.octoprint/config.yaml file, allowing you to easily add controls to the interface
I've set things up so that I can support multiple themes. Say, when I later add another theme like from the Simpsons or from the J.A.R.V.I.S. character from Iron Man, I'll convert those references from /home/pi/sounds/r2d2/1.wav, for example, into related symlinks in /home/pi/sounds/1.wav which merely point to the referenced wav file in the current theme. In this way, one could change themes and keep the same set of GCODE references.
Likewise, I've also setup things so that the same placeholder like "1" always means the same thing, like "I need your attention", perhaps.
The thought would be that you would manually edit your GCODE file to insert the OCTO801 command or you would use one of the available plugins for action-at-z perhaps or a post-processing script to do the editing.
Having the sounds events available then means that you could set triggers for the existing OctoPrint API events and to throw these commands as well. You could register a high-temperature situation for the Raspberry Pi itself and to alert the user. One very good use might be to prompt for color changes or a filament runout condition.
As in, a 1.wav could be "yes sir" or something in the affirmative
5.wav could be "I'm sorry sir, I can't do that" or something in the negative
2.wav could be "password inkorrect" or something else that means bad passwurd
3.wav could be "Your spelling is atrocious" (see 2.wav)
4.wav could be "insufficient privileges"
6.wav could be something like "if your programming skills are anything like your math skills, you're lucky I haven't burned down your house. There are no numbers between 1 and 2, and even if there were, it certainly wouldn't be 5"
At the moment, R2D2's various utterances are open for interpretation. When I add the second theme, then things will be slightly more figured out on that one.
Very cool. I actually made a plugin that plays M300 beep codes in a html5 web interface. It creates some interesting sounds that mimic the beep tones of a controller, and play music with the right sequence.
Also did one that speaks to you based on custom command or M117
I'm going to have to throw the M117 speech synthesis onto my printer, that sounds cool. What's funny, is that I've created two different assignments for doing text-to-speech for my students but I've never gotten around to adding it to my printer. ha
If you have any type of DetailProgress plugin that utilizes M117 to show updates on the controller board, I would recommend enabling the custom gcode command @SPEAK, and adjust your gcode accordingly when and where you want it to say something.
Speaking of speaking. I wanted to ask you if there was any way to get it to stop saying "hash" ?
When I've got speech and detailed progress and popups turned on, and it gets to about 90%, I about wanna shoot the thing, cuz [########90] visually turns into
That's the reason I implemented the custom gcode command option. That way the plugin doesn't try to say the stuff coming from any other plugins that utilize M117 commands but only says the commands in your gcode that have the @SPEAK command. You'd have to adjust your slicer or GCODE Scripts in OctoPrint settings to use this command in place of M117 for the stuff that you wanted it to say out loud.