Unlocking Fun Experiments: Exploring the Web Speech API

This ad is not shown to multipass and full ticket holders
JSNation US
JSNation US 2026
November 16 - 19, 2026
New York, US & Online
Upcoming event
JSNation US 2026
JSNation US 2026
November 16 - 19, 2026. New York, US & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

Voice interfaces surround us daily, helping us with some tasks. But let's forget productivity for a second and experiment with our voice on the Web.
We will look at the current state of the Web Speech API, explore its potential in Karaoke, and have some fun!

This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.

FAQ

Anna is a frontend developer at the agency Hattar and a member of the IndieWeb community. She spends her free time blogging and experimenting with web technologies.

The talk is about creating a gamified karaoke experience in a browser using the Web Speech API, focusing on speech recognition and its challenges and potential.

The Web Speech API is a browser API that includes speech recognition and speech synthesis functionalities. It is used for applications like form input, continuous dictation, and control.

Anna faced challenges with browser support, as the Web Speech API is not supported by all browsers and often requires server-based processing, which can cause privacy concerns and offline limitations.

The purpose of Anna's karaoke project is to create a more interactive and gamified karaoke experience using web technologies, particularly the Web Speech API, to enhance user engagement.

Limitations include lack of support across all browsers, reliance on server processing for some browsers, inability to work offline, and issues with privacy concerns.

Alternative projects include Tony Edwards' talk on using the Web Speech API for jotting down rhymes and Stephanie Eccles' 12 Days of Web Dev Challenge. There are also polyfills and projects like the Common Voice from Mozilla.

Anna advises that side projects don't need to be monetized or become open source to be valid. Building "useless" things can be fun and educational, and it's okay to create for personal satisfaction.

While it may not be widely used at work, the Web Speech API can be utilized for accessibility, voice interfaces, and experimental projects that explore the capabilities of speech recognition in web applications.

Anna mentions the Rasmus as a personal anecdote that inspired her to create a karaoke project since there was only one Rasmus song available at karaoke, which wasn't her favorite.

Ana Rodrigues
Ana Rodrigues
21 min
21 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Hello, JS Nation! Today, I'll show you how I created gamified karaoke using Web Speech API. The Web Speech API has two parts: speech recognition and speech to text. It was originally built for karaoke but can also be used for forms and dictation. There are some quirks with the speech recognition API, such as limited microphone input and variation in implementation and privacy concerns across browsers. The speaker demonstrates how to implement speech recognition in a karaoke application and tests its error matching capabilities. Other interesting points include voice interface design considerations and the value of engaging in fun and unproductive side projects.

1. Part 1 - Introduction

Short description:

Hello, JS Nation! Today, I'll show you how I created gamified karaoke using Web Speech API. I'm Anna, a frontend developer at Hattar. I'm passionate about the IndieWeb community and have written about it on Smash Magazine. Let's dive in! I had a problem with karaoke songs, so I decided to gamify the experience. I'll explain how I used the free browser native speech recognition feature, namely Web Speech API.

Hello, JS Nation! I'm so happy to be here with you today. I'm going to show you how I've created my own gamified karaoke in a browser using Web Speech API. So allow me to introduce myself.

Hello, my name is Anna and I'm a frontend developer at the agency Hattar. I spend the majority of my free time on my blog, and I'm quite keen on the IndieWeb community. In fact, in the past, I've written a case for it on Smash Magazine. So please have a look and if you're in the chat, please send me your personal websites and blogs. I would love to read them.

Right, before we get started, I must mention one thing in particular. I do not represent any browser vendor. And for that, I haven't been to karaoke for years now. And I actually thought I would get more invitations after giving this talk a few times, but it hasn't happened. And also, I'm actually a big fan of the Rasmus. I'm not a stan, I'm just a fan. And the reason why I bring this up is that kind of the reason why this talk even popped into my head. I had a problem I needed to fix.

So whenever I go karaoke, there's only one song from Rasmus available. It's always in the chat in the shadows. And it's just not my favorite. So pop, for sure. But I needed more. So I start thinking, okay, what if we had more than just lyrics on the screen? What if we could gamify the experience? Because I know I would win. I know all the lyrics from my heart. So I set myself an adventure to create my perfect karaoke experience. And spoiler alert, it didn't go as well as I imagined. So let's see why. I searched for speech to text, and all the results that came up were all from private companies that offer this type of API as a service for a cost. But we know that there's a browser native speech recognition thing, and it's free. So I thought, no, no, I'm not spending money on this. So let's talk about Web Speech API, in particular, the speech recognition.

2. Part 2 - Web Speech API

Short description:

The Web Speech API has two parts: speech recognition and speech to text. It was originally built for karaoke but can also be used for forms and dictation. Although it's not supported in Firefox, Chrome provides a server-based recognition engine. Chrome has access to Google's transcription service, while Safari sends speech data to Apple. The implementation and privacy concerns vary across browsers.

So the Web Speech API split into two, the speech recognition and the speech to text, and it's starting to be obvious how I'm going to be using the speech recognition here. But actually, one of the core ideas straight was built for karaoke, but it was to enable developers to use the speech recognition as an input for forms, continuous dictation, and control. In fact, there's quite an old draft that details how this API should work on input field. It's really old, not everything was implemented, but it's still a very interesting read.

In fact, you can see this vision live in a tool that many of us are familiar with. In Chrome, when using the Google Translate, you are able to use the microphone function to speak into an input field and see it translated into text. I thought, great, the code works in my head, so let's see what's the browser support. I was quite optimistic. I went to MDN, and it looks like it currently isn't supported in Firefox, and any other browser still requires a vendor prefix or a different name. And I thought, all right, one browser out, it's not the worst, let's go. Wrong.

Actually, this is a more realistic outcome, in my experience. And it turns out the explanation is fairly simple. This quote from the MDN page says, on some browsers like Chrome, using speech recognition on a webpage involves a server-based recognition engine. Your audio is sent to a web service for recognition processing, so it won't work offline. Right. Thinking about it, it makes sense. It needs access to a lot of data to train on. So browser vendors that belong to massive corporations have an easier time with all the necessary infrastructure, as well as that data to train on.

And this is an important note, browsers that use Chrome don't necessarily have access to the Google transcription service. It's a paid service from Google, which Chrome gets to use for free. Again, yeah, it does make sense. And when trying it on Safari, I was presented with a popover that said speech data from this app will be sent to Apple to process your requests. This will also help Apple improve its speech recognition technology. All right. At this point, I'm down to two browsers only. But I was in too deep, so I'm not going to give up. But I was curious, what's happening in Firefox? Unfortunately, I wasn't able to be in touch with someone who is currently working on this, but I was pointed to an enlightening thread that talks about their concerns about privacy and implementation. So it's a really interesting thread. I really recommend having a look at it, especially if you're curious to see why some browsers make the decisions they do.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
This Talk discusses building a voice-activated AI assistant using web APIs and JavaScript. It covers using the Web Speech API for speech recognition and the speech synthesis API for text to speech. The speaker demonstrates how to communicate with the Open AI API and handle the response. The Talk also explores enabling speech recognition and addressing the user. The speaker concludes by mentioning the possibility of creating a product out of the project and using Tauri for native desktop-like experiences.
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top ContentPremium
Today's Talk discusses the importance of managing technical debt through refactoring practices, prioritization, and planning. Successful refactoring requires establishing guidelines, maintaining an inventory, and implementing a process. Celebrating success and ensuring resilience are key to building a strong refactoring culture. Visibility, support, and transparent communication are crucial for addressing technical debt effectively. The team's responsibilities, operating style, and availability should be transparent to product managers.
A Practical Guide for Migrating to Server Components
React Advanced 2023React Advanced 2023
28 min
A Practical Guide for Migrating to Server Components
Top Content
React query version five is live and we'll be discussing the migration process to server components using Next.js and React Query. The process involves planning, preparing, and setting up server components, migrating pages, adding layouts, and moving components to the server. We'll also explore the benefits of server components such as reducing JavaScript shipping, enabling powerful caching, and leveraging the features of the app router. Additionally, we'll cover topics like handling authentication, rendering in server components, and the impact on server load and costs.
Monolith to Micro-Frontends
React Advanced 2022React Advanced 2022
22 min
Monolith to Micro-Frontends
Top Content
Microfrontends are considered as a solution to the problems of exponential growth, code duplication, and unclear ownership in older applications. Transitioning from a monolith to microfrontends involves decoupling the system and exploring options like a modular monolith. Microfrontends enable independent deployments and runtime composition, but there is a discussion about the alternative of keeping an integrated application composed at runtime. Choosing a composition model and a router are crucial decisions in the technical plan. The Strangler pattern and the reverse Strangler pattern are used to gradually replace parts of the monolith with the new application.
Power Fixing React Performance Woes
React Advanced 2023React Advanced 2023
22 min
Power Fixing React Performance Woes
Top Content
This Talk discusses various strategies to improve React performance, including lazy loading iframes, analyzing and optimizing bundles, fixing barrel exports and tree shaking, removing dead code, and caching expensive computations. The speaker shares their experience in identifying and addressing performance issues in a real-world application. They also highlight the importance of regularly auditing webpack and bundle analyzers, using tools like Knip to find unused code, and contributing improvements to open source libraries.

Workshops on related topic

Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
Workshop
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
Build a chat room with Appwrite and React
JSNation 2022JSNation 2022
41 min
Build a chat room with Appwrite and React
Workshop
Wess Cope
Wess Cope
API's/Backends are difficult and we need websockets. You will be using VS Code as your editor, Parcel.js, Chakra-ui, React, React Icons, and Appwrite. By the end of this workshop, you will have the knowledge to build a real-time app using Appwrite and zero API development. Follow along and you'll have an awesome chat app to show off!
Hard GraphQL Problems at Shopify
GraphQL Galaxy 2021GraphQL Galaxy 2021
164 min
Hard GraphQL Problems at Shopify
Workshop
Rebecca Friedman
Jonathan Baker
Alex Ackerman
Théo Ben Hassen
 Greg MacWilliam
5 authors
At Shopify scale, we solve some pretty hard problems. In this workshop, five different speakers will outline some of the challenges we’ve faced, and how we’ve overcome them.

Table of contents:
1 - The infamous "N+1" problem: Jonathan Baker - Let's talk about what it is, why it is a problem, and how Shopify handles it at scale across several GraphQL APIs.
2 - Contextualizing GraphQL APIs: Alex Ackerman - How and why we decided to use directives. I’ll share what directives are, which directives are available out of the box, and how to create custom directives.
3 - Faster GraphQL queries for mobile clients: Theo Ben Hassen - As your mobile app grows, so will your GraphQL queries. In this talk, I will go over diverse strategies to make your queries faster and more effective.
4 - Building tomorrow’s product today: Greg MacWilliam - How Shopify adopts future features in today’s code.
5 - Managing large APIs effectively: Rebecca Friedman - We have thousands of developers at Shopify. Let’s take a look at how we’re ensuring the quality and consistency of our GraphQL APIs with so many contributors.
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
0 To Auth In An Hour For Your JavaScript App
JSNation 2023JSNation 2023
57 min
0 To Auth In An Hour For Your JavaScript App
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.js backend + Vanilla JS frontend) to authenticate users with One Time Passwords (email) and OAuth, including:
- User authentication – Managing user interactions, returning session / refresh JWTs- Session management and validation – Storing the session securely for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.