Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


    <script src=""></script>
    <script src=""></script>

    <style type="text/css">
        .hidden {
            display: none;

        .active {
            background-color: #090;

    <script type="text/javascript">
        let recognizer;
        let words;
        const wordList = ["zero","one","two","three","four","five","six","seven","eight","nine", "yes", "no", "up", "down", "left", "right", "stop", "go"];
        let modelLoaded = false;
        document.addEventListener('DOMContentLoaded', () => {
            const wrapperElement = document.getElementById('sp-cmd-wrapper');
            for (let word of wordList) {
                wrapperElement.innerHTML += `<div class='col-3 col-md-6'><div id='word-${word}' class='badge'>${word}</div></div>`;
            document.getElementById("audio-switch").addEventListener('change', (event) => {
                if( {
                    if(modelLoaded) {
                } else {
        async function loadModel() { 
            // Show the loading element
            const loadingElement = document.getElementById('demo-loading');
            // When calling `create()`, you must provide the type of the audio input.
            // - BROWSER_FFT uses the browser's native Fourier transform.
            recognizer = speechCommands.create("BROWSER_FFT");  
            await recognizer.ensureModelLoaded()
            words = recognizer.wordLabels();
            modelLoaded = true;
            // Hide the loading element
        function startListening() {
            recognizer.listen(({scores}) => {
                // Everytime the model evaluates a result it will return the scores array
                // Based on this data we will build a new array with each word and it's corresponding score
                scores = Array.from(scores).map((s, i) => ({score: s, word: words[i]}));
                // After that we sort the array by scode descending
                scores.sort((s1, s2) => s2.score - s1.score);
                // And we highlight the word with the highest score
                const elementId = `word-${scores[0].word}`;
                // This is just for removing the highlight after 2.5 seconds
                setTimeout(() => {
                }, 2500);
                probabilityThreshold: 0.70
        function stopListening(){
    <div class="demo">
        Please enable the microphone checkbox and authorize this site to access the microphone.
        <br />
        Once the process finished loading speak one of the word bellow and see the magic happen.
        <br /><br />
            <label class="form-switch">
                <input type="checkbox" id="audio-switch">
            <div id="demo-loading" class="hidden">Loading...</div>
        <div id="sp-cmd-wrapper" class="grid"></div>