I want to play prerecorded audio for users in an iPhone application. Is the best way to play this audio to use openAL? Is there any other way that might be beneficial for what I want to accomplish?
Thanks!
Joe
For most needs, I've found AVAudioPlayer to be an excellent choice for audio playback.
OpenAL covers most audio cases nicely and it is tied to the Core Audio so playback speed is never lagged. Based on what details you gave, OpenAL will take of your needs
Related
I would like to create an audio visualizer, and I had a question:
How can I get the part of the music that plays at a time on the device?
P.S. Example "aurioTouch" similar to what is necessary, but it processes sound from a microphone, and I needed from the device.
If you want to do things with real time audio, then you should have a look at Core Audio
I figured out AVAudioPlayer can play MP3 or AAC. But it also has a big latency. It seems to be loading the entire file into memory first.
Are there other, more efficient options than AVAudioPlayer?
Yes, there are AVPlayer and MPMoviePlayerController (which, despite its name, can also play audio files). MPMoviePlayerController tends to be a bit easier to use in my opinion.
You can use OpenAL library for that which is very very efficient for the purpose you are talking about
Here is the link
https://github.com/kstenerud/ObjectAL-for-iPhone
Have a look .Its too easy to integrate and implement.
Cheers!!!
The lowest-level and lowest-latency option that you can get on iOS is RemoteIO.
This question has some more relevant information: Playback MP3 using RemoteIO and AudioUnits on iPhone... possible?
I am developing one application. In that I want to record the sounds and I want to play that recorded sound file. I know the frameworks for doing this. But how to develop programmatically by using that frameworks?
You can refer to this link:
I have implemented this code in one of my apps and it works completely fine.
How do I record audio on iPhone with AVAudioRecorder?
For Playing the sound you have option to use AVAudioRecorder.
Hope this helps.
The best way to do it - and I am talking from painful experience here - is with the RemoteIO audio unit. You can also do it with AudioQueue, but it has a higher latency, and the queue type approach becomes very problematic.
So, I think that they are really different tools for different jobs. Note that you won't play a sound file as such. You will play the contents of a buffer held in memory. As long as the buffer is not too large, this should not be an issue.
So, going with RemoteIO, you will find this blog and tutorial very useful. It includes code samples.
Using RemoteIO audio unit By MICHAEL TYSON
I'm currently working on a project where it is necessary to record sound being played by the iPhone. By this, I mean recording sound being played in the background like a sound clip or whatever, NOT using the built-in microphone.
Can this be done? I am currently experimenting with the AVAudioRecorder but this only captures sound with the built-in microphone.
Any help would be appreciated!
This is possible only when using only the Audio Unit RemoteIO API or only the Audio Queue API with uncompressed raw audio, and with no background audio mixed in. Then you have full access to the audio samples, and can queue them up to be saved in a file.
It is not possible to record sound output of the device itself using any of the other public audio APIs.
Just to elaborate on hotpaw2's answer, if you are responsible for generating the sound then you can retrieve it. But if you are not, you cannot. You only have any control over sounds in your process. yes, you can choose to stifle sounds coming from different processes. but you can't actually get the data for these sounds or process them in any way.
I want to both play sound and record sound at the same time on the iPhone.
All the apps which record sound first disable any music playing. However as music would disrupt their purpose I don't know if they're doing this deliberately or whether the iPhone does it automatically when you record from the microphone.
Does anyone have experience with this?
Refer to this page. Good luck!
I've heard something about this on one episode of the mobile orchard podcast - the one with Michael Tyson, the creator of Loopy. During the discussion, Michael explained that he had to include some code to filter out the sounds that were coming in through the microphone in realtime as other sounds were being played on the speaker.
Based on that discussion, it seems entirely possible to both play and record at the same time, but I'm sure you'll have to do your own filtering to avoid recording the sounds your playing.
You can use either a core audio unit or an audio queue, and
you need to make sure that your audio session category is set to kAudioSessionCategory_PlayAndRecord.
Beware that sound output when you use this session is much quieter
than the normal solo session (observed on 3.0).