How to output wav file to microphone input using NAudio in C# - c#

I found NAudio Library during making simple audio editor program.
I want to output wav(*.wav) file to microphone input stream.

This is not something natively supported by Windows Audio APIs, and so NAudio isn't able to help you with this. You need an audio 'loopback' device driver like this, or physically connect an output of your soundcard to an input with an audio cable.

Related

C# Video Streaming

I'm developing a C# video streaming application using NReco library. At this moment I was able to encode audio and video separately and save data in to queue. I can stream video using UDP protocol without audio and it played nicely in ffplay equally I can stream audio using UDP protocol without video and it also played nicely.Now I want to merge these two streams in to one and stream through UDP protocol and player should play both audio and video. But I have no idea how to do it. I would appreciate if some one can give me any points to do this or any other different method achieve this.
Thank You.
The answer highly depends on the source of video and audio streams. NReco.VideoConverter is a wrapper to FFMpeg tool and it actually can combine video and audio streams (see filters configuration in FFMpeg documentation) if either video or audio input can be specified as ffmpeg input source (UDP stream or direct show input device).
If both video and audio data represented by byte stream in your C# code you cannot pass them together using NReco.VideoConverter (ConvertLiveMedia method) because it uses stdin for communicating with ffmpeg and only one stream can be passed from C# code.

How to rip WAV audio stream from MP4 stream in C#

Is there any way to rip the audio out of an MP4 stream (or file) in the form of WAV without the use of 3rd party software (only using Windows API) in C# code?
I have looked around and the majority of answers revolve around FFMPEG however I must avoid 3rd party software. I tried dabbling in the DirectShow API but I am not sure that will get the audio stream rip I am looking for (if anyone has successfully done it in DirectShow could you provide steps). I would prefer the output to have the WAV headers and such. Maybe rip to MP3 format and convert to WAV?
Thank you for your help and suggestions

Output procedurally generated (or externally streamed) audio on Windows Phone 7

I'm looking at developing an application for the WP7 platform which accepts an audio stream from a computer and outputs that stream on the phone speaker. This involves either dealing with the audio encoding / decoding myself, or somehow passing off an audio stream to the WP7 platform.
I've struggled so far to find any raw audio output API's and I am not sure what I have to do on the server (computer) side to get the phone to just deal with the audio stream.
I have looked at a few MSDN articles, but I can't quite tell if they do what I want. If somebody could point me in the right direction that would be great!
I think the MediaStreamSource class does what I'm looking for, and the MediaStreamSource.ReportGetSampleCompleted method appears to confirm this, but nowhere does it say clearly that it can be used for raw audio.
If you need any information, or if you have any suggestions of better ways to do this that would also be appreciated!
You should be able to use the XNA.Framework.Audio namespace SoundEffect to get a soundeffect instance from a raw audio stream. Which should usually be a standard PCM format.
This post on microphone by Charles Petzold could be useful.
An excerpt
In contrast, classes in the Microsoft.Xna.Framework.Audio namespace
work with uncompressed audio data in the standard PCM format, which is
the same method used for audio CDs and Windows WAV files.

open audio formats and audio synthesis using NAudio

How can I open different audio formats(except .mp3 and .wav) using Naudio and C#?
How can I create audio synthesis unsing Naudio and C#?(I mean how to get the sound frequency and other data necesary for audio synthesis).
P.S. I've looked at this tutorial series
http://opensebj.blogspot.com/2009/02/introduction-to-using-naudio.html
and this one
http://www.giawa.com/tutorials/?p=19o
In addition to MP3 and WAV, NAudio can also open AIFF and WMA files with the AiffFileReader and WmaFileReader classes. Beyond that, you will have to write your own WaveStream derived class to read other formats.
See my tutorial on how to play a sine wave in NAudio, which will show you the basics of how to get started with audio synthesis in NAudio.

How to convert AMR sound stream to PCM uncompressed stream in .NET

I need to convert an AMR (Adaptive Multi-Rate) audio file recorded in a phone (as a Stream object) to a PCM uncompressed wav audio Stream so it can be processed afterwards for speech recognition. The Speech Recognition doesn't like the AMR format. This is going to be a server application using the Microsoft Speech Platform. I am not sure about using the ffdshow or similar libraries in a .
Right now I am researching NAudio and DirectShowNet to see if they can help me accomplish this but was hoping someone can point in the right direction.
After a lot of searching for a solution for this, I am going to use ffmpeg. It provides the AMR-NB (NB=Narrow Band) decoder. There are a lot of c# wrappers for ffmpeg around; most of them abandoned efforts and one that is up to date but is not free. Just running ffmpeg with the basic parameters provides what I need, plus it is really fast.
I don't like the idea of calling an external process to do the conversion, plus I need to save the AMR stream as a file so it can be converted to a wav file but I believe I can make it work efficiently.

Categories

Resources