Capture all audio on a PC and stream it to another? - c#

Imagine this scenario: You have a desktop and a laptop. The desktop has a high end set of speakers, the laptop does not. You currently use Synergy to share your mouse and keyboard, but audio is a problem.
Is there a way in C# to create a client that captures all of the sound on a PC(I'm thinking like a virtual sound card) and streams it to server that hosts the real sound card?

Not a programming solution - but airfoil with airfoil speakers will do what you want and it's not expensive.
http://rogueamoeba.com/airfoil/speakers.php

Streaming sound shouldn't be a problem if you design something like a ring buffer in case you have lags in the network to avoid breaking the sound wave.
For capture though, I don't see any easy solution short of creating a virtual WDM driver that you put on top of the sound card (either input or output) you want to capture.

There is AirFoil, as morechilli mentioned. It works with minimal setup, however the output is very noticeably latent.
The PulseAudio project might hold the key to low-latency. A lot of relevant questions on SuperUser.

I'm not sure if this is the solution you're looking for, but I quite often shoutcast over my home network using winamp and the shoutcast server. If it's just music you want to listen to, this will do the trick. However (and I admit I have not tested this), you can tell the encoder what to listen to - normally you just get it to listen to the output buffer of winamp, but there is a setting that allows it to listen to the output to your soundcard.
http://www.shoutcast.com/download

Yeah, you write a driver that is a virtual sound card and IPC's off the information to a service that streams the data out.

Related

Is there a way to intercept the sound coming out of my speakers so that I can insert a C#.NET software-based audio filter?

I suffer from tinnitus, and there are a number of sound-based therapies that I can use to mitigate the phantom sounds.
I would like to explore the possibility of processing the sound going to my headphones, or even my speakers, from my PC with a software-based filter.
Is there a way using C# to intercept the audio stream, process it (applying a band-pass filter for example), allowing it to continue to external devices?
I would suggest to use virtual audio device to capture the sound and transmit it to the real speakers after processing. I'm not sure if it is possible to create this using c#. But you can use existing drivers like vac. So you set vac as default device. You create a c# program which records from vac, does the processing, and sends it to the speakers.

World of Warcraft image processing

As I´ve looked for a way to create an addon, which checks the WoW-PvP-Queue-Status, for creating a REST service, I was told that it`s not possible to have a real-time connection between an addon and a REST service. So I was thinking about another way to solve my problem and came to the point, where I thought about analyzing the WoW-Window and searching for a visual pattern to accomplish for what I´m looking for.
My program should check and tell me, whenever a user of the program is queuing for an battleground and should also tell me on which battleground he/she is queuing, so I can gather the data and post it to my service/website. I could create some visual feedback with an WoW-Addon, for the events I´m looking for ... like a signal, which tells my program what to do.
So I´d like to know, how I would accomplish to create such signal-interpreter( so like an Screen Grabber). I was thinking about OpenCV, but dont know where to start, especially I´m kinda curious in how Warden(Anti Cheat Engine) would interpret such program, I really don`t want my users to get banned for such a thing. It should really just interpret visual feedback of the addon I´d create.
So for example:
If user queues for Arathi Basin, a yellow signal should pop and if the yellow signal pops up, the program tells my service that player xyz has queued up, which should be displayed later on ... on my homepage in real-time. If the user queues up for Warsong, another signal pops up, etc.
I´m currently just experienced with C#/.NET in an early stage and would start a little project with such an service, so what I need to learn to get this thing build up?
I really just would love to have a little guide on which knowledge I need, to solve this problem.
for Windows it is doable but grabbing WinAPI is a bit unstable.
So write new App that:
you need to find the WoW Client window (its handle)
grab its canvas as bitmap
If gfx driver allows it if not try to take the desktop image instead. So create canvas with:
Canvas->handle = GetDC(WOW_window_handle);
its size you get like this:
RECT r; GetWindowRect(WOW_window_handle,&r);
so now just copy rectangle from canvas to your bitmap for processing ...
then you can do what ever you need to
as the image is computer generated it will not be too much noisy only scaled +/- some filters so it should be relatively easy to detect if the image contains battleground info or not. Also detect/read text in it should be easy enough
if searched event/info was detected
then just send the data to your WEB
if you need to have this info also inside the ADDON
then you need to search for some way to receive it. I am not familiar with WoW addon programming so have no clue...
but I would try:
if you got any IPC capability from Addon use it
if you have access to files
then continuosly scan a file from addon and send the info there (be careful with multiple file access conflicts)
can try to send keystrokes to your WoW client
if you can detect them from Addon or specific actions like wrote specific text message (not conflicting your movement keys)
if you can hack in your Server/Clienet TCP/IP stream
you could inject packets with specific meaning like incoming private message etc but you would need to be familiar with WoW Server/Client communication (WoW uses SRP6 if I remember correctly) and it would increase the ping lag ... You still need to be able to detect it from Addon on the other hand you should be able to detect packets related to battleground and do not need to OCR/CV the WoW image ...
see these related Q/A's:
list windows handle from outside app
simple OCR
How to recognize UI elements in image
Putting an application in between client and server ... contains example of WoW SRP6 protocol packets in mine post there
MaNGOS source repository ... can learn much about WoW from this
[Notes]
Each of the bullets is suitable for separate question so start coding and when hit a problem ask specific question about it

How to use system audio output to draw spectrum in my C# application

I want to display the spectrum of output audio of my windows C# application. Currently i am using NAudio Library to calculate information through PCM data of input file. But it seems that this process is taking a lot of time and processing in older systems configurations. So i was wondering if i can use the windows audio output data to do so. I meant this.
As you can see windows is generating green bar of current sound output. And it does recognize multiple outputs in MIXER. So is there any way to get this data and use in my application to escape extra calculation? And i haven't posted any code or my work as i am not sure how to do that and if that is even possible so kindly bear with me.
Thank. You.
Take a look at Stereomix which echos the computer's output as an input device. Listening to this input will be the probably easiest way to detect sounds playing. Also take a look at Loopback Recording.

How can I take a HD signal from a device with component-out and display it in a window in a C# application?

I've been tasked with getting the video from the component out ports of a video device into a window in our C# application.
Think taking the component output from a TiVo or DVD player (not HDMI so no HDCP to worry about) and displaying it in a window.
We are only looking for basic real-time streaming. No recording, no snapshots, no video overlays... just showing the source in a window with sound. Nothing else.
I have searched high and low for a few months now and haven't found any devices that will let us do this.
I have found several capture devices such as Elgato's Game Capture HD but (I was told) they aren't a true capture device and therefore don't work with things like DirectShow, so you can't use them with third-party software, only their own.
I have also found cheap Component-to-USB capture devices on Amazon, but they say they don't support HD.
Note: We don't want something like SlingBox which a) has too much lag because of its buffer, and b) you can't integrate it with your own application anyway.
So can anyone give me some pointers on where to go? Been searching for a few months now and getting nowhere fast and now time is starting to be come critical and I literally still have zero leads here.
The only decent HD capture device I have found is from BlackMagicDesign, I use this on my MediaCenter to record HD from My settop box, so maybe one of thier products may help you.
http://www.blackmagicdesign.com/products/intensity/

Capture/Record windows sound

I need to record the sounds on windows. I need to write to stream what I hear from speakers.
What means/API can I rely on?
You may be able to make use of DirectSound; a sample can be found here which is working against a mic. The CaptureDevicesCollection should have a reference to the needed device you want to capture audio from to change from a mic to something else.

Categories