naudio

Enumerate Recording Devices in NAudio

女生的网名这么多〃 提交于 2019-12-03 07:01:15
How can you get a list of all the recording devices on a computer using NAudio? When you want to record, you have to give it the index of the device you want to use, but there's no way of knowing what device that is. I'd like to be able to select from Mic, Stereo Mix, etc. Mark Heath For WaveIn, you can use the static WaveIn.GetCapabilities method. This will give you a device name, but with the annoying limitation that it is a maximum of 31 characters. I am still looking for the way to get the full name (see my question here ). int waveInDevices = WaveIn.DeviceCount; for (int waveInDevice = 0;

Recording with NAudio using C#

天大地大妈咪最大 提交于 2019-12-03 04:47:17
I am trying to record audio in C# using NAudio. After looking at the NAudio Chat Demo, I used some code from there to record. Here is the code: using System; using NAudio.Wave; public class FOO { static WaveIn s_WaveIn; static void Main(string[] args) { init(); while (true) /* Yeah, this is bad, but just for testing.... */ System.Threading.Thread.Sleep(3000); } public static void init() { s_WaveIn = new WaveIn(); s_WaveIn.WaveFormat = new WaveFormat(44100, 2); s_WaveIn.BufferMilliseconds = 1000; s_WaveIn.DataAvailable += new EventHandler<WaveInEventArgs>(SendCaptureSamples); s_WaveIn

Prepend WAV Header in NAudio

天涯浪子 提交于 2019-12-02 22:13:41
问题 I am resampling MP4 (Audio) file into WAV using MediaFoundationReader and ResamplerDmoStream to WaveFormat(16000, 16, 1). After resampling I send the stream to speech API for transcription, but the API fails because the stream does not contain the WAV header. If I save the stream to WAV file (using WaveFileWriter), read the file again and then send the stream to API then the API works because the stream contains the WAV header. Is there a way to prepend the WAV header to the stream after

Cross Correlation and FFT in C# for Voice Authentication

依然范特西╮ 提交于 2019-12-02 21:21:04
问题 This is similar question to the other questions but not a duplicate one. However, I am still not able to get the correct result. I am basically trying to record two Wav files (1 - Base File 2 -Temp File) and then convert that to byte and pass to Aforge FFT and then the Correlation. There are few confusion. When I record the file I am ussing 44100 Khz with 16 bit. Therefore I believe it will return 44100 bytes per second. FFT accepts bytes in power of 2, So I am passing 16384 bytes at a time

Converting a WAV file to a spectrogram

和自甴很熟 提交于 2019-12-02 19:51:09
Hi im very new to this thing so please bear with me. I am trying to convert a WAV file to a spectrogram but arent sure how to begin with. I read on something that says to read the PCM data(which i think is my WAV file) and store it in an array in the WavReader class before apply the FFT on it and converting it to GUI. Im currently using Naudio to achieve this but could not find anything that shows how to convert the WAV file to a spectrogram. Thanks Edit : I found out about converting PCM to FFT with Naudio and im stuck. using (var reader = new AudioFileReader("test1.wav")) { // test1.wav is

How do I create a seekbar in C#\\NAudio Music Player?

非 Y 不嫁゛ 提交于 2019-12-02 19:43:03
I am new to both NAudio and C# and I managed to create a simple MP3 player where you can choose a file and play it. It also has a play/pause button. I would now like to add a seek bar but have no clue on how to do this. Also is it possible to have seekbar in waveform style? The openButton click Handler private void openButton_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "Audio File|*.mp3;"; if (open.ShowDialog() != DialogResult.OK) return; CloseWaveOut(); // disposes the waveOutDevice and audiofilereader waveOutDevice = new WaveOut();

InvalidParameter calling waveOutOpen MmException

梦想与她 提交于 2019-12-02 18:24:23
问题 This code works on 32bit Windows XP but on 64bit Windows 7 it raises an exception. (on any CPU configuration) var format = NAudio.Wave.WaveFormat.CreateCustomFormat( WaveFormatEncoding.Pcm, 8000, 1, 16000, 1, 16) BufferedWaveProvider myBufferedWaveProvider = new BufferedWaveProvider(format); myWaveOut.Init(myBufferedWaveProvider); Any help? 回答1: You've created an invalid WaveFormat. PCM 8kHz mono 16 bit (which is what you seem to be trying to make) has a block align of 2. There's an easier

WPF Application, Slider is missing Thumb/Thumb.DragCompleted event

我的梦境 提交于 2019-12-02 10:12:56
问题 I'm following along with a tutorial on how to use a slider in a WPF application. I created a slider. The tutorial tries to tell me what to do when a slider is repositioned so it has a object The "Thumb" attribute doesn't show up at all in the intellisense of Visual Studio and note the error when I try to set what sub fires for the Thumb.DragCompleted event: "The attachable property 'DragCompleted' was not found in type Thumb'". In the PROPERTIES window there isn't anything talking about

Cross Correlation and FFT in C# for Voice Authentication

帅比萌擦擦* 提交于 2019-12-02 09:26:37
This is similar question to the other questions but not a duplicate one. However, I am still not able to get the correct result. I am basically trying to record two Wav files (1 - Base File 2 -Temp File) and then convert that to byte and pass to Aforge FFT and then the Correlation. There are few confusion. When I record the file I am ussing 44100 Khz with 16 bit. Therefore I believe it will return 44100 bytes per second. FFT accepts bytes in power of 2, So I am passing 16384 bytes at a time and storing that to the parent array and then I am using the Cross Corelation Alogorithm to view the

Prepend WAV Header in NAudio

为君一笑 提交于 2019-12-02 08:40:25
I am resampling MP4 (Audio) file into WAV using MediaFoundationReader and ResamplerDmoStream to WaveFormat(16000, 16, 1). After resampling I send the stream to speech API for transcription, but the API fails because the stream does not contain the WAV header. If I save the stream to WAV file (using WaveFileWriter), read the file again and then send the stream to API then the API works because the stream contains the WAV header. Is there a way to prepend the WAV header to the stream after ResamplerDmoStream resampling in order to prevent the time-costly I/O? You can use WaveFileWriter to write