C#.NET Determine blow sound using microphone - c#

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

Related

How to intercept and record or modify signals between hardware and software

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.

Check what programs are playing audio?

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.

Detecting beats in a song

I'm working on a project which requires me to add beat detection when a song is playing in the application (WinForms - C#).
I'm currently using NAudio.NET for playing the song & displaying details about the song.
Is there a library that would allow me to do this or some way to detecting this manually? I'm not expecting a finished solution but pointers in the right direction. Ideally I would like this to be a real-time detection but it is not essential.
This question has already been asked; check out this StackOverflow thread. Some of the answers include explicit beat detection algorithms and links.
GameDev.net - Algorithm Summary
Comb Filters
More algorithms are on that StackOverflow thread
You can use this BPM Detection Library
Besides BPM calculation it also allows you to get every beat, so you could for example adjust your visualisation, if that is the case.
I've used FMOD to do exactly what you're doing. They don't have annoying popups. You can check out this link to a GitHub project that uses it in c#. Fmod licensing is a little odd, based on what the program's budget is. If your budget is under 500k, you can use it for free, but are supposed to display their logo somewhere, either in a splash screen or credits screen.

How to detect change on the screen?

I have a question that How to detect the change on the screen? Its position is not necessary but is possible to get its position it will be helpful. I searched it on the internet but not found any suitable answer. Now, I am making a program in C# and I have to detect a change on the screen. I tried to capture four screen shots per second and compare them. This method works but it badly effect on the performance of the PC.
I think it is easy to do in C or Assembly language (x86) because in assembly we can get access to video memory directly.
Is it possible to do in C#?
Code sample will be appreciated.
Project: Detect any change on full Screen camera monitoring software.
Are you really looking just for simple difference of what you see on your monitor? I doubt that would do the job.
For motion detection from cam input you can take a look at Motion Detection Algorithms article on CodeProject.
Aside from taking screen captures and comparing them at some time intervals (which would cause performance issues),
The only solution i can think of is hooking up to system events, the "redraw" kind of events.
You will need to choose which events to hook your program with.
This codeproject tutorial might help-
http://www.codeproject.com/KB/system/WilsonSystemGlobalHooks.aspx

C# WinForms application to display waveforms of playback and recorded sound

I wish to write a C# WinForms application that can play a WAV file. While playing the file, it shows a waveform (similar to an oscilloscope).
At the same time, a user can record sound via the microphone, attempting to follow the original sound played (like a karaoke). The program displays the waveform of the recorded sound real-time, so comparisons can be seen from the waveform display of the original
wave file and the recorded one by the user. The comparisons will be done as in the difference in time (the delay) of the original and recorded sound. The waveform displays don't have to be very advanced (there is no need for cut, copy or paste); just being able to see it with a timeline would suffice.
I hope this is clear enough. Please do not hesitate to ask for more clarification if it's not clear. Thank you very much.
You can do what you want with C#, but it isn't going to work like you think. There is effectively no relationship at all between how a recording looks in an oscilloscope-type display and how that recording sounds to a human ear. So, for example, if I showed you two WAV files displayed in an oscilloscope display and told you that one recording was of a tuba playing and the other was of a person speaking a sentence, you would have no idea which was which just from looking at them.
If you want to compare a user's sounds to a pre-recorded WAV, you have to get more sophisticated and do FFT analysis of both and compare the frequency spectra, but even that won't really work for what you're trying to do.
Update: after some thought, I don't think I fully agree with my above statements. What you want to do might sort of work if what you want to do is to use the oscilloscope-type effect to compare the pitch (or frequency) of the WAV and the person's voice. If you tuned the oscilloscope to show a relatively small number of wavelengths at a time (like 20, maybe), the user would be able to quickly see the effect of raising or lowering the pitch of their voice.
I have a small sample C# app that I wrote about 2 years ago that does something kind of like this, only it displays an FFT-produced spectrograph instead of an oscilloscope (the difference is basically that a spectrograph shows frequency-domain information while an oscilloscope shows time-domain information). It's realtime, so you can talk/sing/whatever into a microphone and watch the spectrograph change dynamically.
I can dig this out and post the code here if you like. Or if you want the fun of doing it all yourself, I can post some links to the code resources you'd need.
The NAudio library has plenty of functionality that will (possibly) give you what you need. I've used it in the past for some simple operations, but it is much more powerful than I've had need to use.
#ZombieSheep
Naudio is indeed useful, but it has limitations. For example, there is not much control over the waveform display, it cannot be cleared and redrawn again. Besides, if it gets too long its impossible to scroll back to see the waveform in the front part. One more thing is that it only works with playing the sound but does not work with recording the sound.
Thank you.

Categories

Resources