naudio

NAudio Record buffer full after 5 seconds of recording

两盒软妹~` 提交于 2019-11-28 10:47:01
问题 I'm making a program using Visual C# Studio that records from a microphone. I wish to record for a few minutes, but when I try to record, it shows me an error with 'Buffer Full' after it records for 5 seconds. This is the code I'm using: private void button2_Click(object sender, EventArgs e) //Play Button { fileName = "lastReplay.wav"; FileStream FS_Write = File.OpenWrite("lastReplay.wav"); FS_Write.Close(); int deviceNumber = sourceList.SelectedItems[0].Index; sourceStream = new NAudio.Wave

NAudio to split mp3 file

不想你离开。 提交于 2019-11-28 10:02:47
I am very new to audio or mp3 stuff, was looking for a way to have a feature to split an mp3 file in C#, asp.net. After googling for a good 3-day without much of a great help, I am hoping that somebody here can point me to a right direction. Can I use NAudio to accomplish this? Is there any sample code for that? Thanks in advance. An MP3 File is made up of a sequence of MP3 frames (plus often ID3 tags on the beginning and end). The cleanest way to split an MP3 file then is to copy a certain number of frames into a new file (and optionally bring the ID3 tags along too if that is important).

Enumerate audio input devices with WMI

怎甘沉沦 提交于 2019-11-28 09:51:51
问题 I am using NAudio in my C# project, and I am looking for a way to enumerate audio input devices (microphone etc.), so i can get full name of them (not only the 31-characters long name that i can get from NAudio). I went through a few posts where people were enumerating audio output devices with WMI: ManagementObjectSearcher objSearcher = new ManagementObjectSearcher( "SELECT * FROM Win32_SoundDevice"); ManagementObjectCollection objCollection = objSearcher.Get(); Is it possible to enumerate

WasapiLoopbackCapture internal audio recognition gives jibberish and text when no audio

只谈情不闲聊 提交于 2019-11-28 08:27:53
问题 I finally have built a program to listen to the internal audio loopback using NAudio, and output recognized text. The problem is it listens, and always says, eg: Recognized text: had Recognized text: had Recognized text: had Recognized text: had Recognized text: had had phone Le K add phone Laton Recognized text: had phone looked had phone looked had phone looked had phone lo oked zone Recognized text: had phone lines to had, had phone looked had phone looked had p hone line had phone

change wav file ( to 16KHz and 8bit ) with using NAudio

强颜欢笑 提交于 2019-11-28 07:48:39
I want to change a WAV file to 8KHz and 8bit using NAudio. WaveFormat format1 = new WaveFormat(8000, 8, 1); byte[] waveByte = HelperClass.ReadFully(File.OpenRead(wavFile)); Wave using (WaveFileWriter writer = new WaveFileWriter(outputFile, format1)) { writer.WriteData(waveByte, 0, waveByte.Length); } but when I play the output file, the sound is only sizzle. Is my code is correct or what is wrong? If I set WaveFormat to WaveFormat(44100, 16, 1), it works fine. Thanks. A few pointers: You need to use a WaveFormatConversionStream to actually convert from one sample rate / bit depth to another -

Lex chatbot C# client with voice

风格不统一 提交于 2019-11-28 05:22:22
问题 I have the chatbot client running with text but would now like to change it to voice but I am unsure of how to get the stream from the mic for post. For recording audio I am using NAudio but when sending the memory stream I get an error stating System.IO.IOException: Cannot close stream until all bytes are written. Here is my code: private void recordAudio() { if (memoryStream == null) memoryStream = new MemoryStream(); sourceStream = new NAudio.Wave.WaveIn(); sourceStream.WaveFormat = new

Is Media Foundation supported on Windows 2012 64 bit server? [closed]

雨燕双飞 提交于 2019-11-28 04:03:14
问题 Is Media Foundation supported on Windows 2012 64 bit server? We can not have Windows 7 or Windows 8 as the server and that's the reason we are opting for Windows 2012 server. As NAudio 1.7 is released now, we would like to utilize the new functionality with Media Foundation. Any suggestions greatly appreciated. 回答1: Yes, you can install the Media Foundation components on Windows Server 2012. Use the Add Roles and Features wizard from the Server Manager. Skip through to Features and select

NAudio playing a sine wave for x milliseconds using C#

微笑、不失礼 提交于 2019-11-28 03:51:48
问题 I am using NAudio to play a sinewave of a given frequency as in the blog post Playback of Sine Wave in NAudio . I just want the sound to play() for x milliseconds and then stop. I tried a thread.sleep, but the sound stops straightaway. I tried a timer, but when the WaveOut is disposed there is a cross-thread exception. I tried this code, but when I call beep the program freezes. public class Beep { public Beep(int freq, int ms) { SineWaveProvider32 sineWaveProvider = new SineWaveProvider32();

AlreadyAllocated calling waveOutOpen error

戏子无情 提交于 2019-11-28 01:29:04
问题 private void receiveAudio(object sender) { IPEndPoint senderEP = new IPEndPoint(IPAddress.Any, 0); MemoryStream audioDataStream; BufferedWaveProvider bufferedWaveProvider; //RawSourceWaveStream receivedRawAudioData; byte[] receivedAudioData; waveOutStream = new WaveOut(); while (IsAudioTransferActive) { receivedAudioData = audioUDPClient.Receive(ref senderEP); audioDataStream = new MemoryStream(receivedAudioData); //receivedRawAudioData = new RawSourceWaveStream(audioDataStream, audioFormat);

Saving each WAV channel as a mono-channel WAV file using Naudio

大兔子大兔子 提交于 2019-11-28 01:07:25
问题 I'm trying to convert a WAV file(PCM,48kHz, 4-Channel, 16 bit) into mono-channel WAV files. I tried splittiing the WAV file into 4 byte-arrays like this answer and created a WaveMemoryStream like shown below but does not work. byte[] chan1ByteArray = new byte[channel1Buffer.Length]; Buffer.BlockCopy(channel1Buffer, 0, chan1ByteArray, 0, chan1ByteArray.Length); WaveMemoryStream chan1 = new WaveMemoryStream(chan1ByteArray, sampleRate, (ushort)bitsPerSample, 1); Am I missing something in