Read microphone loudness in React Native
npm install @flyskywhy/react-native-loudness$ 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.
#### iOS
1. In Info.plist, add Privacy - Micronphone Usage Description using XCode.
#### Android
1. In AndroidManifest.xml, add .
``javascript
import Loudness from '@flyskywhy/react-native-loudness';
Loudness.start();
Loudness.getLoudness((loudness) => {
console.log(loudness);
});
Loudness.stop();
`
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.
`javascript``
Loudness.start('test'); // Supply a file name string to save the file