You might had a chance to check out the new trend – scream application. The most popular one I believe “Chicken Scream”. The new weird and funny interface for the games. Let’s take a look at how chicken scream works – the main part of functionality is to detect the background noice to set up the threshold, and to get “loudness” value – some how to measure the decibels.
In scope of my tests and investigations I’ve decided to create a flappy bird like game but where you need to scream, kind of flappy bird scream, you may want check out the result – “Scream to Fly” (appstore link, my site link)
All right, the first thing to start you need to request access to the mic, to have such ability we need to add the following to the Info.plist – click “plus” and start typing “Privacy – Microphone Usage Description” and add the value, something like – “Access to microphone is needed to detect noice level only.”. This message will appear when you request the access to it programmatically.
To check whether permissions were granted or to request ones you’ll need the following method:
Continue reading “Swift: how to get decibels”