{"_id":"@boudra/expo-two-way-audio","name":"@boudra/expo-two-way-audio","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.4":{"name":"@boudra/expo-two-way-audio","version":"0.1.4","description":"Native module for two way audio streaming","main":"build/index.js","types":"build/index.d.ts","scripts":{"build":"expo-module build","clean":"expo-module clean","lint":"expo-module lint","test":"expo-module test","format":"biome check .","format:fix":"biome check --write .","typecheck":"tsc","expo-module":"expo-module","open:ios":"xed examples/basic-usage/ios","open:android":"open -a \"Android Studio\" examples/basic-usage/android"},"keywords":["react-native","expo","expo-two-way-audio","ExpoTwoWayAudio"],"repository":{"type":"git","url":"git+https://github.com/boudra/expo-two-way-audio.git"},"bugs":{"url":"https://github.com/speechmatics/expo-two-way-audio/issues"},"author":{"name":"Speechmatics","email":"devrel@speechmatics.com","url":"https://github.com/speechmatics"},"license":"MIT","homepage":"https://github.com/boudra/expo-two-way-audio","devDependencies":{"@biomejs/biome":"1.9.4","@types/react":"^18.0.25","expo-module-scripts":"^3.5.2","expo-modules-core":"^2.0.4"},"peerDependencies":{"expo":"*","react":"*","react-native":"*"},"_id":"@boudra/expo-two-way-audio@0.1.4","gitHead":"579f200f87727074fa8ec7d596cbef0689f85642","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-l83hGo+IykyIvanHeL2whkAiMxDg+84AsxLzBjsyomrGbsXHx4dKZ+QfQiPA3ndibvYyIEtl+TmcRZXN8RZx1Q==","shasum":"39a9bc298700005b0c9d3ed4774ff3a372d06196","tarball":"https://registry.npmjs.org/@boudra/expo-two-way-audio/-/expo-two-way-audio-0.1.4.tgz","fileCount":45,"unpackedSize":76688,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB62sl23ImDO3wd4Rh1KUd6n3fPdVsHQwyhAgbHrf8EZAiAz/v0vfmsYl6RkDQnugVk9zq9PwMf9XdLSCzGp3Zh3yA=="}]},"_npmUser":{"name":"boudra","email":"boudra.moha@gmail.com"},"directories":{},"maintainers":[{"name":"boudra","email":"boudra.moha@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/expo-two-way-audio_0.1.4_1770474441006_0.8434797909923242"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-07T14:27:20.927Z","0.1.4":"2026-02-07T14:27:21.166Z","modified":"2026-02-07T14:27:21.416Z"},"maintainers":[{"name":"boudra","email":"boudra.moha@gmail.com"}],"description":"Native module for two way audio streaming","homepage":"https://github.com/boudra/expo-two-way-audio","keywords":["react-native","expo","expo-two-way-audio","ExpoTwoWayAudio"],"repository":{"type":"git","url":"git+https://github.com/boudra/expo-two-way-audio.git"},"author":{"name":"Speechmatics","email":"devrel@speechmatics.com","url":"https://github.com/speechmatics"},"bugs":{"url":"https://github.com/speechmatics/expo-two-way-audio/issues"},"license":"MIT","readme":"# Speechmatics Two Way Audio\n\nExpo module for capturing and playing pcm audio data in react-native apps (iOS and Android).\n\nThe aim of the module is to facilitate creating real-time conversational apps. The following features are provided:\n\n- Request audio recording permissions\n- Get clean (applying Acoustic Echo Cancelling) microphone samples in PCM format (1 channel 16 bit at 16kHz)\n- Play audio samples in PCM format (1 channel 16 bit at 16kHz). Playback happens through main speaker unless external audio sources are connected.\n- Provide volume level both for the input and output samples. Float between 0 and 1.\n- [iOS only] Get microphone mode and prompt user to select a microphone mode.\n\nCheck out our [examples/](./examples) to see the module in action.\n\n## Installation\n\n```\nnpm i @speechmatics/expo-two-way-audio\n```\n\n## Usage\n\nPlease check out our [examples/](./examples) to get full sample code.\n\n1. Request permissions for recording audio\n\n   ```JSX\n   import {useMicrophonePermissions} from \"@speechmatics/expo-two-way-audio\";\n\n   const [micPermission, requestMicPermission] = useMicrophonePermissions();\n   console.log(micPermission);\n   ```\n\n1. Initialize the module before calling any audio functionality.\n\n   ```JSX\n   useEffect(() => {\n       const initializeAudio = async () => {\n           await initialize();\n       };\n       initializeAudio();\n   }, []);\n\n   ```\n\n1. Play audio\n\n   > [!NOTE]\n   > The sample below uses the `buffer` module:\n   > `npm install buffer`\n\n   ```JSX\n    import { Buffer } from \"buffer\";\n\n    // As an example, let's play pcm data hardcoded in a variable.\n    // The examples/basic-usage does this. Check it out for real base64 data.\n    const audioChunk = \"SOME PCM DATA BASE64 ENCODED HERE\"\n    const buffer = Buffer.from(audioChunk, \"base64\");\n    const pcmData = new Uint8Array(buffer);\n    playPCMData(pcmData);\n   ```\n\n1. Get microphone samples\n\n   ```JSX\n   // Set up a function to deal with microphone sample events.\n   // In this case just print the data in the console.\n   useExpoTwoWayAudioEventListener(\n       \"onMicrophoneData\",\n       useCallback<MicrophoneDataCallback>((event) => {\n           console.log(`MIC DATA: ${event.data}`);\n       }, []),\n   );\n\n   // Unmute the microphone to get microphone data events\n   toggleRecording(true);\n   ```\n\n## Notes\n\nSome audio features of expo-two-way-audio like Acoustic Echo Cancelling, noise reduction or microphone modes (iOS) don't work on simulator. Run the example on a real device to test these features.\n\n```bash\n# iOS\nnpx expo run:ios --device --configuration Release\n\n# Android\nnpx expo run:android --device --variant release\n```\n\nFor Android, the following permissions are needed: `RECORD_AUDIO`, `MODIFY_AUDIO_SETTINGS`. In Expo apps they can bee added in your `app.json` file:\n\n```javascript\nexpo.android.permissions: [\"RECORD_AUDIO\", \"MODIFY_AUDIO_SETTINGS\"]\n```\n","readmeFilename":"README.md","_rev":"1-d55f35904acaa3292b490e1deb1bc1f6"}