Read microphone loudness in React Native

Usage no npm install needed!

<script type="module">
  import flyskywhyReactNativeLoudness from 'https://cdn.skypack.dev/@flyskywhy/react-native-loudness';



Read microphone loudness in React Native

Getting started

$ npm install @flyskywhy/react-native-loudness --save

$ react-native link @flyskywhy/react-native-loudness

For RN>0.60, no need to link but please run pod install in the project ios directory.

Required Additional Steps


  1. In Info.plist, add Privacy - Micronphone Usage Description using XCode.


  1. In AndroidManifest.xml, add <uses-permission android:name="android.permission.RECORD_AUDIO" />.


The app needs to ask permission for microphone usage. If the loudness reading is not a number or is always a fixed number, check the app permission first. For Android 6.0 (API level 23) or later, the permission needs to be asked when running the app. Learn more here. For iOS devices, the permission will be automatically asked when needed. It can also be manually asked. Check out react-native-permissions.


Loudness is in dbFS from -160 to 0, where -160 represents near absolute silence and 0 represents the maximum loudness the microphone can sense.

import Loudness from '@flyskywhy/react-native-loudness';


Loudness.getLoudness((loudness) => {


While reading the loudness, this module can save the microphone reading into a WAV audio file at the same time. The file is 16 bit, 44.1kHz, and mono channel both for iOS and Android. The file is located in the document directory of the app. Please use another library such as rn-fetch-blob to move, delete, or copy the file.

Loudness.start('test'); // Supply a file name string to save the file


Check out this example app LoudnessMeter for more details.