Speech output in a browser with ClojureScript.


The project is a simple program showing how to generate and customize speech output in a browser using ClojureScript.

The demo will detect whether or not your browser supports speech synthesis. If so, it will display a GUI allowing you to change the voice, volume, pace, and pitch. After entering a phrase to be spoken, click the button to have the browser speak the phrase.


To get an interactive development environment run:

lein figwheel

and open your browser at localhost:3449. This will auto compile and send all changes to the browser without the need to reload.

In the browser, use the UI to specify the phrase to be spoken and make any modifications desired to the default voice. Click the button to speak.

To create a production build run:

lein do clean, cljsbuild once

And open your browser in resources/public/index.html. You will not get live reloading, nor a REPL.

Project Info

The project was setup using the following command:

lein new figwheel voice-demo --reagent

Although reagent is used in the project, it is only for the one-time construction of the UI components. The dynamic re-rendering capabilities are not used at all.

Where this has been Tested

  • Windows 10 (64-bit)

    • Works on Mozilla Firefox 47.0.1.
    • Works on Chrome 51.0.2704.106 m (64-bit).
    • Fails on Internet Explorer 11 (Speech synthesis not supported.)
    • Fails on Microsoft Edge.

To Do

  • Make the phrase input text box the focused component on startup.
  • Make the button the default control activated when the user presses the Return key.

Known Issues

  • DOES NOT WORK if compiled with "min" flag.
  • On Chrome, after selecting a non-default voice and speaking, the voice selection box will reset to "native".


Copyright © 2016 David D. Clark

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.