Recording in background and playing sounds based on the recording.

Hey all...

I have read up on a lot of forms but have not found a way yet to implement this.

So i would like to have an app where i can record the sounds in the night. If a sound reaches a certain level of noise some music will play.

We have already created this for Android but have not found a way to implement this for IOS.

Android version: https://play.google.com/store/apps/details?id=com.sicgames.muziekindenacht&hl=nl&gl=US

Does anyone have any suggestion on how to handle this?

Replies

Hey there! Have you checked out AVAudioRecorder? Using this class, you are able to access and manage recording-level metering data as long as you set the isMeteringEnabled property on your recorder — this boolean is set to false by default.

By using averagePower(forChannel): and peakPower(forChannel:) you can assess the volume as a dBFS measurement for the channel you pass in as an argument. Remember this is usually a negative number: values range from -160 dBFS (minimum) to 0 dBFS (maximum) using this API.

Here are some links to the documentation which can help you get started: