UISlider for scrubbing the AQPlayer like iPod - iphone

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.

Related

Play just a part of the sound (both in and out) with OpenAL (iOS)?

I have a recording that has some unuseful voices at the beginning, and at the end.
How can I play just the middle part of the sound?
I have AL_SEC_OFFSET, that is suitable for the entry point, I already use it, but what about the endpoint?
Is there any smart OpenAL settings for this? Hopeso.
Thanks.
There could be a workaround that fires a timer that stops playing before end.
Any simplier?
OpenAL doesn't have built-in support for stopping playback at a specific sample point. A timer is your best bet in this case, even though it will be somewhat inaccurate.
If you want sample-perfect stopping, you could just load the middle part of the audio file into an ALBuffer rather than the entire thing. I have some code which does that here:
https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/Support/OALAudioFile.m#L188

Play mp3 file smoothly upon dragging a scroll using AVToolbox or openAL

I have been facing this since so many days but I have not reach to any conclusion.
My problem is : I want to play an mp3 file but not simply by clicking on a play button.
It is this way I want to play it.
*There is a slider that I can drag using finger, I want that the mp3 should play with the frequency with which I am dragging the finger (or speed with which I am dragging my finger, so that it will give an effect of fast forwarding (funny type of voice)) or if I drag slider slowyly the output will be slow *
The problem is the output of the sound is not coming out smooth. its very distorted and disturbed voice.
I want the outuput to be smoother.
Please help. Any suggestions please. Presently I am using AVAudioPlayer and passing the time value based upon slider input to play the file. (It does not seems to be feasible though).
I feel that it is possible using openAL only and no other way. Because using openAL we can modify the frequency of the sound file (pitch)
CAN SOME ONE PLEASE REFER ME A LINK TO openAL implementation for iPhone . I have never played a sound file using openAL
Help!!
You won't be able to do it with AVAudioPlayer, as it does not support pitch operations.
You can load and decode the entire track into memory for playback with OpenAL (which supports pitch), or you can do realtime loading/decoding and pitch changing using Audio Units (MUCH lower level, and more complicated, though).

Detecting sound in iphone

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.

iPhone AVAudioRecorder, AudioQueueServices, how to auto record audio when sound is detected

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.

Halting a playing sound sample on iPhone using AudioServices

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.