naudio

How to convert Linear16 PCM wav to G711 8-bit 8-khz MULAW wav with same quality as g711.org?

送分小仙女□ 提交于 2020-01-06 07:57:12
问题 I am using NAudio to attempt to convert Linear16 PCM wav files that come out of a 3rd party Text-To-Speech API to G711 8-bit 8-khz MULAW that will work as a telephony prompt. Using techniques found in the library authors documentation and some stack overflow posts and specifically following suggestion to do a 2 step conversion. dynamic foo = JsonConvert.DeserializeObject<dynamic>(result); byte[] decoded = Convert.FromBase64String(foo.audioContent.ToString()); WaveFormat newFormat = new

windows 7 control playback volume of microphone

被刻印的时光 ゝ 提交于 2020-01-05 19:08:32
问题 I was trying to adjust playback volume level of microphone; but unfortunately I couldn't. I can control recording volume of microphone by using NAudio library but I want to control playback volume. Is there any way to control microphone playback volume on windows 7. Either C++ or C# solution is acceptable for me. Here are some attempts to solve my problem: http://www.computercabal.com/2010/11/mute-microphone-from-c-on-windows.html (This guy wrote a small library that can mute microphone

C# Unity 3D NAudio throws NullReferenceException while checking for default audio endpoint

别等时光非礼了梦想. 提交于 2020-01-05 13:14:02
问题 I've just installed Unity 3D because I wanted to make a simple game. There is one problem with the NAudio library though. This is my code: var enumerator = new MMDeviceEnumerator(); if (enumerator.HasDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia)) //<--- crashes here { //... } This is literally all Unity says when trying to launch the game: NullReferenceException: Object reference not set to an instance of an object NAudio.CoreAudioApi.MMDeviceEnumerator.HasDefaultAudioEndpoint

C# Unity 3D NAudio throws NullReferenceException while checking for default audio endpoint

白昼怎懂夜的黑 提交于 2020-01-05 13:13:48
问题 I've just installed Unity 3D because I wanted to make a simple game. There is one problem with the NAudio library though. This is my code: var enumerator = new MMDeviceEnumerator(); if (enumerator.HasDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia)) //<--- crashes here { //... } This is literally all Unity says when trying to launch the game: NullReferenceException: Object reference not set to an instance of an object NAudio.CoreAudioApi.MMDeviceEnumerator.HasDefaultAudioEndpoint

Stop audio recorder on its own after time delay in c# ( using NAudio)

眉间皱痕 提交于 2020-01-05 08:34:21
问题 I am making an audio recorded using NAudio in C# and i need to remove the stop button used and simply stop the recording on its own after some time delay. The code for the record event is private void cmbRecord_Click(object sender, EventArgs e) { outputFilename = "file address"; waveInStream = new WaveIn(44100,2); writer = new WaveFileWriter(outputFilename, waveInStream.WaveFormat); waveInStream.DataAvailable += new EventHandler<WaveInEventArgs>(waveInStream_DataAvailable); waveInStream

Trouble converting an MP3 file to a WAV file using Naudio

↘锁芯ラ 提交于 2020-01-02 12:40:32
问题 Naudio Library: http://naudio.codeplex.com/ I'm trying to convert an MP3 file to a WAV file, but I've run in to a small error. I know what's going wrong, but I don't really know how to go about fixing it. Here's the piece of code I'm running: private void button1_Click(object sender, EventArgs e) { using(Mp3FileReader reader = new Mp3FileReader(@"path\to\MP3")) { using(WaveFileWriter writer = new WaveFileWriter(@"C:\test.wav", new WaveFormat())) { int counter = 0; while(reader.Read(test,

Save streaming data to a WAV file using NAudio

浪尽此生 提交于 2020-01-02 10:04:32
问题 I want to save the incoming stream data to a WAV file on my hard disk drive. How can I change the code below to be able to record the stream into a valid WAV file? From the demo here: private void StreamMP3(object state) { this.fullyDownloaded = false; string url = (string)state; webRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse resp = null; try { resp = (HttpWebResponse)webRequest.GetResponse(); } catch(WebException e) { if (e.Status != WebExceptionStatus.RequestCanceled)

Playing ohLibSpotify pcm data stream in C# with NAudio

血红的双手。 提交于 2020-01-01 06:37:11
问题 I'm trying to play raw pcm data delivered from ohLibSpotify c# library (https://github.com/openhome/ohLibSpotify). I get the data in the following callback: public void MusicDeliveryCallback(SpotifySession session, AudioFormat format, IntPtr frames, int num_frames) { //EXAMPLE DATA //format.channels = 2, format.samplerate = 44100, format.sample_type = Int16NativeEndian //frames = ? //num_frames = 2048 } Now i want to directly play the received data with NAudio (http://naudio.codeplex.com/).

How to read Bit rate of .wav file in C#

喜你入骨 提交于 2019-12-30 09:44:07
问题 given that I have a .wav file, what would be best way to read its Bit rate property in C#. I have tried Shell, and asked a question Is "Bit rate" property fixed in index 28? with no asnwers so for. Also I now believe Shell is not the best way to read audio file properties. I have researched on different open source media libraries, cant find much. TagLib#: This one works alright but have two issues. it does not reflect actual bit rate in some cases where bit rate is very low (like less than

Hearing the Incoming audio from mic

ぃ、小莉子 提交于 2019-12-30 05:37:04
问题 i just want to hear what i say to microphone using NAudio and this is my code so far but the problem is i can't hear anything. any help would be appreciated. public partial class frmMain : Form { private WaveIn waveIn; // Gets an audio from microphone private WaveOut waveOut; // Sends audio to speaker private BufferedWaveProvider waveProvider; // Gets an audio from stream public frmMain() { InitializeComponent(); } private void frmMain_Load(object sender, EventArgs e) { waveOut = new WaveOut(