iOS: How read playing a real-time music? - iphone

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

Related

Alarm app for iPhone sdk with Music

I want to create a Alarm clock app. And as i know for this we have to use NSLocalNotification which play music for 30 second, As apple says sound file must be in Main bundle for Notification. How can i play sound file from Music Library ? Most of alarm app on App store are using Music Library ? Any Help Will be really appreciate...
Having built such an app, the answer is that you can't play from the lib for the notification sound, only if they acknowledge the notification and launch your app.
The alternative way to do a short term or overnight alarm app is to declare your app to be a background aware audio app in UIBackgroundModes, and start playing silence in the app using Audio Queues or the RemoteIO Audio Unit. Then just mix your alarm sound into the silence as PCM samples at the appropriate time. You may have to first convert music from the music library into uncompressed samples using AVFoundation.
This technique will burn the user's battery a lot faster than using Notifications though, and may be disabled if the user uses the music player (etc.) or other audio app, so should not be used for alarms that are critical or a long time away in time.

iPhone recording audio

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.

combining live recording audio in another audio file iphone sdk?

Does someone knows how we can combine our current recording into another background playing music? I need some sample code for this. I want to create something like karaoke application in which we can record our voice over an instrumental music.

Playing Audio on the iPhone

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

Is it possible to both play a sound and record from the microphone at the same time on the iPhone?

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).