Speak a label to press what the canvas draws

A panel of switches drawn through a shader. Press "Listen" and say a name on the panel, such as "lamp" or "studio", or type the words in the box. The control is clicked, a ring spreads from it through the panel, and the transcript at the bottom highlights each word.

Say the name of a control

 

Show the code speech recognition biased to the controls on the panel
  1. A panel of buttons with one attribute. fx="voice" draws it through the shader. The second set of switches is hidden.
  2. The names of the controls that are drawn now.
  3. Start recognition with those names as phrases. On-device when SpeechRecognition.available() says so. Phrases are rebuilt after a press, because the press may show other controls.
  4. Match words to names and click. poke() starts the ring where the control is.
  5. The transcript and its highlights. One text node and two Highlight objects.
  6. The CSS: two properties for the shader, two highlight styles.
  7. The shader. Waves scaled by the sound level, a ring from each press, a band of light while listening. GLSL and WGSL.
  8. The page script.

How it works

The panel is one drawable element, uploaded to a texture on every paint and drawn by a fragment shader (fx: WebGPU when it works, else WebGL). The names of the buttons that aren't hidden are read from the DOM and given to SpeechRecognition as phrases, which makes the recogniser favour them. Words that come back are compared with the same names, and a match calls click() on the button. Switching room hides one set of buttons and shows the other, so the phrase list and the names that can be pressed change with what is drawn.

Words reach the panel through one function. The microphone, the text box and the live checks all call it, so the panel, the ring and the transcript work in a browser with no speech recognition. The line under the demo says which parts of the Web Speech API this browser has.

Live checks

ResultExperimentDetail

Findings