---
title: "Using Another Audio Library | Micdrop"
description: "Replace the recording and playback of the Micdrop React Native client with another native audio library."
url: "https://micdrop.dev/docs/react-native/custom-audio"
---

*   [Getting Started](/docs/getting-started)
*   [Client (Browser)](/docs/client)
    
    *   [Installation](/docs/client/installation)
    *   [React Hooks](/docs/client/react-hooks)
    *   [Start/Stop Call](/docs/client/start-stop-call)
    *   [Pause/Resume Call](/docs/client/pause-resume-call)
    *   [Mute/Unmute Call](/docs/client/mute-unmute-call)
    *   [Call State](/docs/client/call-state)
    *   [Display Conversation Messages](/docs/client/display-conversation-messages)
    *   [Handling Tool Calls](/docs/client/handling-tool-calls)
    *   [Device Management](/docs/client/devices-management)
    *   [Voice Activity Detection (VAD)](/docs/client/vad)
    *   [Error Handling](/docs/client/error-handling)
    *   Utility Classes
        
        *   [Mic](/docs/client/utility-classes/mic)
        *   [MicdropClient](/docs/client/utility-classes/micdrop-client)
        *   [MicRecorder](/docs/client/utility-classes/mic-recorder)
        *   [Speaker](/docs/client/utility-classes/speaker)
        
    
*   [Client (React Native)](/docs/react-native)
    
    *   [Installation](/docs/react-native/installation)
    *   [Hooks and Call State](/docs/react-native/hooks)
    *   [Audio Output and Devices](/docs/react-native/audio-output)
    *   [Voice Activity Detection (VAD)](/docs/react-native/vad)
    *   [Using Another Audio Library](/docs/react-native/custom-audio)
    
*   [Server (Node.js)](/docs/server)
    
    *   [Installation](/docs/server/installation)
    *   [With Fastify](/docs/server/with-fastify)
    *   [With NestJS](/docs/server/with-nestjs)
    *   [Auth and Parameters](/docs/server/auth-and-parameters)
    *   [First Message](/docs/server/first-message)
    *   [Save Messages](/docs/server/save-messages)
    *   [Resume a Conversation](/docs/server/resume-conversation)
    *   [Recording Audio](/docs/server/recording-audio)
    *   [Error Handling](/docs/server/error-handling)
    *   [Tools](/docs/server/tools)
    *   [Extract Value from Answer](/docs/server/extract)
    *   [Auto End Call](/docs/server/auto-end-call)
    *   [Semantic Turn Detection](/docs/server/semantic-turn-detection)
    *   [Noise Filtering](/docs/server/noise-filtering)
    *   [Micdrop Protocol](/docs/server/protocol)
    
*   [AI Integrations](/docs/ai-integration)
    
    *   Provided Integrations
        
        *   [AI SDK](/docs/ai-integration/provided-integrations/ai-sdk)
        *   [Cartesia](/docs/ai-integration/provided-integrations/cartesia)
        *   [ElevenLabs](/docs/ai-integration/provided-integrations/elevenlabs)
        *   [Gladia](/docs/ai-integration/provided-integrations/gladia)
        *   [Gradium](/docs/ai-integration/provided-integrations/gradium)
        *   [Kokoro](/docs/ai-integration/provided-integrations/kokoro)
        *   [Mistral](/docs/ai-integration/provided-integrations/mistral)
        *   [OpenAI](/docs/ai-integration/provided-integrations/openai)
        *   [Piper](/docs/ai-integration/provided-integrations/piper)
        *   [Pocket TTS](/docs/ai-integration/provided-integrations/pocket-tts)
        *   [Whisper](/docs/ai-integration/provided-integrations/whisper)
        
    *   Custom Integrations
        
        *   [Agent (LLM)](/docs/ai-integration/custom-integrations/custom-agent)
        *   [Speech-to-Text (STT)](/docs/ai-integration/custom-integrations/custom-stt)
        *   [Text-to-Speech (TTS)](/docs/ai-integration/custom-integrations/custom-tts)
        
    *   Fallback Strategies
        
        *   [FallbackAgent](/docs/ai-integration/fallback-strategies/agent-fallback)
        *   [FallbackSTT](/docs/ai-integration/fallback-strategies/stt-fallback)
        *   [FallbackTTS](/docs/ai-integration/fallback-strategies/tts-fallback)
        
    *   [Local Models](/docs/ai-integration/local-models)
        
        *   [Choosing the Models](/docs/ai-integration/local-models/choosing-models)
        *   [Latency and Memory](/docs/ai-integration/local-models/performance)
        *   [Explorations](/docs/ai-integration/local-models/explorations)
        
    *   [IA Vocale Souveraine 🇫🇷🇪🇺](/docs/ai-integration/sovereign-voice-ai)
    
*   [Migration](/docs/migration)
    
    *   [Upgrade to v3](/docs/migration/v3)
    

[Micdrop](/) › [Documentation](/docs/getting-started)

# Using Another Audio Library

Recording and playback sit behind two interfaces, and `react-native-audio-api` is only the implementation that comes wired by default. Another library can take its place without touching anything above it: voice activity detection, chunking, the protocol and the hooks stay the same.

## Recording

A microphone driver starts capturing and emits mono float samples as they come. Everything else, from the level used by the VAD to the resampling to 16 kHz, is built on top.

```
import { Mic, MicDriver, MicdropDevice } from '@micdrop/react-native'
class MyMic extends MicDriver {  get isStarted() {    return this.recording  }
  get deviceId() {    return undefined  }
  async start(deviceId?: string) {    await startNativeRecording((samples: Float32Array, sampleRate: number) => {      this.emit('Frames', samples, sampleRate)    })  }
  async stop() {    await stopNativeRecording()  }
  async getDevices(): Promise<MicdropDevice[]> {    return []  }}
Mic.setDriver(new MyMic())
```

Samples may arrive at any rate, the recorder resamples them.

## Playback

A speaker driver receives the 16 kHz PCM16 the server sends, and says when it is playing so the call knows the assistant has the floor.

```
import { Speaker, SpeakerDriver } from '@micdrop/react-native'
class MySpeaker extends SpeakerDriver {  get isPlaying() {    return this.playing  }
  async start() {}
  play(pcm: Int16Array, sampleRate: number) {    enqueueNativeAudio(pcm, sampleRate)  }
  stopAudio() {    clearNativeQueue()  }
  async stop() {}
  async setOutput(output: 'speaker' | 'earpiece') {}
  async getDevices() {    return []  }}
Speaker.setDriver(new MySpeaker())
```

Chunks arrive faster or slower than they are heard, so a driver has to queue them rather than play each one on arrival. `Pcm16AudioStream` does that scheduling and is exported: give it an `AudioSink`, which is the small slice of Web Audio it needs, and it handles the buffering, the gapless playback and the level meter.

Call `setDriver` before the first `Micdrop.start()`.

[Previous← Voice Activity Detection (VAD)](/docs/react-native/vad)[NextServer (Node.js) →](/docs/server)

On this page

*   [Recording](#recording)
*   [Playback](#playback)
