Can you obtain audio stream data to the System output device using CoreAudio? - objective-c

Is it possible to obtain a stream of audio data arriving at the system output (speakers, headphones, etc.) using CoreAudio or another framework?
Example: You're listening to a song on iTunes while watching a YouTube video, all while playing a computer game that makes sounds of its own, all of which are being played through your computer's speakers (Probably terribly annoying). My app would need to receive the entire mix as streaming data.
Thanks in advance.

Not at a user application's Core Audio or other app framework level. Some audio output capture/snoop apps may do this with a kernel extension (kext), or perhaps a replacement audio hardware driver.

Related

NAudio - Detect Audio via Application

Windows Volume Mixer shows audio output for individual applications.
Using NAudio, what is the right way for me to tap into this information? I essentially want to be able to make my application say:
Always record all audio input/output. Unless otherwise specified, only keep a buffer of the last 30 seconds. Throw the test away. (I know how to do this)
When Skype, Vonage, or Ring Central plays audio for more than 5 seconds, ask the user if they want to start saving the audio. (How would I do this?)
If so, save the 30-second buffer to a file and then start recording live. (I know how to do this)
Thanks for the help!
Windows won't let you capture audio from individual applications. You can use NAudio's WasapiLoopbackCapture to capture audio from all applications.
If you just want to see audio output levels for all apps, that can be achieved with the IMMDevice APIs which NAudio has wrappers for. It doesn't come with a specific demo showing that, but there's another open source project, EarTrumpet that you could explore to see how its done.

Play a stream with Windows.Media.Playback.MediaPlayer?

In Windows Phone 8.1, I want to play an internet radio station with Windows.Media.Playback.MediaPlayer. I'm aware of a sample which plays mp3 files with MediaPlayer.SetUriSource. However, I don't know how to play a stream. I see MediaPlayer.SetStreamSource, but it appears to be for random access streams which support seek, etc. I'm not sure it's for live streams.
Which method should I use?
Any tutorials or docs on this? I couldn't find any.
You could have a look at the Windows Phone Streaming Media library, which supports live streaming and HLS formats.
http://phonesm.codeplex.com/

Detect new video and audio inputs

I want to create application where I can record video with audio and save it to disk.
When application start I detect all video and audio sources and show this list on the UI.
But when I disconnect one of webcams (or unplug mic), this device still remain in list.
How I can get notifications of device connect/disconnect, both for video devices(USB) and audio devices(jack 3.5).
Thank you.
WBR
Maxim
You might find some useful tips in this other question, here IOKit device adding/removal notifications - only fire once?
I also have an example of an app that uses the IOKit framework to detect adding and removing USB devices on my github account here: https://github.com/tjarratt/Panic-Button
Baring that, the apple developer site has a lot of documentation on using USB devices:
https://developer.apple.com/library/mac/documentation/devicedrivers/conceptual/USBBook/USBDeviceInterfaces/USBDevInterfaces.html

Streaming music on your website through custom player / application (iTunes)

I was doing some research to find out ways that would allow me to stream music on my website legally. I came across iTunes partner program which allows to stream music on a website through their embedded players. I was wondering is it possible to stream iTunes music through your own custom player? If that is not possible via iTunes, then what other methods are available?
You could do this with a server software like Icecast, there is some good tutorials on setting this up here: http://www.icecast.org/docs.php
Depending on how many browsers you want to support you might want to setup two streams, one in MP3/OGG and a "backup" stream in Flash. Then add some detection as to what the browser supports and present the correct stream (i.e.: Use the HTML5 <audio> tag for playing MP3/OGG to browsers that support this, and use your flash stream for the rest)
their program allowing playback of music in the iTunes Store is likely only for those with the intention to sell music, without providing a commerce business, you'd be breaking their partner program T&C's.

How to record Audio and Video at Mac separately?

I'm building application that needs to send recorded audio and video data to net separately.
Currently I'm using QTKit to capture media but it only allows to work with video and audio data combined.
Is there any way or frameworks that allows to work with video and audio apart?
I'm using QTKit to capture media but it only allows to work with video
and audio data combined.
False.
You can add multiple inputs and outputs to your capture session with QTKit. They don't have to combine the A/V. Start here and read the entire document, then post another question if you have trouble.
AVFoundation framework also support for recording audio and video.
refer this sample code
AVRecorder
but this framework only support for OS X v10.7 or later