Iphone IOS, Accessing audio data from another audio session - ios

I'm in the process of building an app that uses the IPod Library Access API, so that I can play songs from iTunes in the app. However I also need to access the audio data of whatever song is playing, like how a music visualizer would.
So far, looking through the Audio Session documentation and the Core Audio documentation, I haven't found any officially supported means of achieving this. As I understand it, it would require accessing audio data from another audio session, as in the iPod access api, technically iTunes is playing in the background as I understand it and thus has a different audio session.
So basically how can you access audio data from another audio session? Specifically getting the audio data of songs played through the iPod Access API?

See the AudioTapProcessor iOS Sample sample app in Apple's iOS Developer Library (sign on required), for the use of the AVFoundation MTAudioProcessingTap API.

Related

Is there a way to intercept audio output from within your app to display back an audio visualizer on iOS?

We're currently using Linphone library to make VOIP calls and they have their own solution for audio playback. However, we would like to display a visualizer for the audio that Linphone is outputting from within our own app. Is there a way that we can intercept this data (maybe through sample buffering) in order to draw up audio waves/volume meter in the user interface?
AVAudioPlayer or AVPlayer is out of the question since we do not have access to those objects. Is there a solution in place for AVAudioSession or in CoreAudio?
Only if the audio output app is exporting the audio data using Inter-App-audio or Audiobus. Otherwise the iOS security sandbox will hide that audio output from your app.

Get Audio Power Levels from Currently Playing Music on an iOS Device

I'm aiming to create an audio-visualisation app for iOS. I need to somehow tap into the current audio output from another app (such as Apple's music app, or Spotify) and get the amplitude of the signal for each sample of the music. I will then perform an FFT algorithm on the data to convert it to the frequency-domain and display the data visually.
Is it possible to read this data from the audio output of other apps? If so, what do I need to use to extract this data?
No. The iOS security sandbox will prevent the reading of any audio samples from other apps via any public API (unless the playing app was coded to explicitly export audio data via inter-app audio or other similar interface).

ios Can I use MPMoviePlayerController to play .mp3 url

My app needs to play some music files, like .mp3. I would like to use MPMoviePlayerController because it has implemented all the UI stuff for me, i.e. I do not want to bother implementing progress slide bar and things like this.
I tested to use it to play a .mp3 file and it worked fine but I do not know if it is fine to use it to do this because its name says "movie player" and it seems it is supposed to play a movie. Would apple reject this? Thank you.
For playing audio from a file or memory, AVAudioPlayer is your best option but unfortunately it doesn't support a network stream while MPMoviePlayerController can
From documentation :
An instance of the AVAudioPlayer class, called an audio player,
provides playback of audio data from a file or memory.
Apple recommends that you use this class for audio playback unless you
are playing audio captured from a network stream or require very low
I/O latency.
For the Apple validation I don't think that your application can be rejected because you're using the Media Player Framework to play an audio file. In fact here they explicitly say that you can do just that:
Choose the right technology for your needs:
To play the audio items in a user’s iPod library, or to play local or
streamed movies, use the Media Player framework. Classes in this
framework automatically support sending audio and video to AirPlay
devices such as Apple TV.
Not sure about performance and memory issues though!
Best of luck.

Intercept/modify audio stream on iOS

I am looking at the feasibility of getting the current raw audio stream playing and do stuff with it such as stream it over Bluetooth or equalize it, etc. Is there any way to do this in iOS 8?
For example: apps such as Pandora/Spotify are playing music and I want to access the audio they are playing.
To process audio from another app, that app needs to participate in Inter-App Audio.
I don't know if your example apps do that.

How to mute mic while Recording using UIImagePickerController?

I am using UIImagePickerController for recording video in one of my application. i have successfully Recorded video. But now i want to mute mic (video without audio) while recording video.
i have searched Alot but not a single clue about it.
please help me about this issue.
is it possible or not. if possible than how.
thanks in advance.
If you want your app to be in app store , then there is no apple approved method to actually mute whole iPhone.There are certain libraries but they are not approved.
Apple's documentation on Audio Session
According to the documentation you can only ask the user to have the phone silenced physically and you can respond to certain audio changes such as other sounds,phone calls, email sounds but you cannot mute programmatically.
Also See this Documentation on Programming in iPhone See the part 3.3 for Audio.(Events that can be accessed and performed in iOS).
You can use AVFoundation framework to record a video without the sound, check at this :
AVFoundation Programming Guide

Resources