A high-performance real-time audio streaming library for React Native, powered by Nitro Modules.
It captures microphone audio with ultra-low latency and streams raw 16-bit Linear PCM
audio directly to JavaScript as standard ArrayBuffer objects.
Designed for modern real-time audio applications such as:
- 🤖 AI Voice Assistants (OpenAI Realtime, Gemini Live)
- 🗣️ Speech-to-Text
- 🌐 WebRTC & VoIP
- 📈 Audio Visualizers
- 🎛️ Digital Signal Processing (DSP)
- 🎤 Voice Activity Detection (VAD)
Unlike traditional recording libraries that primarily save audio files, this library is built for real-time audio streaming, allowing every audio chunk to be processed immediately in JavaScript.
Works with Expo Development Builds, EAS Build, and React Native CLI projects.
- ⚡ Powered by Nitro Modules for extremely low-overhead native-to-JS communication
- 🎙️ Real-time microphone audio streaming
- 📦 Streams raw 16-bit PCM audio as standard
ArrayBuffer - 🔄 Automatic native audio resampling
- 🎚️ Configurable sample rate, channels, and chunk duration
- 📱 Native support for Android and iOS
- 🚀 Compatible with Expo Development Builds and React Native CLI
- 🧩 Ideal for AI, WebRTC, DSP, speech processing, and custom audio pipelines
Microphone
│
▼
Native Audio Recorder
│
▼
Chunk Accumulator
│
▼
PCM16 AudioChunk
│
▼
ArrayBuffer
│
▼
JavaScript Callback
The library streams raw PCM audio as ArrayBuffer instead of Base64 strings or temporary audio files.
This provides:
- Lower memory overhead
- Lower latency
- No encoding/decoding overhead
- Standard JavaScript binary format
- Easy interoperability with AI SDKs, WebRTC, DSP libraries, and custom processing pipelines
Install the library together with its required peer dependency:
npm install @mindinventory/react-native-nitro-realtime-audio react-native-nitro-modulesor
yarn add @mindinventory/react-native-nitro-realtime-audio react-native-nitro-modulesor for Expo:
npx expo install @mindinventory/react-native-nitro-realtime-audio react-native-nitro-modulesNote
react-native-nitro-modulesis a required peer dependency.
Install iOS dependencies:
```bash
cd ios
pod install
Note
react-native-nitro-modulesis required as a peer dependency.
This library is fully compatible with:
- ✅ Expo Development Build
- ✅ Expo Prebuild
- ✅ Expo Bare Workflow
- ✅ React Native CLI
- ✅ EAS Build
Important
Since this library contains native code, it cannot run inside Expo Go.
Use an Expo Development Build or EAS Build instead.
Add the microphone usage description to your Info.plist
<key>NSMicrophoneUsageDescription</key>
<string>This app requires access to the microphone to record audio.</string>Add microphone permission to:
android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.RECORD_AUDIO" />Returns the current platform.
'iOS';
'Android';Returns the device's native hardware sample rate.
Example:
48000
44100
Returns one of:
'granted';
'denied';
'undetermined';Requests microphone permission from the user.
Starts recording microphone audio.
startRecording({
sampleRate: 24000,
channels: 1,
chunkDurationMs: 100,
});| Property | Description |
|---|---|
| sampleRate | Target output sample rate. Native audio is automatically resampled if required. |
| channels | 1 = Mono, 2 = Stereo |
| chunkDurationMs | Duration of each emitted audio chunk in milliseconds |
Stops recording and stops streaming audio chunks.
Returns true if the native recorder is actively capturing audio.
Returns the number of audio chunks captured during the current recording session.
Useful for debugging and validating streaming behaviour.
Registers a callback that receives every PCM audio chunk.
onAudioChunk((buffer: ArrayBuffer) => {
// buffer contains signed 16-bit PCM samples
});The callback is invoked whenever a chunk is completed by the native recorder.
| Use Case | Sample Rate | Channels | Chunk Duration |
|---|---|---|---|
| Voice AI | 24000 | Mono | 100 ms |
| Whisper | 16000 | Mono | 100 ms |
| WebRTC | 48000 | Mono | 20 ms |
| General Recording | Native | Stereo | 100 ms |
import React, { useEffect, useRef, useState } from 'react';
import { View, Text, Button } from 'react-native';
import {
getMicrophonePermissionStatus,
requestMicrophonePermission,
startRecording,
stopRecording,
onAudioChunk,
isRecording,
} from '@mindinventory/react-native-nitro-realtime-audio';
export default function AudioRecorder() {
const [recording, setRecording] = useState(false);
const [chunksReceived, setChunksReceived] = useState(0);
const recordedPcmChunks = useRef<Uint8Array[]>([]);
useEffect(() => {
onAudioChunk((buffer) => {
recordedPcmChunks.current.push(new Uint8Array(buffer));
setChunksReceived((count) => count + 1);
const samples = new Int16Array(buffer);
// Send to AI
// websocket.send(buffer);
// Visualize waveform
// Apply DSP
console.log(samples.length);
});
}, []);
const start = async () => {
let permission = getMicrophonePermissionStatus();
if (permission !== 'granted') {
permission = await requestMicrophonePermission();
if (permission !== 'granted') {
return;
}
}
recordedPcmChunks.current = [];
setChunksReceived(0);
startRecording({
sampleRate: 24000,
channels: 1,
chunkDurationMs: 100,
});
setRecording(isRecording());
};
const stop = () => {
stopRecording();
setRecording(isRecording());
console.log(`Captured ${recordedPcmChunks.current.length} chunks`);
};
return (
<View>
<Text>{recording ? 'Recording...' : 'Stopped'}</Text>
<Text>Chunks Received: {chunksReceived}</Text>
<Button title="Start" onPress={start} disabled={recording} />
<Button title="Stop" onPress={stop} disabled={!recording} />
</View>
);
}The example application included in this repository demonstrates:
- 🎙️ Real-time microphone recording
- 📈 Live waveform visualization
- 📊 Live chunk statistics
- 📦 Raw PCM streaming
- 💾 WAV generation
▶️ Audio playback- 📋 Recording summaries
It serves as both a demo application and a reference implementation for integrating the library.
- Audio chunks contain signed 16-bit Linear PCM samples.
- Samples are stored in little-endian format.
- Audio is streamed as standard JavaScript
ArrayBuffer. - Recording does not automatically save audio files.
- Generate WAV files or encode MP3/AAC yourself using the streamed PCM data.
- Chunk size depends on the configured sample rate, channel count, and chunk duration.
The example application stores every PCM chunk in memory so it can generate a WAV file after recording.
For production applications such as AI assistants, speech recognition, or WebRTC, process each chunk immediately instead of storing them all in memory.
Example:
onAudioChunk((buffer) => {
websocket.send(buffer);
});Streaming chunks immediately keeps memory usage low even during long recording sessions.
- ✅ Real-time PCM recording
- ✅ Configurable recording
- ✅ Native audio resampling
- ✅ Real-time PCM streaming
- ⏳ PCM playback
- ⏳ Audio session configuration
- ⏳ Voice Activity Detection (VAD)
- ⏳ Echo cancellation
- ⏳ Noise suppression
- ⏳ Automatic Gain Control (AGC)
Contributions, bug reports, and feature requests are welcome.
Please read the Contributing Guide before opening a pull request.
MIT
If you use our open-source libraries in your project, please make sure to credit us and Give a star to www.mindinventory.com
Please feel free to use this component and Let us know if you are interested to building Apps or Designing Products.
Built with ❤️ using React Native Builder Bob (create-react-native-library).