# Is there any way for me to implement audio processing?

**URL:** <https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763>\
**Category:** General040642add70aa006ef56b5af5b5acae3\
**Created:** [May 22, 2023, 9:51pm UTC](https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763 "2023-05-22T21:51:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![liamuk](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/liamuk/32/724_2.png) [@liamuk](https://react-native-webrtc.discourse.group/u/liamuk)\
**Post date:** [May 22, 2023, 9:51pm UTC](https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763/1 "2023-05-22T21:51:02Z")

</div>

I’m interested in doing some preprocessing on audio tracks (background noise reduction, speaking detection) before they get sent to webrtc. It seems like there’s no way to do this with the current react-native-webrtc (unless I’m looking in the wrong place)

I notice, though, that there’s functionality for video processing on Android, and a PR open for doing the same for iOS.

Does anyone have any pointers on how I might do this for audio as well? Happy to implement & contribute this back.

---

<div class="post-metadata">

**Author:** ![sharjeelbokhari](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@sharjeelbokhari](https://react-native-webrtc.discourse.group/u/sharjeelbokhari)\
**Post date:** [April 12, 2024, 10:17am UTC](https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763/2 "2024-04-12T10:17:55Z")

</div>

@liamuk Any luck so far? I am also trying this but couldn’t figure it out. I was thinking of trying to get the audio array and using a ML model on that audio and sending it back using a flask api then trying to send it to the other peer but I can’t really get it done. Any work arounds or luck? I am making a mobile audio calling app.

---

<div class="post-metadata">

**Author:** ![liamuk](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/liamuk/32/724_2.png) [@liamuk](https://react-native-webrtc.discourse.group/u/liamuk)\
**Post date:** [April 15, 2024, 2:15pm UTC](https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763/3 "2024-04-15T14:15:33Z")

</div>

We ended up doing the following. It’s a little involved. Also note that it doesn’t work with react-native-webrtc \> 106 because the APIs change.

Common

- Define a new [`webrtc:AudioDeviceDataObserver`](https://chromium.googlesource.com/external/webrtc/+/master/modules/audio_device/include/audio_device_data_observer.h). `AudioDeviceDataObserver::OnCaptureData` will get called with new input samples as they come in.

For iOS:

- swizzle `RTCPeerConnectionFactory::audioDeviceModule` to use your custom `audioDeviceDataObserver` using `CreateAudioDeviceWithDataObserver`

For Android:

- patch `react-native-webrtc` to not initialize its own WebRTC native module
- in your app entrypoint, initialize the `WebRTC` on your own, passing it options that create your own custom Java `audioDeviceModule` that behind the scenes builds a native `audioDeviceModule` using `CreateAudioDeviceWithDataObserver`

Note that this won’t let you intercept the audio and transform it before sending it forward, it will only let you get access to the audio for reading. Hope this helps!

---

<div class="post-metadata">

**Author:** ![phoenixphighter](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@phoenixphighter](https://react-native-webrtc.discourse.group/u/phoenixphighter)\
**Post date:** [June 5, 2025, 6:29am UTC](https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763/4 "2025-06-05T06:29:25Z")

</div>

Hey man! Working on [this project](https://react-native-webrtc.discourse.group/t/help-on-how-to-pitch-shift-modulate-audio/2169) and wanted to know if you had any input on actually overwriting/editing the audio. Thanks!

---

<div class="post-metadata">

**Author:** ![sharjeel-bokhari](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/sharjeel-bokhari/32/886_2.png) [@sharjeel-bokhari](https://react-native-webrtc.discourse.group/u/sharjeel-bokhari)\
**Post date:** [June 8, 2025, 12:47am UTC](https://react-native-webrtc.discourse.group/t/is-there-any-way-for-me-to-implement-audio-processing/1763/5 "2025-06-08T00:47:04Z")

</div>

Hey. Thanks for the update, at that time, i just used small audio recording chunks during call to help me achieve the desired results but I will make sure to use this with that. All I really needed was an observer!

I appreciate the update.
