I am making a program and I want to find and mute programs that are playing audio so all you hear is mine.
(This is an option for the program, nothing malicious about it)
I have looked it up and I cannot seem to find a way to check what programs are playing audio (Much like windows does)
I don't have any code examples of attempting this because id has no idea.
In case someone misses reads or I don't word the above sentences correct I would like to find EVERY process with audio playing and either KILL or MUTE the process
If you can get Peak meters for individual programs on Windows 7, you can identify sessions and applications. IAudioSessionControl interface offers you muting options similar to what user can do via standard Volume Mixer application (session muting in particular).
There was a pretty similar question, maybe the same approach I posted in my answer would fit your scenario: https://stackoverflow.com/a/14828598/674700. What you'd need to change are the types of files (into .mp3, .wav and so on) and kill the processes found, with the exception of your application's.
The drawbacks: you'll need to run your application as administrator and it also requires a third party console app.
Related
I am working on a UWP app which needs to keep listening to the sound and recognize a hammering sound.
For every blow of hammer strike I need to save the system time.
I have looked at few algorithms like
Clap sound detection in C#
but none-of-them are close to what I am looking for.
Here is the flow:
on my UWP I click on a button "Listen Audio"
That will start hearing to the sound
When there is sudden spike in sound wave, which is like a big hammer strike, my code should trigger an event
That event will capture information related to the hammer striking (mostly timestamp)
Any suggestions for coming up with a good algorithm is appreciated.
Based on your requirement this answer gives you what you need.
Link to product Info Page http://www.zonetrigger.com/sound-detection/
Demo link: http://www.zonetrigger.com/sound-detection/azt-demo.html
Audio Zone Trigger — $24.95
Audio Zone Trigger is very easy to use: you put triggers on the sound wave, and when the waves go beyond the thresholds, they perform the actions that you have selected. The software was designed with the following purposes in mind: Security, Computer Remote Control and Monitoring. However, because the software can perform any action that you want, you are free to use it in any creative way you can think!
If you don't want to user 3rd party tools and develop your own solution, then you can try this approach numerical integration
My understanding of how this stuff works is very limited, as I usually just make library calls which make the audio / video magically show up.
I want to be able to do MITM "attacks" to programs on my own computer. (I'd be the guy intercepting signals between the software and the hardware). This kind of thing could be useful in a number or scenarios.
For instance, for audio:
XP doesn't have a way to change the audio for specific programs while keeping the others unchange. It only has one audio
manager across all its programs. If I could intercept the signal (and
detect which program it was coming from) I could in theory make my own audio manager.
I could record conversations, possibly testing out any audio -> text software I may have/create.
many more.
For video:
(Primary goal here): record conversations. I have used a third party program, but I'm guessing what it is doing is taking snapshots because 1) the video is choppy and 2) when the mouse or other thing gets in the way of the video, it records that too. Wouldn't it be easier just to record the signal going to the video card from the specific program of my interest, then play it back when I want to see it again?
For network traffic:
For recording traffic to and from my computer, possibly discovering
programs that are communicating that shouldn't be.
For keyboard/mouse:
This could be useful for easily creating macros to fill out forms or
whatever, and I could custom encrypt the data to make sure it's
secure rather than relying on some third party software.
I'm sure there are many other applications for which this could be useful.
Thanks.
I was wondering if anyone knows how (or even if it is possible) to monitor and trigger an action when a computer running windows (7-8) starts reciving a file transfer from over the network onto one of its drives.
Bonus points if I can find out how big the file is that the other guy is placing on my machine and how much is done etc...
I want to know if there is any API in windows, or snippit of code, or some other API that provides any of this functionality.
I still want to be able to recive files, I just want to manage them better. I am on a network with over 90 computers and this software that I wish to write would be running on most of them.
Of course you can (after all it's what an Antivirus program does) but it's NOT easy and probably you'll see it's more comfortable to do in C than in C#. I'm sure there's a .NET porting of WinPCap anyway you can always P/Invoke.
Start reading about Network Monitor SDK on MSDN. It's not an easy task, you have to capture a specific set of frames, you may use a Network Packet Monitor to inspect the content and the type of the packets you have to capture and parse.
I'm not sure but you may take a look to QoS API (start reading this article), it should provide something you can use.
I have a MAYA 44 USB sound card and would like to interface it with C#. I want to record from the provided microphones and produce a data array.
I have found examples when using the internal sound card from my laptop but when it comes to external it does not quite work.
Has anyone every connected the above sound card with C# please?
Have you had a look at the DirectSound API (Windows only though, I think). Might provide what you're after.
On how to record audio with C# in general there are already multiple threads on SO, so I won't talk about that.
I see two possible causes for your program which have different solutions:
You need to change which audio sources are muted in the windows volume control ("sndvol32.exe /R")
When opening the audio device there are multiple devices. And you're simply opening device 0 instead of enumerating them and perhaps choosing another one. The external sound-card might appear as a second device.
I would like to know if it is possible to mute only a specific window. For example I have got Firefox open and two more windows. I want to mute everything related to Firefox but not the whole sound of my computer.
Is this possible? If so, how can it be done?
look, basically, there isn't any relation between the window handle and the sound which something in its code is playing.. the audio card can't tell who wants it to play.
theoretically, there is an option to do what you want on web browsers, but it's not easy, and not 100%. it goes like this:
most of the audio that is playing from browsers are from known objects like wmp/quick time/vlc/flash/etc..
when the user will choose to mute all audio from firefox, your application will search those known objects in the firefox tabs, and mute/unmute them using their api.
in order to do that, you will need to write an extension to firefox, so you could have an access to the tabs memory from your application.
btw, what os?
and check this out: http://www.indev.no/?p=projects#flashmute (flashmute) i believe it does what is said - only for flash.
On Vista/Windows 7:
I expect there to be some API which can change the volume on a per process basis which the audiomanager uses. Should be relatively straight forward to use.
On XP
I don't think there is any built in functionality for what you want to do. I recommend just not offering that feature on XP. But if you really want to, there are some hackish solutions:
Usermode API hooking. Intercept the calls to audioapis with your own functions. These change the volume or manipulate the audiosignal so you get what you want. You need to do this differently for any of the several available audio-apis. I guess DirectSound and DirectShow are particularly annoying. And this requires injection of a dll into any process you want to manipulate. And this dll better not require the .net runtime. Search for IAT(import address table) or EAT(export address table) hooking.
Kernel mode audio hooking. Write a driver which intercepts the audio in the kernel and changes it on a per process basis. No clue how to do that.
But as you can see both solutions aren't good.