I have been looking into the Aurio Touch Sample code by Apple. I wonder how to use this to measure the speed of wind like anemometer. Any suggestions on this? The microphone reacts to sound and blowing air into the microphone does measure the sound alone. How to implement this for measuring the wind speed? Anyone can help me on this?
Asked
Active
Viewed 730 times
-3
-
2And you think you can really measure windspeed from the mic noise?!? It's not possible IMHO – Lefteris Jan 15 '13 at 09:07
-
http://www.goingapps.com/Pages/default.aspx I think it u should do some research before coming some conclusion that its not possible. Thanks for the down vote – DesperateLearner Jan 15 '13 at 10:24
-
1I'm still not believing it's possible, especially at very low wind speeds and very high wind speeds. External noise will also ruin your measurement and that App you just showed me does not prove anything. There are apps out there claiming to do amazing things, only they can't. This would be only tested and confirmed with some real tests under multiple wind situations. – Lefteris Jan 15 '13 at 10:29
-
1A rough estimate of wind speed might be possible, but this is more of a physics problem than a programming problem. Roughly, wind will have a very broad noise spectrum, and you'll want to use the shape of this amplitude to figure out what sounds are from the wind, and use the amplitude and spectrum for calculating the wind speed. But this will take a lot of work to do this close to right, and little of that work is appropriate for SO questions. – tom10 Jan 16 '13 at 02:15
1 Answers
2
You can use AVAudioRecorder to do this .
// 1 .Init AVAudioRecorder like this:
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
NSError *error;
recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];
if (recorder) {
[recorder prepareToRecord];
// recorder.delegate = self;
recorder.meteringEnabled = YES;
[recorder record];
}
// 2. Init a timer to get average power
levelTimer = [NSTimer scheduledTimerWithTimeInterval: 0.03 target: self selector: @selector(levelTimerCallback) userInfo: nil repeats: YES];
-(void)levelTimerCallback
{
[recorder updateMeters];
float peak = [recorder averagePowerForChannel:0];
float value = [meterTable valueAt:peak];
//meterTable = [[MeterTable alloc] initWithMinDecibels:-80. TableSize:50 Root: 1.3];
//Value 0.0~1.0 ,
}
You can get MeterTable from Apple example avTouch

Joe Qian
- 493
- 6
- 13
-
But the meter table gives the conversion value from linear scale to dB. How do I arrive at speed from the decibel value calculated? – DesperateLearner Jan 16 '13 at 04:28
-
1I don't know either, but you can try the sample code on device and blows into the Mic and see what happens. – Joe Qian Jan 16 '13 at 05:10