Can anyone tell me how to detect a sound on iphone....
Please help....please provide any source code or link if possible
You can use AVAudioRecorder
http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/
That tutorial works for any sound really... it goes through the steps of creating a high-pass filter to try and only detect blowing. You can change the values to make it more sensitive to sound or less sensitive.
Related
Can somebody tell me how to scrub the AQPlayer ( used in Apple's SpeakHere example ) using a UISlider like the iPod does?
I know how to handle the slider part, but once I have my value from the slider, what do I need to set/change/update in AQPlayer, or the AudioQueue, so that the player moves to that part of the Queue and continues playing from that point?
Is there any easy way to do this with a percentage of the playing time or do I have to make some calculations with the packets??
Thanks for any input.
Al
For anyone who also needs to seek/scrubb in an audio file, I found a solution to my question at the following link: Audio Queues
Have a look at the function
-(void)seek:(UInt64)packetOffset;
It worked perfectly after some initial fine tuning.
I'd like to change the pitch of an audio file by changing the sample rate programmatically. I am recording the file using AVAudioRecorder. I have noticed a settings parameter within AVAudioPlayer, however, it is read only. Can anyone lend a helping hand? :)
You could manipulate the data the recording process returns, this is generally the way to go for DSP.
A simple change in sound's speed can be done with a resampling.
Take a look here
i'm using AVAudioRecorder and AudioQueueServices to record audio from the iphone's mic but I want to auto record the sound once it is detected so theres no need to press on a record button
I've looked at a tutorial about the AVFoundation:
www.iphoneam.com/blog/index.php?title=using-the-iphone-to-record-audio-a-guide&more=1&c=1&tb=1&pb=1
and also a tutorial that explains how the iphone mic can detect sound levels, i've tried adding the two tutorials together but i cant get the code to work at all
Can't figure out what to do and i'm not sure if i'm taking the wrong approach
Any advice?
Thanks
Check out this tutorial: http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/
I got something similar working using the above tutorial. I have one AVAudioRecorder monitoring the mic's volume and another that records the mic's input when a certain threshold is reached.
Hey you Objective-C bods.
Does anyone know how I would go about changing (transforming) an image based on the input from the Microphone on the iPhone?
i.e. When a user speaks into the Mic, the image will pulse or skew.
[edit] Anyone have any ideas, I have (what is basically) a voice recording app. I just wanted something to change as the voice input is provided. I've seen it in a sample project, but that wasn't with an UIImage. [/edit]
Thanking you!!
Apple put together some great frameworks for this! The AVFoundation framework and CoreAudio framework will be the most useful to you.
To get audio level information AVAudioRecorder is useful. Although it is made to be used for recording, it also provides levels data for the microphone. This would be useful for deforming your image base on how loud the user is shouting at his phone ;)
Here is the apple documentation for AVAudioRecorder: AVAudioRecorder Class Reference
A bit more detail:
// You will need an AVAudioRecorder object
AVAudioRecorder *myRecorderObject;
// To be able to get levels data from the microphone you need
// to enable metering for your recorder object
[myRecorderObject prepareToRecord];
myRecorderObject.meteringEnabled=YES;
// Now you can poll the microphone to get some levels data
float peakPower = [myRecorderObject peakPowerForChannel:0];
float averagePower = [myRecorderObject averagePowerForChannel:0];
If you want to see a great example of how an AVAudioRecorder object can be used to get levels data, check out this tutorial.
As far as deforming your image, that would be up to an image library. There are a lot to choose from and some great ones from apple. I am not familiar with anything though so that might be up for someone else to answer.
Best of luck!
You may try using gl-data-visualization-view extensible framework in order to visualize your sound levels.
I am implementing a sound effect that plays while a user is dragging a UISlider.
Here is the IBAction: called by the UISlider's Value Changed event
-(IBAction)playTone4; {
AudioServicesPlaySystemSound(soundID4);
}
I would like the sound to halt when the user is not dragging the slider but has not released it.
Is there a way to do that? There doesn't seem to be an AudioServicesStopSystemSound() function.
System sounds cannot be stopped.
See the iPhone Programming Guide: section Multimeda Support for more information.
To accomplish the desired effect, I would recommend using AVAudioPlayer or audioQueues. The Programming Guide I addressed covers everything you want to know about these techniques.