Streaming audio from HTTP and Audio Meter

Hi all.


I'm putting together an app (swift) and need help with a requirement (or two).


1. App needs to stream audio from HTTP (not from a file).

2. Need an audio level meter (moves with the sounds from HTTP feed).

3. Need to be able to use a switch to switch between two HTTP audio feeds.


The third one I'm sure is easy. But I haven't been able to figure out how to do the first and second. AVPlayer works with HTTP, but haven't found an audio meter. And AVAudioPlayer has the meter but no way of streaming audio.


Any suggestions that would work in swift?


Thanks very much!

Accepted Reply

You can use AudioFileStream + AudioQueue for stream parsing and playback. Both APIs are fairly easy to use and Audio Queue provides level meter values for whatever UI you like to provide.


https://developer.apple.com/library/mac/samplecode/AudioFileStreamExample/Introduction/Intro.html

https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioQueueProgrammingGuide/Introduction/Introduction.html

https://developer.apple.com/library/mac/documentation/MusicAudio/Reference/AudioStreamReference/


See AudioQueue.h for details regarding Level Metering Properties ( kAudioQueueProperty_EnableLevelMetering, kAudioQueueProperty_CurrentLevelMeter, kAudioQueueProperty_CurrentLevelMeterDB )

Replies

You can use AudioFileStream + AudioQueue for stream parsing and playback. Both APIs are fairly easy to use and Audio Queue provides level meter values for whatever UI you like to provide.


https://developer.apple.com/library/mac/samplecode/AudioFileStreamExample/Introduction/Intro.html

https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioQueueProgrammingGuide/Introduction/Introduction.html

https://developer.apple.com/library/mac/documentation/MusicAudio/Reference/AudioStreamReference/


See AudioQueue.h for details regarding Level Metering Properties ( kAudioQueueProperty_EnableLevelMetering, kAudioQueueProperty_CurrentLevelMeter, kAudioQueueProperty_CurrentLevelMeterDB )

Were you able to implement audio streaming with meter levels being displayed on the UI? I would like to do some the same thing in an exisitng app for iOS.

I can understike "theanalogkid" answer - please read the documetnation about AudioFileStream + AudioQueue ;-)