Solved

Get line in volume in C#

Posted on 2011-03-01
3
411 Views
Last Modified: 2012-05-11
Hey.
I want to access the line in volume in C# .net 4.0.

I dont need exact decibels but I want to be able to gage what the volume is relative to a previous point in time.

Preferably I want to be able to poll the sound volume every 100 ms and build an average of the relative sound loudness.

My end goal is to be able to set a threshold when the sound in the room is to loud and i can get a warning.

I know its possible, MSN Messenger does this in it's setup.
 msn messenger sound setup
0
Comment
Question by:Lime_Sweden
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
ID: 35012452
There's nothing "built-in" to C# to do that sort of task.  You either need to do extensive P/Invoke interop work with native Windows APIs, or look for a ready-made wrapper for .Net.  I also know Windows XP and Windows Vista/7 have very different ways of handling audio.

Have a look at NAudio - it's a .Net wrapper around the Win32 APIs - it's the only such library I know off the top of my head, but I've never used it.  I'm sure there are others as well.

http://naudio.codeplex.com/
0
 

Assisted Solution

by:Lime_Sweden
Lime_Sweden earned 0 total points
ID: 35014984
Thanks to you link i found my way here:
http://voicerecorder.codeplex.com/

working example doing exactly what i want in C#.
0
 

Author Closing Comment

by:Lime_Sweden
ID: 35045731
I have to state a reason for accepting my own comment.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now