You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> The config plugin updates the Android App Manifest to include package visibility filtering for `com.google.android.googlequicksearchbox` (Google's Speech Recognition) along with the required permissions for Android and iOS.
60
62
63
+
To configure `androidSpeechServicePackages`, add additional speech service packages here that aren't listed under the `forceQueryable` section when running the command: `adb shell dumpsys package queries`.
64
+
61
65
```js
62
66
// app.json
63
67
{
64
68
"expo": {
65
69
"plugins": [
70
+
"plugin-one",
71
+
"plugin-two",
72
+
73
+
// no config (v0.2.22+)
74
+
"expo-speech-recognition",
75
+
76
+
// or with config
66
77
[
67
78
"expo-speech-recognition",
68
79
{
69
80
"microphonePermission":"Allow $(PRODUCT_NAME) to use the microphone.",
70
81
"speechRecognitionPermission":"Allow $(PRODUCT_NAME) to use speech recognition.",
71
-
// Add additional speech service packages here that aren't listed
72
-
// under the `forceQueryable` section when running the command:
// Default: 50ms for network-based recognition, 15ms for on-device recognition
292
303
chunkDelayMillis: undefined,
293
304
},
305
+
// Settings for volume change events.
306
+
volumeChangeEventOptions: {
307
+
// [Default: false] Whether to emit the `volumechange` events when the input volume changes.
308
+
enabled: false,
309
+
// [Default: 100ms on iOS] The interval (in milliseconds) to emit `volumechange` events.
310
+
intervalMillis: 300,
311
+
},
294
312
});
295
313
296
314
// Stop capturing audio (and emit a final result if there is one)
@@ -315,6 +333,7 @@ Events are largely based on the [Web Speech API](https://developer.mozilla.org/e
315
333
|`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 |
316
334
|`speechend`| Fired when speech recognized by the speech recognition service has stopped being detected. | Not supported yet on iOS |
317
335
|`start`| Speech recognition has started | Use this event to indicate to the user when to speak. |
336
+
|`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. |
318
337
|`languagedetection`| Called when the language detection (and switching) results are available. | Android 14+ only. Enabled with `EXTRA_ENABLE_LANGUAGE_DETECTION` in the `androidIntent` option when starting. Also can be called multiple times by enabling `EXTRA_ENABLE_LANGUAGE_SWITCH`. |
319
338
320
339
## Handling Errors
@@ -523,6 +542,44 @@ function TranscribeAudioFile() {
523
542
}
524
543
```
525
544
545
+
## Volume metering
546
+
547
+
You can use the `volumeChangeEventOptions.enabled` option to enable volume metering. This will emit a `volumechange` event with the current volume level (between -2 and 10) as a value. You can use this value to animate the volume metering of a user's voice, or to provide feedback to the user about the volume level.
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.
0 commit comments