expo-speech-recognition 0.2.24 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +93 -65
  3. package/android/src/main/java/expo/modules/speechrecognition/ExpoSpeechRecognitionModule.kt +2 -0
  4. package/android/src/main/java/expo/modules/speechrecognition/ExpoSpeechService.kt +37 -3
  5. package/build/ExpoSpeechRecognitionModule.d.ts +0 -2
  6. package/build/ExpoSpeechRecognitionModule.d.ts.map +1 -1
  7. package/build/ExpoSpeechRecognitionModule.js +6 -18
  8. package/build/ExpoSpeechRecognitionModule.js.map +1 -1
  9. package/build/ExpoSpeechRecognitionModule.types.d.ts +34 -3
  10. package/build/ExpoSpeechRecognitionModule.types.d.ts.map +1 -1
  11. package/build/ExpoSpeechRecognitionModule.types.js.map +1 -1
  12. package/build/ExpoSpeechRecognitionModule.web.d.ts +43 -10
  13. package/build/ExpoSpeechRecognitionModule.web.d.ts.map +1 -1
  14. package/build/ExpoSpeechRecognitionModule.web.js +109 -105
  15. package/build/ExpoSpeechRecognitionModule.web.js.map +1 -1
  16. package/build/ExpoWebSpeechRecognition.d.ts.map +1 -1
  17. package/build/ExpoWebSpeechRecognition.js +4 -4
  18. package/build/ExpoWebSpeechRecognition.js.map +1 -1
  19. package/build/index.d.ts +3 -4
  20. package/build/index.d.ts.map +1 -1
  21. package/build/index.js +3 -3
  22. package/build/index.js.map +1 -1
  23. package/build/useSpeechRecognitionEvent.d.ts +2 -2
  24. package/build/useSpeechRecognitionEvent.d.ts.map +1 -1
  25. package/build/useSpeechRecognitionEvent.js +5 -9
  26. package/build/useSpeechRecognitionEvent.js.map +1 -1
  27. package/ios/ExpoSpeechRecognitionModule.swift +2 -0
  28. package/package.json +9 -4
  29. package/src/ExpoSpeechRecognitionModule.ts +6 -32
  30. package/src/ExpoSpeechRecognitionModule.types.ts +38 -3
  31. package/src/ExpoSpeechRecognitionModule.web.ts +172 -145
  32. package/src/ExpoWebSpeechRecognition.ts +5 -8
  33. package/src/index.ts +22 -33
  34. package/src/useSpeechRecognitionEvent.ts +11 -19
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # expo-speech-recognition
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 8a3f597: Support for SDK 52.
8
+
9
+ ### Breaking Changes:
10
+
11
+ - Removed `ExpoSpeechRecognitionModuleEmitter`. Use `ExpoSpeechRecognitionModule.addListener` instead.
12
+
13
+ ## 0.2.25
14
+
15
+ ### Patch Changes
16
+
17
+ - 24693ad: Initial release!
package/README.md CHANGED
@@ -24,6 +24,7 @@ expo-speech-recognition implements the iOS [`SFSpeechRecognizer`](https://develo
24
24
  - [Polyfilling the Web SpeechRecognition API](#polyfilling-the-web-speechrecognition-api)
25
25
  - [Muting the beep sound on Android](#muting-the-beep-sound-on-android)
26
26
  - [Improving accuracy of single-word prompts](#improving-accuracy-of-single-word-prompts)
27
+ - [Language Detection](#language-detection)
27
28
  - [Platform Compatibility Table](#platform-compatibility-table)
28
29
  - [Common Troubleshooting issues](#common-troubleshooting-issues)
29
30
  - [Android issues](#android-issues)
@@ -35,15 +36,14 @@ expo-speech-recognition implements the iOS [`SFSpeechRecognizer`](https://develo
35
36
  - [requestPermissionsAsync()](#requestpermissionsasync-promisepermissionresponse)
36
37
  - [getPermissionsAsync()](#getpermissionsasync-promisepermissionresponse)
37
38
  - [getStateAsync()](#getstateasync-promisespeechrecognitionstate)
38
- - [addSpeechRecognitionListener()](#addspeechrecognitionlistener)
39
- - [getSupportedLocales()](#getsupportedlocales-promise-locales-string-installedlocales-string-)
39
+ - [getSupportedLocales()](#getsupportedlocales)
40
40
  - [getSpeechRecognitionServices()](#getspeechrecognitionservices-string-android-only)
41
41
  - [getDefaultRecognitionService()](#getdefaultrecognitionservice--packagename-string--android-only)
42
42
  - [getAssistantService()](#getassistantservice--packagename-string--android-only)
43
43
  - [isRecognitionAvailable()](#isrecognitionavailable-boolean)
44
44
  - [supportsOnDeviceRecognition()](#supportsondevicerecognition-boolean)
45
45
  - [supportsRecording()](#supportsrecording-boolean)
46
- - [androidTriggerOfflineModelDownload()](#androidtriggerofflinemodeldownload-locale-string--promise-status-opened_dialog--download_success--download_canceled-message-string-)
46
+ - [androidTriggerOfflineModelDownload()](#androidtriggerofflinemodeldownload)
47
47
  - [setCategoryIOS()](#setcategoryios-void-ios-only)
48
48
  - [getAudioSessionCategoryAndOptionsIOS()](#getaudiosessioncategoryandoptionsios-ios-only)
49
49
  - [setAudioSessionActiveIOS()](#setaudiosessionactiveiosvalue-boolean-options--notifyothersondeactivation-boolean--void)
@@ -98,10 +98,13 @@ If you've just created a new Expo project or have only been using the Expo SDK s
98
98
  After completing **Step 2: Configure the config plugin**, follow these steps:
99
99
 
100
100
  - To (re)-generate the native Android project, run:
101
+
101
102
  ```bash
102
103
  npx expo run:android
103
104
  ```
105
+
104
106
  - To (re)-generate the native iOS project, run:
107
+
105
108
  ```bash
106
109
  npx expo run:ios
107
110
  ```
@@ -138,7 +141,7 @@ function App() {
138
141
  setTranscript(event.results[0]?.transcript);
139
142
  });
140
143
  useSpeechRecognitionEvent("error", (event) => {
141
- console.log("error code:", event.error, "error messsage:", event.message);
144
+ console.log("error code:", event.error, "error message:", event.message);
142
145
  });
143
146
 
144
147
  const handleStart = async () => {
@@ -164,7 +167,10 @@ function App() {
164
167
  {!recognizing ? (
165
168
  <Button title="Start" onPress={handleStart} />
166
169
  ) : (
167
- <Button title="Stop" onPress={ExpoSpeechRecognitionModule.stop} />
170
+ <Button
171
+ title="Stop"
172
+ onPress={() => ExpoSpeechRecognitionModule.stop()}
173
+ />
168
174
  )}
169
175
 
170
176
  <ScrollView>
@@ -204,32 +210,35 @@ ExpoSpeechRecognitionModule.requestPermissionsAsync().then((result) => {
204
210
  You can also use the `ExpoSpeechRecognitionModule` to use the native APIs directly. The listener events are similar to the Web Speech API.
205
211
 
206
212
  ```ts
207
- import {
208
- ExpoSpeechRecognitionModule,
209
- addSpeechRecognitionListener,
210
- } from "expo-speech-recognition";
213
+ import { ExpoSpeechRecognitionModule } from "expo-speech-recognition";
211
214
 
212
215
  // Register event listeners
213
- const startListener = addSpeechRecognitionListener("start", () => {
216
+ const startListener = ExpoSpeechRecognitionModule.addListener("start", () => {
214
217
  console.log("Speech recognition started");
215
218
  });
216
219
 
217
220
  // and remove the listener when you're done:
218
221
  startListener.remove();
219
222
 
220
- const endListener = addSpeechRecognitionListener("end", () => {
223
+ const endListener = ExpoSpeechRecognitionModule.addListener("end", () => {
221
224
  console.log("Speech recognition ended");
222
225
  });
223
226
 
224
- const resultListener = addSpeechRecognitionListener("result", (event) => {
225
- // Note: this is not the same as the `result` event listener on the web speech API
226
- // event.results is an array of results (e.g. `[{ transcript: "hello", confidence: 0.5, segments: [] }]`)
227
- console.log("results:", event.results, "final:", event.isFinal);
228
- });
227
+ const resultListener = ExpoSpeechRecognitionModule.addListener(
228
+ "result",
229
+ (event) => {
230
+ // Note: this is not the same as the `result` event listener on the web speech API
231
+ // event.results is an array of results (e.g. `[{ transcript: "hello", confidence: 0.5, segments: [] }]`)
232
+ console.log("results:", event.results, "final:", event.isFinal);
233
+ },
234
+ );
229
235
 
230
- const errorListener = addSpeechRecognitionListener("error", (event) => {
231
- console.log("error code:", event.error, "error messsage:", event.message);
232
- });
236
+ const errorListener = ExpoSpeechRecognitionModule.addListener(
237
+ "error",
238
+ (event) => {
239
+ console.log("error code:", event.error, "error message:", event.message);
240
+ },
241
+ );
233
242
 
234
243
  // Start speech recognition
235
244
  ExpoSpeechRecognitionModule.start({
@@ -247,6 +256,7 @@ ExpoSpeechRecognitionModule.start({
247
256
  // [Default: false] Prevent device from sending audio over the network. Only enabled if the device supports it.
248
257
  requiresOnDeviceRecognition: false,
249
258
  // [Default: false] Include punctuation in the recognition results. This applies to full stops and commas.
259
+ // Not supported on Android 12 and below. On Android 13+, only supported when on-device recognition is enabled.
250
260
  addsPunctuation: false,
251
261
  // [Default: undefined] Short custom phrases that are unique to your app.
252
262
  contextualStrings: ["Carlsen", "Nepomniachtchi", "Praggnanandhaa"],
@@ -321,18 +331,19 @@ ExpoSpeechRecognitionModule.abort();
321
331
 
322
332
  Events are largely based on the [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition). The following events are supported:
323
333
 
324
- | Event Name | Description | Notes |
325
- | -------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
326
- | `audiostart` | Audio capturing has started | Includes the `uri` if `recordingOptions.persist` is enabled. |
327
- | `audioend` | Audio capturing has ended | Includes the `uri` if `recordingOptions.persist` is enabled. |
328
- | `end` | Speech recognition service has disconnected. | This should always be the last event dispatched, including after errors. |
329
- | `error` | Fired when a speech recognition error occurs. | You'll also receive an `error` event (with code "aborted") when calling `.abort()` |
330
- | `nomatch` | Speech recognition service returns a final result with no significant recognition. | You may have non-final results recognized. This may get emitted after cancellation. |
331
- | `result` | Speech recognition service returns a word or phrase has been positively recognized. | On Android, continous mode runs as a segmented session, meaning when a final result is reached, additional partial and final results will cover a new segment separate from the previous final result. On iOS, you should expect one final result before speech recognition has stopped. |
332
- | `speechstart` | Fired when any sound — recognizable speech or not — has been detected | On iOS, this will fire once in the session after a result has occurred |
333
- | `speechend` | Fired when speech recognized by the speech recognition service has stopped being detected. | Not supported yet on iOS |
334
- | `start` | Speech recognition has started | Use this event to indicate to the user when to speak. |
335
- | `volumechange` | Fired when the input volume changes. | Returns a value between -2 and 10 indicating the volume of the input audio. Consider anything below 0 to be inaudible. |
334
+ | Event Name | Description | Notes |
335
+ | ------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
336
+ | `audiostart` | Audio capturing has started | Includes the `uri` if `recordingOptions.persist` is enabled. |
337
+ | `audioend` | Audio capturing has ended | Includes the `uri` if `recordingOptions.persist` is enabled. |
338
+ | `end` | Speech recognition service has disconnected. | This should always be the last event dispatched, including after errors. |
339
+ | `error` | Fired when a speech recognition error occurs. | You'll also receive an `error` event (with code "aborted") when calling `.abort()` |
340
+ | `nomatch` | Speech recognition service returns a final result with no significant recognition. | You may have non-final results recognized. This may get emitted after cancellation. |
341
+ | `result` | Speech recognition service returns a word or phrase has been positively recognized. | On Android, continous mode runs as a segmented session, meaning when a final result is reached, additional partial and final results will cover a new segment separate from the previous final result. On iOS, you should expect one final result before speech recognition has stopped. |
342
+ | `speechstart` | Fired when any sound — recognizable speech or not — has been detected | On iOS, this will fire once in the session after a result has occurred |
343
+ | `speechend` | Fired when speech recognized by the speech recognition service has stopped being detected. | Not supported yet on iOS |
344
+ | `start` | Speech recognition has started | Use this event to indicate to the user when to speak. |
345
+ | `volumechange` | Fired when the input volume changes. | Returns a value between -2 and 10 indicating the volume of the input audio. Consider anything below 0 to be inaudible. |
346
+ | `languagedetection` | Called when the language detection (and switching) results are available. | Android 14+ only with `com.google.android.as`. Enabled with `EXTRA_ENABLE_LANGUAGE_DETECTION` in the `androidIntent` option when starting. Also can be called multiple times by enabling `EXTRA_ENABLE_LANGUAGE_SWITCH`. |
336
347
 
337
348
  ## Handling Errors
338
349
 
@@ -341,17 +352,17 @@ To handle errors, you can listen to the `error` event:
341
352
  ```ts
342
353
  import {
343
354
  type ExpoSpeechRecognitionErrorCode,
344
- addSpeechRecognitionListener,
355
+ ExpoSpeechRecognitionModule,
345
356
  useSpeechRecognitionEvent,
346
357
  } from "expo-speech-recognition";
347
358
 
348
- addSpeechRecognitionListener("error", (event) => {
349
- console.log("error code:", event.error, "error messsage:", event.message);
359
+ ExpoSpeechRecognitionModule.addListener("error", (event) => {
360
+ console.log("error code:", event.error, "error message:", event.message);
350
361
  });
351
362
 
352
363
  // or through the `useSpeechRecognitionEvent` hook
353
364
  useSpeechRecognitionEvent("error", (event) => {
354
- console.log("error code:", event.error, "error messsage:", event.message);
365
+ console.log("error code:", event.error, "error message:", event.message);
355
366
  });
356
367
 
357
368
  // or through the `ExpoSpeechRecognitionErrorCode` type
@@ -551,10 +562,15 @@ You can use the `volumeChangeEventOptions.enabled` option to enable volume meter
551
562
  See: [VolumeMeteringAvatar.tsx](https://github.com/jamsch/expo-speech-recognition/tree/main/example/components/VolumeMeteringAvatar.tsx) for a complete example that involves using `react-native-reanimated` to animate the volume metering.
552
563
 
553
564
  ```tsx
554
- import { ExpoSpeechRecognitionModule } from "expo-speech-recognition";
565
+ import { Button } from "react-native";
566
+ import {
567
+ ExpoSpeechRecognitionModule,
568
+ useSpeechRecognitionEvent,
569
+ } from "expo-speech-recognition";
555
570
 
556
- function VolumeMeteringAvatar() {
571
+ function VolumeMeteringExample() {
557
572
  useSpeechRecognitionEvent("volumechange", (event) => {
573
+ // a value between -2 and 10. <= 0 is inaudible
558
574
  console.log("Volume changed to:", event.value);
559
575
  });
560
576
 
@@ -563,17 +579,13 @@ function VolumeMeteringAvatar() {
563
579
  lang: "en-US",
564
580
  volumeChangeEventOptions: {
565
581
  enabled: true,
582
+ // how often you want to receive the volumechange event
566
583
  intervalMillis: 300,
567
584
  },
568
585
  });
569
586
  };
570
587
 
571
- return (
572
- <View>
573
- <Button title="Start" onPress={handleStart} />
574
- <Text>Volume: {volume}</Text>
575
- </View>
576
- );
588
+ return <Button title="Start" onPress={handleStart} />;
577
589
  }
578
590
  ```
579
591
 
@@ -642,7 +654,7 @@ const handleResult = (event: SpeechRecognitionEvent) => {
642
654
  recognition.registerEventListener("result", handleResult);
643
655
 
644
656
  recognition.registerEventListener("error", (event) => {
645
- console.log("error code:", event.error, "error messsage:", event.message);
657
+ console.log("error code:", event.error, "error message:", event.message);
646
658
  });
647
659
 
648
660
  recognition.registerEventListener("end", (event) => console.log("ended!"));
@@ -694,6 +706,39 @@ You may notice that after saying short syllables, words, letters, or numbers (e.
694
706
  - For both platforms, you also may want to consider using on-device recognition. On Android this seems to work well for single-word prompts.
695
707
  - Alternatively, you may want to consider recording the recognized audio and sending it to an external service for further processing. See [Persisting Audio Recordings](#persisting-audio-recordings) for more information. Note that some services (such as the Google Speech API) may require an audio file with a duration of at least 3 seconds.
696
708
 
709
+ ## Language Detection
710
+
711
+ > [!NOTE]
712
+ > This feature is currently only available on Android 14+ using the `com.google.android.as` service package.
713
+
714
+ You can use the `languagedetection` event to get the detected language and confidence level. This feature has a few requirements:
715
+
716
+ - Android 14+ only.
717
+ - The `com.google.android.as` (on-device recognition) service package must be selected. This seems to be the only service that supports language detection as of writing this.
718
+ - You must enable `EXTRA_ENABLE_LANGUAGE_DETECTION` in the `androidIntentOptions` when starting the recognition.
719
+ - Optional: You can enable `EXTRA_ENABLE_LANGUAGE_SWITCH` to allow the user to switch languages, however **keep in mind that you need the language model to be downloaded for this to work**. Refer to [androidTriggerOfflineModelDownload()](#androidtriggerofflinemodeldownload) to download a model, and [getSupportedLocales()](#getsupportedlocales) to get the list of downloaded on-device locales.
720
+
721
+ Example:
722
+
723
+ ```tsx
724
+ import { useSpeechRecognitionEvent } from "expo-speech-recognition";
725
+
726
+ useSpeechRecognitionEvent("languagedetection", (event) => {
727
+ console.log("Language detected:", event.detectedLanguage); // e.g. "en-us"
728
+ console.log("Confidence:", event.confidence); // A value between 0.0 and 1.0
729
+ console.log("Top locale alternatives:", event.topLocaleAlternatives); // e.g. ["en-au", "en-gb"]
730
+ });
731
+
732
+ // Start recognition
733
+ ExpoSpeechRecognitionModule.start({
734
+ androidIntentOptions: {
735
+ EXTRA_ENABLE_LANGUAGE_DETECTION: true,
736
+ EXTRA_ENABLE_LANGUAGE_SWITCH: true,
737
+ },
738
+ androidRecognitionServicePackage: "com.google.android.as", // or set "requiresOnDeviceRecognition" to true
739
+ });
740
+ ```
741
+
697
742
  ## Platform Compatibility Table
698
743
 
699
744
  As of 7 Aug 2024, the following platforms are supported:
@@ -789,10 +834,9 @@ ExpoSpeechRecognitionModule.abort();
789
834
 
790
835
  ### `requestPermissionsAsync(): Promise<PermissionResponse>`
791
836
 
792
- Presents a dialog to the user to request permissions for using speech recognition and the microphone.
837
+ Presents a dialog to the user to request the necessary permissions.
793
838
 
794
- For iOS, once a user has granted (or denied) location permissions by responding to the original permission request dialog,
795
- the only way that the permissions can be changed is by the user themselves using the device settings app.
839
+ For iOS, this requests two permissions: record permissions (to access the microphone), and speech recognition permissions. Once a user has granted (or denied) permissions by responding to the original permission request dialog, the only way that the permissions can be changed is by the user themselves using the device settings app.
796
840
 
797
841
  ```ts
798
842
  import { ExpoSpeechRecognitionModule } from "expo-speech-recognition";
@@ -834,23 +878,7 @@ ExpoSpeechRecognitionModule.getStateAsync().then((state) => {
834
878
  });
835
879
  ```
836
880
 
837
- ### `addSpeechRecognitionListener()`
838
-
839
- Refer to [Speech Recognition Events](#speech-recognition-events) for the list of supported events.
840
-
841
- ```ts
842
- import { addSpeechRecognitionListener } from "expo-speech-recognition";
843
-
844
- const listener = addSpeechRecognitionListener("result", (event) => {
845
- console.log("transcript:", event.results[0]?.transcript);
846
- console.log("confidence:", event.results[0]?.confidence);
847
- });
848
-
849
- // Remove the listener when you're done
850
- listener.remove();
851
- ```
852
-
853
- ### `getSupportedLocales(): Promise<{ locales: string[]; installedLocales: string[] }>`
881
+ ### `getSupportedLocales()`
854
882
 
855
883
  > [!NOTE]
856
884
  > Not supported on Android 12 and below
@@ -964,7 +992,7 @@ const available = supportsRecording();
964
992
  console.log("Recording available:", available);
965
993
  ```
966
994
 
967
- ### `androidTriggerOfflineModelDownload({ locale: string }): Promise<{ status: "opened_dialog" | "download_success" | "download_canceled", message: string }>`
995
+ ### `androidTriggerOfflineModelDownload()`
968
996
 
969
997
  Users on Android devices will first need to download the offline model for the locale they want to use in order to use on-device speech recognition (i.e. the `requiresOnDeviceRecognition` setting in the `start` options).
970
998
 
@@ -86,6 +86,8 @@ class ExpoSpeechRecognitionModule : Module() {
86
86
  "start",
87
87
  // Called when there's results (as a string array, not API compliant)
88
88
  "results",
89
+ // Called when the language detection (and switching) results are available.
90
+ "languagedetection",
89
91
  // Fired when the input volume changes
90
92
  "volumechange",
91
93
  )
@@ -60,6 +60,9 @@ class ExpoSpeechService(
60
60
  private var delayedFileStreamer: DelayedFileStreamer? = null
61
61
  private var soundState = SoundState.INACTIVE
62
62
 
63
+ private var lastDetectedLanguage: String? = null
64
+ private var lastLanguageConfidence: Float? = null
65
+
63
66
  var recognitionState = RecognitionState.INACTIVE
64
67
 
65
68
  companion object {
@@ -121,6 +124,8 @@ class ExpoSpeechService(
121
124
  audioRecorder = null
122
125
  delayedFileStreamer?.close()
123
126
  delayedFileStreamer = null
127
+ lastDetectedLanguage = null
128
+ lastLanguageConfidence = null
124
129
  recognitionState = RecognitionState.STARTING
125
130
  soundState = SoundState.INACTIVE
126
131
  lastVolumeChangeEventTime = 0L
@@ -433,12 +438,12 @@ class ExpoSpeechService(
433
438
  */
434
439
  private fun resolveSourceUri(sourceUri: String): File =
435
440
  when {
436
- // Local file path without URI scheme
437
- !sourceUri.startsWith("https://") && !sourceUri.startsWith("file://") -> File(sourceUri)
438
-
439
441
  // File URI
440
442
  sourceUri.startsWith("file://") -> File(URI(sourceUri))
441
443
 
444
+ // Local file path without URI scheme
445
+ !sourceUri.startsWith("https://") -> File(sourceUri)
446
+
442
447
  // HTTP URI - throw an error
443
448
  else -> {
444
449
  throw Exception("HTTP URI is not supported. Use expo-file-system to download the file.")
@@ -581,6 +586,15 @@ class ExpoSpeechService(
581
586
  else -> 0.0f
582
587
  }
583
588
 
589
+ private fun languageDetectionConfidenceLevelToFloat(confidenceLevel: Int): Float =
590
+ when (confidenceLevel) {
591
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT -> 1.0f
592
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT -> 0.8f
593
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT -> 0.5f
594
+ SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL_UNKNOWN -> 0f
595
+ else -> 0.0f
596
+ }
597
+
584
598
  override fun onResults(results: Bundle?) {
585
599
  val resultsList = getResults(results)
586
600
 
@@ -614,6 +628,26 @@ class ExpoSpeechService(
614
628
  }
615
629
  }
616
630
 
631
+ override fun onLanguageDetection(results: Bundle) {
632
+ val detectedLanguage = results.getString(SpeechRecognizer.DETECTED_LANGUAGE)
633
+ val confidence = languageDetectionConfidenceLevelToFloat(results.getInt(SpeechRecognizer.LANGUAGE_DETECTION_CONFIDENCE_LEVEL))
634
+
635
+ // Only send event if language or confidence has changed
636
+ if (detectedLanguage != lastDetectedLanguage || confidence != lastLanguageConfidence) {
637
+ lastDetectedLanguage = detectedLanguage
638
+ lastLanguageConfidence = confidence
639
+
640
+ sendEvent(
641
+ "languagedetection",
642
+ mapOf(
643
+ "detectedLanguage" to detectedLanguage,
644
+ "confidence" to confidence,
645
+ "topLocaleAlternatives" to results.getStringArrayList(SpeechRecognizer.TOP_LOCALE_ALTERNATIVES),
646
+ ),
647
+ )
648
+ }
649
+ }
650
+
617
651
  /**
618
652
  * For API 33: Basically same as onResults but doesn't stop
619
653
  */
@@ -1,5 +1,3 @@
1
- import { EventEmitter } from "expo-modules-core";
2
1
  import type { ExpoSpeechRecognitionModuleType } from "./ExpoSpeechRecognitionModule.types";
3
2
  export declare const ExpoSpeechRecognitionModule: ExpoSpeechRecognitionModuleType;
4
- export declare const ExpoSpeechRecognitionModuleEmitter: EventEmitter;
5
3
  //# sourceMappingURL=ExpoSpeechRecognitionModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSpeechRecognitionModule.d.ts","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAO3F,eAAO,MAAM,2BAA2B,EAAE,+BAsBzC,CAAC;AAEF,eAAO,MAAM,kCAAkC,cAE9C,CAAC"}
1
+ {"version":3,"file":"ExpoSpeechRecognitionModule.d.ts","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAI3F,eAAO,MAAM,2BAA2B,iCACuC,CAAC"}
@@ -1,21 +1,9 @@
1
- import { EventEmitter, NativeModulesProxy, requireNativeModule, } from "expo-modules-core";
1
+ import { requireNativeModule } from "expo";
2
2
  // It loads the native module object from the JSI or falls back to
3
3
  // the bridge module (from NativeModulesProxy) if the remote debugger is on.
4
- const ExpoSpeechRecognitionNativeModule = requireNativeModule("ExpoSpeechRecognition");
5
- export const ExpoSpeechRecognitionModule = {
6
- ...ExpoSpeechRecognitionNativeModule,
7
- // Avoid any function bindings when calling the native module
8
- stop: () => ExpoSpeechRecognitionNativeModule.stop(),
9
- abort: () => ExpoSpeechRecognitionNativeModule.abort(),
10
- requestPermissionsAsync: () => ExpoSpeechRecognitionNativeModule.requestPermissionsAsync(),
11
- getPermissionsAsync: () => ExpoSpeechRecognitionNativeModule.getPermissionsAsync(),
12
- getStateAsync: () => ExpoSpeechRecognitionNativeModule.getStateAsync(),
13
- getAssistantService: () => ExpoSpeechRecognitionNativeModule.getAssistantService(),
14
- getDefaultRecognitionService: () => ExpoSpeechRecognitionNativeModule.getDefaultRecognitionService(),
15
- getSpeechRecognitionServices: () => ExpoSpeechRecognitionNativeModule.getSpeechRecognitionServices(),
16
- supportsOnDeviceRecognition: () => ExpoSpeechRecognitionNativeModule.supportsOnDeviceRecognition(),
17
- supportsRecording: () => ExpoSpeechRecognitionNativeModule.supportsRecording(),
18
- isRecognitionAvailable: () => ExpoSpeechRecognitionNativeModule.isRecognitionAvailable(),
19
- };
20
- export const ExpoSpeechRecognitionModuleEmitter = new EventEmitter(ExpoSpeechRecognitionNativeModule ?? NativeModulesProxy.ExpoSpeechRecognition);
4
+ export const ExpoSpeechRecognitionModule = requireNativeModule("ExpoSpeechRecognition");
5
+ const stop = ExpoSpeechRecognitionModule.stop;
6
+ const abort = ExpoSpeechRecognitionModule.abort;
7
+ ExpoSpeechRecognitionModule.abort = () => abort();
8
+ ExpoSpeechRecognitionModule.stop = () => stop();
21
9
  //# sourceMappingURL=ExpoSpeechRecognitionModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSpeechRecognitionModule.js","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAI3B,kEAAkE;AAClE,4EAA4E;AAC5E,MAAM,iCAAiC,GACrC,mBAAmB,CAAkC,uBAAuB,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,2BAA2B,GAAoC;IAC1E,GAAG,iCAAiC;IACpC,6DAA6D;IAC7D,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAiC,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,GAAG,EAAE,CAAC,iCAAiC,CAAC,KAAK,EAAE;IACtD,uBAAuB,EAAE,GAAG,EAAE,CAC5B,iCAAiC,CAAC,uBAAuB,EAAE;IAC7D,mBAAmB,EAAE,GAAG,EAAE,CACxB,iCAAiC,CAAC,mBAAmB,EAAE;IACzD,aAAa,EAAE,GAAG,EAAE,CAAC,iCAAiC,CAAC,aAAa,EAAE;IACtE,mBAAmB,EAAE,GAAG,EAAE,CACxB,iCAAiC,CAAC,mBAAmB,EAAE;IACzD,4BAA4B,EAAE,GAAG,EAAE,CACjC,iCAAiC,CAAC,4BAA4B,EAAE;IAClE,4BAA4B,EAAE,GAAG,EAAE,CACjC,iCAAiC,CAAC,4BAA4B,EAAE;IAClE,2BAA2B,EAAE,GAAG,EAAE,CAChC,iCAAiC,CAAC,2BAA2B,EAAE;IACjE,iBAAiB,EAAE,GAAG,EAAE,CACtB,iCAAiC,CAAC,iBAAiB,EAAE;IACvD,sBAAsB,EAAE,GAAG,EAAE,CAC3B,iCAAiC,CAAC,sBAAsB,EAAE;CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,YAAY,CAChE,iCAAiC,IAAI,kBAAkB,CAAC,qBAAqB,CAC9E,CAAC","sourcesContent":["import {\n EventEmitter,\n NativeModulesProxy,\n requireNativeModule,\n} from \"expo-modules-core\";\n\nimport type { ExpoSpeechRecognitionModuleType } from \"./ExpoSpeechRecognitionModule.types\";\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nconst ExpoSpeechRecognitionNativeModule =\n requireNativeModule<ExpoSpeechRecognitionModuleType>(\"ExpoSpeechRecognition\");\n\nexport const ExpoSpeechRecognitionModule: ExpoSpeechRecognitionModuleType = {\n ...ExpoSpeechRecognitionNativeModule,\n // Avoid any function bindings when calling the native module\n stop: () => ExpoSpeechRecognitionNativeModule.stop(),\n abort: () => ExpoSpeechRecognitionNativeModule.abort(),\n requestPermissionsAsync: () =>\n ExpoSpeechRecognitionNativeModule.requestPermissionsAsync(),\n getPermissionsAsync: () =>\n ExpoSpeechRecognitionNativeModule.getPermissionsAsync(),\n getStateAsync: () => ExpoSpeechRecognitionNativeModule.getStateAsync(),\n getAssistantService: () =>\n ExpoSpeechRecognitionNativeModule.getAssistantService(),\n getDefaultRecognitionService: () =>\n ExpoSpeechRecognitionNativeModule.getDefaultRecognitionService(),\n getSpeechRecognitionServices: () =>\n ExpoSpeechRecognitionNativeModule.getSpeechRecognitionServices(),\n supportsOnDeviceRecognition: () =>\n ExpoSpeechRecognitionNativeModule.supportsOnDeviceRecognition(),\n supportsRecording: () =>\n ExpoSpeechRecognitionNativeModule.supportsRecording(),\n isRecognitionAvailable: () =>\n ExpoSpeechRecognitionNativeModule.isRecognitionAvailable(),\n};\n\nexport const ExpoSpeechRecognitionModuleEmitter = new EventEmitter(\n ExpoSpeechRecognitionNativeModule ?? NativeModulesProxy.ExpoSpeechRecognition,\n);\n"]}
1
+ {"version":3,"file":"ExpoSpeechRecognitionModule.js","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAI3C,kEAAkE;AAClE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,2BAA2B,GACtC,mBAAmB,CAAkC,uBAAuB,CAAC,CAAC;AAEhF,MAAM,IAAI,GAAG,2BAA2B,CAAC,IAAI,CAAC;AAC9C,MAAM,KAAK,GAAG,2BAA2B,CAAC,KAAK,CAAC;AAEhD,2BAA2B,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;AAClD,2BAA2B,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC","sourcesContent":["import { requireNativeModule } from \"expo\";\n\nimport type { ExpoSpeechRecognitionModuleType } from \"./ExpoSpeechRecognitionModule.types\";\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nexport const ExpoSpeechRecognitionModule =\n requireNativeModule<ExpoSpeechRecognitionModuleType>(\"ExpoSpeechRecognition\");\n\nconst stop = ExpoSpeechRecognitionModule.stop;\nconst abort = ExpoSpeechRecognitionModule.abort;\n\nExpoSpeechRecognitionModule.abort = () => abort();\nExpoSpeechRecognitionModule.stop = () => stop();\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { PermissionResponse } from "expo-modules-core";
2
- import type { NativeModule } from "react-native";
2
+ import type { NativeModule } from "expo";
3
3
  import type { AudioEncodingAndroid, AVAudioSessionCategory, AVAudioSessionCategoryOptions, AVAudioSessionMode, RecognizerIntentEnableLanguageSwitch, RecognizerIntentExtraLanguageModel, TaskHintIOS } from "./constants";
4
4
  export type AVAudioSessionCategoryValue = (typeof AVAudioSessionCategory)[keyof typeof AVAudioSessionCategory];
5
5
  export type ExpoSpeechRecognitionResult = {
@@ -70,6 +70,22 @@ export type ExpoSpeechRecognitionErrorEvent = {
70
70
  error: ExpoSpeechRecognitionErrorCode;
71
71
  message: string;
72
72
  };
73
+ export type LanguageDetectionEvent = {
74
+ /** The language that was detected, in BCP-47 format. e.g. "en-US", "de-DE" */
75
+ detectedLanguage: string;
76
+ /** The confidence of the detected language. A value ranging between 0.0 and 1.0.
77
+ *
78
+ * Values range from:
79
+ *
80
+ * - 1.0 (highly confident)
81
+ * - 0.8 (confident)
82
+ * - 0.5 (not confident)
83
+ * - 0.0 (unknown)
84
+ */
85
+ confidence: number;
86
+ /** The alternative locales for the same language, in BCP-47 format. e.g. ["en-US", "en-GB"] */
87
+ topLocaleAlternatives: string[];
88
+ };
73
89
  /**
74
90
  * Events that are dispatched from the native side
75
91
  */
@@ -109,6 +125,7 @@ export type ExpoSpeechRecognitionNativeEventMap = {
109
125
  end: null;
110
126
  soundstart: null;
111
127
  soundend: null;
128
+ languagedetection: LanguageDetectionEvent;
112
129
  volumechange: {
113
130
  /**
114
131
  * A float value between -2 and 10 indicating the volume of the input audio
@@ -152,7 +169,9 @@ export type ExpoSpeechRecognitionOptions = {
152
169
  /**
153
170
  * [Default: false] Include punctuation in the recognition results. This applies to full stops and commas.
154
171
  *
155
- * On Android, this configures [`EXTRA_ENABLE_FORMATTING`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING) in the recognizer intent (API level 33+).
172
+ * On Android, this configures [`EXTRA_ENABLE_FORMATTING`](https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING) in the recognizer intent (Android 13+, API level 33+).
173
+ *
174
+ * Note for Android: This feature is only verified to work on Android 13+ with on-device speech recognition enabled (i.e. enabling `requiresOnDeviceRecognition` or using the `com.google.android.as` service package)
156
175
  *
157
176
  * On iOS, this configures [`SFSpeechRecognitionRequest.addsPunctuation`](https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/3930023-addspunctuation).
158
177
  */
@@ -337,6 +356,15 @@ export type AndroidIntentOptions = {
337
356
  * Depending on the recognizer implementation, this value may have no effect.
338
357
  */
339
358
  EXTRA_ENABLE_LANGUAGE_SWITCH: (typeof RecognizerIntentEnableLanguageSwitch)[keyof typeof RecognizerIntentEnableLanguageSwitch];
359
+ /**
360
+ * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_ENABLE_FORMATTING
361
+ *
362
+ * NOTE: This is also configurable through `addsPunctuation` (which sets `EXTRA_ENABLE_FORMATTING` to "quality")
363
+ *
364
+ * [API level 33] Optional string to enable text formatting (e.g. unspoken punctuation (examples: question mark, comma, period, etc.), capitalization, etc.) and specify the optimization strategy. If set, the partial and final result texts will be formatted. Each result list will contain two hypotheses in the order of 1) formatted text 2) raw text.
365
+ *
366
+ */
367
+ EXTRA_ENABLE_FORMATTING: "latency" | "quality";
340
368
  /**
341
369
  * https://developer.android.com/reference/android/speech/RecognizerIntent#EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION
342
370
  *
@@ -472,7 +500,10 @@ export type AndroidIntentOptions = {
472
500
  */
473
501
  EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: number;
474
502
  };
475
- export interface ExpoSpeechRecognitionModuleType extends NativeModule {
503
+ export type ExpoSpeechRecognitionNativeEvents = {
504
+ [K in keyof ExpoSpeechRecognitionNativeEventMap]: (event: ExpoSpeechRecognitionNativeEventMap[K]) => void;
505
+ };
506
+ export declare class ExpoSpeechRecognitionModuleType extends NativeModule<ExpoSpeechRecognitionNativeEvents> {
476
507
  /**
477
508
  * Starts speech recognition.
478
509
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSpeechRecognitionModule.types.d.ts","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,K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AC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAElD;;;;;;;OAOG;IACH,oCAAoC,IAAI;QACtC,QAAQ,EAAE,2BAA2B,CAAC;QACtC,eAAe,EAAE,kCAAkC,EAAE,CAAC;QACtD,IAAI,EAAE,uBAAuB,CAAC;KAC/B,CAAC;IACF;;;;;;OAMG;IACH,wBAAwB,CACtB,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE;QACR,4FAA4F;QAC5F,0BAA0B,EAAE,OAAO,CAAC;KACrC,GACA,IAAI,CAAC;IACR;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,2BAA2B,CAAC;IACtC,eAAe,EAAE,kCAAkC,EAAE,CAAC;IACtD,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAChC,CAAC;AAEF,KAAK,sBAAsB,GACvB,UAAU,GACV,UAAU,GACV,aAAa,GACb,UAAU,CAAC;AAEf;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAC5C,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"ExpoSpeechRecognitionModule.types.d.ts","sourceRoot":"","sources":["../src/ExpoSpeechRecognitionModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,kBAAkB,EAClB,oCAAoC,EACpC,kCAAkC,EAClC,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,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