How do I measure sound pressure using the iPhone internal microphone? - iphone

I want to measure the loudness of ambient sound. Having read a number of posts on stackoverflow I feel more confused than I was originally. Im not a sound engineer just a programmer.
I think I need to calculate dBSPL with the formula 20 * log10 (voltage / Voltage_Ref)
So for this I need to sample the internal microphone voltage (or pressure in Pascals?) level. The class AVAudioRecorder allows me to meter read the peakPowerForChannel but this gives a dbFS reading between 160 and 0. Where 0 is full power. How do I access the voltage/pressure levels, with another API perhaps?
I had read that roughly 0 dbFS = 99 db SPL. But that would mean the maximum db SPL I could read using the peakPowerForChannel reading would be 99 db SPL. I'm looking to read levels higher than this.
Any information on this would be most appreciated - im somewhat stuck at this point.
Thanks
Mike

The only way to do this is to test your particular iOS device model (and perhaps production batch) against a known sound source at a given distance and relationship to the mic in an anechoic chamber. The voltage and pressure relationship is neither specified by Apple nor available from any API.

Related

How to decrease wifi link quality and/or wifi signal level?

I have been following a tutorial that enables you to play around with the TXPOWER parameter of your wifi card / wifi adapter:
http://null-byte.wonderhowto.com/how-to/set-your-wi-fi-cards-tx-power-higher-than-30-dbm-0149606/
You can easily boost up your wifi range when increasing the TXPOWER.
Now, most people want to improve their wifi signal strength of their home router, right. But in my case, I would like my home router (which runs on a raspberry pi) to have a relative small wifi signal radius (say, a radius of 2 meters), so that you actually need to physically look for the pi home router when trying to connect to it.
I have learned that this tutorial does not do a thing with the wifi link quality and/or the wifi signal level and thus does not influence the wifi radius of my pi home router.
link quality & signal level
Do you guys have any ideas/thoughts about how to decrease link quality and/or wifi signal level (e.g Link Quality = 12/70 and Signal level =-10dBm) ? Is this even possible ?
I am using a Tp-Link TL-WN722N IEEE 802.11n USB - Wi-Fi Adapter.
WIRELESS LITE N ADAPTER 150M USB HIGH GAIN 1DETACHABLE ANTENNA WL-AP.
150 Mbps - External
First, I recommend reviewing this section from your link:
QUICK DECIBEL UNDERSTANDING:
Every 10 decibels is a 10X increase in power starting from 1 dBm equal
to 1mW... 10 dBm equals 10 mW, 20 dBm equals 100 mW, 30 dBm equals
1000 mW, and so on. Every 3 decibels is approximately double that of
the prior power, so 30 dBm is 1000 mW, if we add 3 dBm, then we can
double the power such that 33 dBm is about equal to 2000 mW.
It appears to me that you are able to modify the transmit power of your adapter as the tutorial states. Are you saying this is not working? If you set your transmit power to something extremely low (-30dBm, for example) you would effectively be turning off the transmitter. Keep increasing that value until you get your desired coverage radius.
If the transmit power parameter is not functioning as per the tutorial, then there are other means to achieve reduced coverage. The model you specified has a detachable antenna....so detach it. This would definitely reduce your coverage. However, if it reduces coverage too much, you could simply add an inline attenuator. Fortunately, your antenna uses an SMA connector which is very common. You can find many SMA attenuators on ebay with different attenuation values. Experiment with different values until you get the desired coverage.
And if that doesn't work, just wrap a bunch of aluminum foil around the thing lol.

MPU 6050 DMP Output Values Units Issue

I'm running into an odd issue with a motion control processor (MPU 6050 / 9150) that is returning raw gyroscope values as specified between the -/+ 32768 which in the way this gyro is configured corresponds to -/+ 2000 deg / sec. This makes total sense as this goes along with the specified documentation.
However, when i process data from the digital motion processor (6 axis sensor fusion) i get a maximum of 1429. I don't think that there's an error reading the data from the mpu buffer as the other measurements look good (reading from the same FIFO buffer). I assume this is likely some units issue that has to do with the 6 axis sensor fusion, and also likely involving radians
Wondering if any of you bright people with your light bulb brains have some insight here?
Thanks!

Processing accelerometer data

I would like to know if there are some libraries/algorithms/techniques that help to extract the user context (walking/standing) from accelerometer data (extracted from any smartphone)?
For example, I would collect accelerometer data every 5 seconds for a definite period of time and then identify the user context (ex. for the first 5 minutes, the user was walking, then the user was standing for a minute, and then he continued walking for another 3 minutes).
Thank you very much in advance :)
Check new activity recognization apis
http://developer.android.com/google/play-services/location.html
its still a research topic,please look at this paper which discuss the algorithm
http://www.enggjournals.com/ijcse/doc/IJCSE12-04-05-266.pdf
I don't know of any such library.
It is a very time consuming task to write such a library. Basically, you would build a database of "user context" that you wish to recognize.
Then you collect data and compare it to those in the database. As for how to compare, see Store orientation to an array - and compare, the same holds for accelerometer.
Walking/running data is analogous to heart-rate data in a lot of ways. In terms of getting the noise filtered and getting smooth peaks, look into noise filtering and peak detection algorithms. The following is used to obtain heart-rate information for heart patients, it should be a good starting point : http://www.docstoc.com/docs/22491202/Pan-Tompkins-algorithm-algorithm-to-detect-QRS-complex-in-ECG
Think about how you want to filter out the noise and detect peaks; the filters will obviously depend on the raw data you gather, but it's good to have a general idea of what kind of filtering you'd want to do on your data. Think about what needs to be done once you have filtered data. In your case, think about how you would go about designing an algorithm to find out when the data indicates activity (like walking, running,etc.), and when it shows the user being stationary. This is a fairly challenging problem to solve, once you consider the dynamics of the device itself (how it's positioned when the user is walking/running), and the fact that there are very few (if not no) benchmarked algos that do this with raw smartphone data.
Start with determining the appropriate algorithms, and then tackle the complexities (mentioned above) one by one.

iPhone - AudioQueueLevelMeterState - What are the units for the power?

In iPhone's library, AudioQueue.h file has a structure AudioQueueLevelMeterState.
It has two floats -> mAveragePower and mPeakPower
What are the units stored in them.
Is it decibels or not?
Since neither the documentation nor header comments say so I think it is assumed to be the only standard unit. As far as I know, the decibel is the only unit of power for sound.
There are other units for measuring sound but only the decibel measures power (in the scientific sense.)

iPhone Temperature Sensor

My question is very similar to this one: iPhone Proximity Sensor. There's clearly some manner of thermometer within the iPhone that's readable by the OS. Has anyone uncovered the super-secret undocumented APIs to read this sensor?
I doubt this sensor is for ambient temperature - rather I suspect it is for overheating of the circuits. If that is all you want then great, but again, I think it would be useless for ambient temperature.
just my opinion.
All i could find was CTGetTemperature in CoreTelephony of all places.
I don't know about previous models, but my iPhone4 goes from cool-ish to very warm in a matter of minutes depending on the various radio usages. So unless "good enough" = "within 20 degrees F or so", then probably not good for ambient measurement.
Unless (maybe you meant this) you could also track radio usage and subtract a temperature variable depending on radio usages. phew. complicated. Easier to just query NWS.
command to get all super-secret names which related with temperature in CoreTelephony framework
nm "/Applications/Xcode463.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/6.1 (10B141)/Symbols/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony" | grep empera