eclipse/streamsheets

Sonification with Streamsheets?

Closed this issue · 5 comments

Question

Does Streamsheets have a Sonification function? Meaning: Can I play a sound file True.mp3 when a certain key of a received JSON object holds True and a sound file False.mp3 when a certain key of a received JSON object holds False?

Context

We want to create a system for a company with a factory, where the temperature of a component of a machine in the factory is within a normal interval most of the time, but can suddenly come out of this interval. We want to alarm the overseers of the machine as extravagantly as possible.

Currently Streamsheets does not support playing a sound. The easiest way to achieve what you want to achieve is currently to run a small web application in another browser tab, where you can trigger sounds via webhooks. You could then trigger those from within Streamsheets with the HTTP functions, e.g., HTTP.GET() or HTTP.POST(). Probably this "small web application" would need a small server side as well:

To summarize:

  1. Streamsheets triggers webhook via HTTP
  2. Custom server forwards request via WebSockets to custom web app
  3. Custom web app plays the sound

I don't know if there are existing solutions for (2) and (3) though.

Playing sounds in the browser is a little bit of a pain, you typically can't play sounds until the user has clicked a button or some other action that directly leads to playing a sound.

That's true. But on the custom web application you could provide a button to init the audio context (AudioContext) once by the user.

Awesome! Much thanks. I already thought of using a custom web application. The idea of triggering the sound through an HTTP function of Streamsheets is new though, so is the concept of WebSockets! Thank you for the ideas!

I will close this issue now, but will take a note on the idea of playing sounds natively with Streamsheets formulas.