VOIP application - MediaElement output on ear-piece - windows-phone-7

I am developing a SIP based VOIP Application and stuck on following issue,
1 -- I am Able to play with the SIP Protocol and Server and able to get Audio data in PCM 8000 Sampling rate format,
2 -- for Playing Audio i am using MediaElement framework, and using this framework its giving output in SmartPhone multimedia Speaker, Is there anyway to get default output on the Ear-Piece, and let user to choose, whether they want to attend the call trough Speaker or through Speaker,
it seems WP8 has got this support, but i didn't find it for WP7

This is not possible.
Unless, you'll contact Microsoft and negotiate yourself a privilege to compile native ARM code. Some companies (e.g. Tango, Spotify, Garmin) did.

Related

Access system audio in UWP App

I would like to write an app that
accesses the audio by being played by the user in another app
analyzes that audio
displays the analysis to the user
however, I have not found anything that makes this seem possible. Can apps access access the audio being played through the user's speakers as a byte stream or is this not built into the API?
Can apps access access the audio being played through the user's
speakers as a byte stream or is this not built into the API?
You can do that(Loopback recording), but you need to program with low level APIs - WASAPI. For available APIs for UWP, check the Core Audio part in Win32 and COM for Windows Runtime apps and Universal Windows Platform (UWP) apps (multimedia)
Here is an old article for 8.1 app, but it still applies to UWP on concept level. And Microsoft has provided a sample on GitHub about WASAPI and Core Audio API, which may help you to familiar with the APIs and understand how to make it work in UWP app.
Use the MediaCapture class to capture audio. link to docs

Can I programatically save the data stream sent to the sound card as a WAV file?

In Windows XP, you can configure your sound card properties via the preloaded windows software. In the recording properties, if "stereo mix" or "wave out" (or something similar) is selected as the recording device, programs that can record audio ("Sound Recorder" in windows for example) record a decent quality wave file of the audio stream. I usually use Goldwave from download.com to do this as an example of a third-party application that functions the same.
Well, I've had trouble getting this scenario to happen on Windows Vista or later in a direct no-bullsh*t manner as described above. It's more than just Vista+, it's also that some sound cards don't have that option at all.
I was just wondering if there is a way to run a windows-friendly program (VB?) that takes your audio output stream and converts it (in realtime, obviously) to a WAV file with the default sampling rate as other WAV files have.
Ideally, it would cool if it worked on any operating system, so is it possible to write a web service that "listens" to your audio card like that without making the computer think it's getting a virus attack or something?
Possibly related question:
How to save web audio streaming to file ( c++ / java )
I'm only aware of one manufacturer of sound cards that enabled that option (Creative). However Vista and beyond support a "loopback" mode which gives you effectively the same functionality. You need to use the low level WASAPI rendering stack but it should work just fine.
https://github.com/rdp/virtual-audio-output-sniffer provides a directshow input device to capture the sum of wave out for vista+
You could use low level waveOut API injection and capture what it receives.
I have SkypeMXrecorder, a software that does just that - inject into any exe and 'sniffs' what's going out from it and into the sound hardware. But, it seems rather complicated to implement...

Getting the speaker audio signal and then streaming it out

I am trying to build what I think is a basic app. Well, two apps one for windows and one for OS X. I would like to capture the audio signal that is playing (ie if the user is playing music out his/her speakers). Then take that signal and stream it out so another computer can "listen". The other computer would be Windows or OS X.
Any ideas on how to get the audio signal?
What's the most efficient way to stream out audio without a 3rd party plugin? If there is an open-source solution out there, I would be interested.
Thanks!
Chris
On Windows XP this isn't trivial at all because there's no way of intercepting the output signal without writing an audio filter driver (which is not somethign for the faint of heart).
On Windows Vista and above, you can capture the output of the audio engine by using the WASAPI APIs (built into Windows so they're free) and initializing an audio client with the AUDCLNT_STREAMFLAGS_LOOPBACK flag. This will give you a capture stream that's hooked to the output of the audio engine.
You can then package up that audio and send it to the other machine and render it with whatever audio rendering API you want.
I don't know how to do the equivilant on OSX though :(.

How to capture PCM data from Wave Out

How would it be possible to capture the audio programmatically? I am implementing an application that streams in real time the desktop on the network. The video part is finished. I need to implement the audio part. I need a way to get PCM data from the sound card to feed to my encoder (implemented using Windows Media Format).
I think the answer is related to the openMixer(), waveInOpen() functions in Win32 API, but I am not sure exactly what should I do.
How to open the necessary channel and how to read PCM data from it?
Thanks in advance.
The new Windows Vista Core Audio APIs have support for this explicitly (called Loopback Recording), so if you can live with a Vista only application this is the way to go.
See the Loopback Recording article on MSDN for instructions on how to do this.
I don't think there is a direct way to do this using the OS - it's a feature that may (or may not) be present on the sound card. Some sound cards have a loopback interface - Creative calls it "What U Hear". You simply select this as the input rather than the microphone, and record from it using the normal waveInOpen() that you already know about.
If the sound card doesn't have this feature then I think you're out of luck other than by doing something crazy like making your own driver. Or you could convince your users to run a cable from the speaker output to the line input :)

Simple audio input API on a Mac?

I'd like to pull a stream of PCM samples from a Mac's line-in or built-in mic and do a little live analysis (the exact nature doesn't pertain to this question, but it could be an FFT every so often, or some basic statistics on the sample levels, or what have you).
What's a good fit for this? Writing an AudioUnit that just passes the sound through and incidentally hands it off somewhere for analysis? Writing a JACK-aware app and figuring out how to get it to play with the JACK server? Ecasound?
This is a cheesy proof-of-concept hobby project, so simplicity of API is the driving factor (followed by reasonable choice of programming language).
The principal framework for audio development in Mac OS X is Core Audio; it's the basis for all audio I/O. There are layers on top of it like Audio Toolbox, Audio Queue Services, QuickTime, and QTKit that you can use if you want a simplified API for common tasks.
To just pull a stream of samples, you'd probably want to use Audio Queue Services; the AudioQueueNewInput function will set up recording of PCM data and pass it to a callback you supply.
On your Mac there's a set of Core Audio examples in /Developer/Examples/CoreAudio/SimpleSDK that includes a use (AQRecord in AudioQueueTools) of the Audio Queue Services recording APIs.
I think portaudio is what you need.
Reading from the mike from a console app is a 10 line C file (see patests in the portaudio distrib).
Apple provides sample code for reading and writing audio data. Additionally there is a lot of good information in the Audio section of the Apple Developer site.

Resources