This plan tests the three Web Speech API calls for on-device speech recognition:
available()asks if on-device speech works for a language.install()lets a website use the speech model. Brave asks the user before the first download.start()listens and returns text, from an audio track or the microphone.
Only English is supported. The plan does not test every option. It tests the real model download, the real model, a real microphone and real websites.
-
Use Brave 1.100.44 or later.
-
Test page: open
https://yrliou.github.io/speech-test-page/. Each button shows the code it runs. The log shows the result. -
Profile: use a brand-new profile. On macOS:
"/Applications/Brave Browser Nightly.app/Contents/MacOS/Brave Browser Nightly" \ --user-data-dir=/tmp/brave-speech-qaWindows and Linux take the same
--user-data-diroption. -
Feature flag:
brave://flags/#brave-on-device-speech-recognition. It is off by default. Section 2 turns it on. -
Model: 636 MB. Brave downloads it only after the user allows it.
Do the sections in order, on one profile. Section 6.2 needs a standalone
Brave Origin build and a Brave Origin upgrade. Use a new profile for each,
with a different --user-data-dir.
Delete /tmp/brave-speech-qa, then launch with the command above.
- Open the test page. Status says
unavailable. - In 2. start(), keep Sample clip, tick processLocally and press
Start. The log shows
error language-not-supported. - Untick processLocally and press Start. The log shows
error network, and nointerimorfinallines.
- Open
brave://flags/#brave-on-device-speech-recognition. Brave On-Device Speech Recognition shows Default (Disabled). Set it to Enabled and press Relaunch. brave://componentshas no "Brave On-Device Speech Models" entry.- Reload the test page. Status says
downloadable. - Tick processLocally and press Start. The log shows
error language-not-supported.
This section uses only Allow. The test plan in brave-core#40814 covers the prompt and the settings switch.
-
In 1. available() and install(), press install(). A prompt opens. Press Allow.
brave://componentslists the model. The download can take a few minutes. -
When the download is done, the log shows
true. Status saysavailable. -
Change one option at a time in 1. available() and install(). Reset it after each row.
Option available() install() quality dictation'available'truequality conversation'unavailable'falselangs en-GB'available'truelangs fr-FR'unavailable'falseBrave's model serves the
commandanddictationqualities, and English only.
Use Sample clip, unless the step says Microphone. Reset the options to the defaults after each row.
The sample clip plays through an audio track at the computer's audio rate. The first log line shows it, usually 44100 or 48000 Hz. The model takes 16000 Hz, so this also tests the audio conversion.
| processLocally | Expected in the log |
|---|---|
| ticked | interim lines, then final "This is a sentence in a single segment" |
| unticked | The same |
Tick processLocally for each row.
| Option | Expected in the log |
|---|---|
| continuous unticked | Ends by itself a short time after the speech ends |
| interimResults unticked | Only the final line |
quality dictation |
final with the sentence |
quality conversation |
error language-not-supported |
lang fr-FR |
error language-not-supported |
Pick Microphone and tick processLocally.
- Press Start and allow the microphone. Say a sentence and press
Stop. The
finalline shows your words. - Untick continuous and do it again. It stops by itself a short time after you stop talking.
These websites do not set processLocally. They show your words:
https://www.google.com/intl/en/chrome/demos/speech.html: choose English, United States. Click the microphone, speak, click it again.https://speechnotes.co/dictate/: click the microphone, speak, click it again.
- Quit Brave and launch it again with the same command. Reload the test page.
Status says
available. Tick processLocally and press Start. The log shows the sentence. - Open
https://example.com, which is a different origin, and the DevTools console. Typing in the console counts as a click. Run:await SpeechRecognition.available({ langs: ['en-US'], processLocally: true })returns"downloadable". Each origin must callinstall()once.await SpeechRecognition.install({ langs: ['en-US'], processLocally: true })returnstrueright away, with no prompt.await SpeechRecognition.available({ langs: ['en-US'], processLocally: true })returns"available".
Use the same profile. The model is on disk, but these windows must not use it. Open a New Private Window, a Guest window and a New Private Window with Tor. In each, open the test page and check:
| Check | Expected |
|---|---|
| Status | unavailable |
| install() | false, with no prompt |
| Start, processLocally ticked | error language-not-supported |
| Start, processLocally unticked | error network, and no text |
Brave Origin comes in two types:
- Standalone: the separate Brave Origin app. It does not include on-device AI, so it must show no part of this feature.
- Upgrade: Brave with a Brave Origin purchase. Only this type has the
brave://settings/originpage, with an On-Device AI switch.
Use a brand-new profile. This build has no feature flag to turn on.
- Make sure that
brave://settings/privacyhas no On-device speech recognition switch. - Open the test page:
- Status says
unavailable. - Start with processLocally ticked gives
error language-not-supported. - Start with processLocally unticked gives
error network, and no text.
- Status says
The On-Device AI switch starts off. Use a brand-new profile, and turn on the feature flag as in section 2. Reload the test page after each change.
- With the switch off:
- Status says
unavailable. - Start with processLocally ticked gives
error language-not-supported. - Start with processLocally unticked gives
error network, and no text.
- Status says
- Turn On-Device AI on. Status says
downloadable. Press install(), then Allow. When the download is done, the log showstrue. Start with processLocally ticked shows the sentence. - Turn On-Device AI off. The model disappears from
brave://components. Status saysunavailable. Start with processLocally unticked giveserror network, and no text.
wpt_speech.wav is from web-platform-tests. See wpt_speech.wav.LICENSE.md.