Mic to Speaker audio streaming in C# - c#

I need to make a Windows applications which takes audio input (from microphone) and plays immediately to the speaker. If I explain in short, nI eed to make an application which can test my microphone.
I have been exploring Naudio and wmp libraries over the last 3 days but I couldn't get enough help to create it. But I know using these libraries there must be a way to create such an application.
Thanks in anticipation.

You can use two ways
csaudio //hard way, but realy nice
How-record-voice-from-microphone //easy way
EDIT
At list try this
Voice Recorder (here using naudio its opensource)

Related

media transcoding, codec in c#

I would be developing a media player app in hopefully wpf but i am having trouble with a few aspects.
I know that i can do some basic stuff with audio n video using MediaElement class in c# but i was wondering that
1. i also need to stream online videos and save them in different qualities(resolution) and formats and also might extrfact audio from them
2. I would be needing to convert and play existing files on my system.
3. Video/screen capture
4. Substitles etc.
5. Equalizer
I heard about ffmpeg
But i am confused that if i could use it with c#.
So help me if there is something better to help with max. Of the issues i have here. And what are the things i need to read about. Is there any tutorial that would help me out.

Prevent .NET Speech Recognition from hearing/recognizing computer speakers

I know this is a long shot, and very difficult, maybe even impossible to do. But I'm going to ask it anyway.
Is there any way to keep .NET's SpeechRecognitionEngine (SAPI) from hearing or recognizing the audio coming from computer speakers, without using an external microphone.
An example would be
Playing a YouTube video, or song, and not of the Recognizer
listen to the audio form that video or song Or at least not recognize it as speech
Thanks
In theory if you have an internal audio source like the YouTube video and want to exclude that from things processed by an internal microphone, you can invert the audio signal from that source and use it to cancel out the same sound picked up via the microphone. That is how noise cancelling headphones work. I have no idea whether that is possible with SAPI – Eric J.
While implementing this would take to long for me, this seems like the most do-able and reasonable answer.

Need to record all sounds from sound card with NAudio in Windows 7

Need to record all sounds from sound card. So that mic+output was written to file.
Is it possible to do with NAudio library in Windows 7? Cant find any examples, found just ones that allow to write mic or just sound from speakers, not both.
PS, sorry, if the question looks not ok..Im new to audiorecording.
Added issue ive asked on codeplex: http://naudio.codeplex.com/workitem/16353
To record sounds being played by the soundcard, you would use WASAPI in Loopback Mode.
To record sounds going into the microphone you could use WASAPI capture, or any of the other microphone capture classes in NAudio.
Then you have the slightly tricky job of mixing those two inputs together. This may require sample rate conversion beforehand, and it may require you to timestamp the recorded audio (as the loopback audio can contain gaps when nothing is being played).
With NAudio, you would convert both streams to floating point, before mixing them using one of the "Mixer" wave or sample providers in NAudio, and then writing that back out to a file.
So yes it is possible, and I have done it once before myself, but it does require you to write a fair bit of your own code on top of the core NAudio libraries.

Send sound to different audio devices

Is it possible to play a sound on a playback device that is not set as default playback device?
I need to play multiple files simultaniously trough multiple output devices.
Does anyone knows a solution for .net? (C#)
Thanks!
you will have to go to lower level API. You can try find C# wrapper for Wasapi, ASIO, DirectSound or MediaFoundation. Maybe XNA framework could do the job, which is managed framework over directX
well I was playing around with similar issue.
XNA could not do send output to specific device.
I have ended out with http://naudio.codeplex.com/, which is exactly what you need. It's C# wrapper for Wasapi, ASIO, DirectSound libraries. It also includes many very helpful classes for converting, decoding, visualizing etc. For simple player, check out NAudioDemo sample project.
find out CreateWaveOut() method. This is where you should select your playbackdevice.
for example:
MMDevice device = new MMDeviceEnumerator()
.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.All)
.FirstOrDefault(d => d.ID == "yourplaybackdeviceid");
IWavePlayer waveOut = new WasapiOut(device, AudioClientShareMode.Shared, false, latency);
Download the naudio library from sourcecode tab not from Download->Release, it's not very actual and it's little buggy.
another good tool is bass.net
http://www.un4seen.com/

Getting sound directly from hardware with C#

Is there a way to get the sound that the sound card is playing directly from the hardware?
NAudio is a nice API for sound programming in C#. I'm only discovered it myself, but it might be able to record the output, though probably not...
http://www.codeplex.com/naudio
some sound cars can select the output sound as mic, if that is acceptable then you could just google how to use the microphone...
The most general way is Total Recorder which has a COM interface.
I presume that this is Windows since you are using C#. Ignore this if you are using mono.
There is no officially supported way to do this in Windows. Some sound cards have a setting in the mixer that will set the wave record input to 'what you hear'. So on those cards, you could just set that setting and then record audio.
edit:
I should add that if your driver doesn't have built in support for recording what it's outputing, then you will need to write or purchase a driver that does. I've heard that TotalRecorder can do this.

Categories

Resources