naudio

MonoDevelop + NAudio + Ubuntu Linux tells me Winmm.dll not found?

一笑奈何 提交于 2019-12-04 10:40:15
So I'm attempting to use MonoDevelop with NAudio and Ubuntu Linux, For some reason It errors saying that winmm.dll isn't found so I attempted to download it and and the "Add Reference" dialogue claims its not a valid .NET library. Here is my code.... using System; using System.IO; using Gst; using GLib; using Gst.BasePlugins; using NAudio; using NAudio.Wave; namespace record_audio_simple_test { class MainClass { //Define class variables private NAudio.Wave.WaveFileReader waveFile = null; private NAudio.Wave.DirectSoundOut output = null; public static void Main (string[] args) { WaveFileReader

Delay (approx 200 ms) in streamed audio playback

限于喜欢 提交于 2019-12-04 10:34:37
I have an application which plays the streamed audio data (like a chat client). The workflow involves three simple steps: The file header info (sample rate, bits per sample and num of channels) is sent first. Audio waveout device is initialized based on the above parameters. Audio (pcm) data is sent and is played on the above device. The data receiving code is native (C code). and it reads data on a socket. Then it calls the managed C# code, which uses Naudio library to initialize device and play audio. Now the problem is that, I am seeing some delay in audio playback. I have already

NAudio Algorithm to play a sinewave whose frequency can be changed smoothly in real time [closed]

夙愿已清 提交于 2019-12-04 09:46:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 11 months ago . So far, I have implemented the algorithm found on this blog post with limited success. The concept of my program is to initialize the sinewave, then change the frequency according to the position of the mouse on screen - move the mouse up and the sine wave gets higher and vice versa (essentially a theremin

wma audio stream to mp3 stream using NAudio c#

别来无恙 提交于 2019-12-04 07:00:30
问题 My task is to convert wma audio stream to mp3 stream using NAudio and Lame. The below code is working fine with file name but I want it to be done with memory stream. I search in NAudio there is no method for reading wma audio stream. Is it possible with NAudio? public static byte[] ConvertWmaToMp3(uint bitrate = 128) { FileStream fs = new FileStream("..\\sample.wma", FileMode.Open, FileAccess.Read); var ws = new NAudio.WindowsMediaFormat.WMAFileReader(fs.Name); // Setup encoder configuration

How to Mix 2 wav files together?

我是研究僧i 提交于 2019-12-04 05:51:18
问题 I'm trying to record an input and merge it together with a song (not concatenate). I have a guitar that i recorded while listening to a song and I want to put the guitar on the song (like audcaity). Is there any way for doing it? If its not possible on real time mixing - is it possible to merge them after i recorded? Like after I recorded the guitar and now its a wav file and i want to mix 2 wav files together. Thats the input device: private void Capture() { input = new WasapiCapture(

Playing a .wav file using naudio, playback stops after 1 sec

六月ゝ 毕业季﹏ 提交于 2019-12-04 03:28:12
问题 I'm using the naudio lib in C# and want to play a simple file. The problem is, the playback stops after 1 second. I cant figure out the reason why it does that. using System; using System.Collections.Generic; using System.Linq; using System.Text; using NAudio.Wave; namespace NAudioTest { class Program { static IWavePlayer waveout; static WaveStream outputStream; static string filename = null; static void Main(string[] args) { waveout = new WaveOut(); filename = "C:\\1.wav"; outputStream =

Easiest way to read 2-channel samples into array from WaveStream

假如想象 提交于 2019-12-04 03:11:35
I've been struggling with this for quite some time now and I couldn't find a working solution. I have a wav file (16 bit PCM: 44kHz 2 channels) and I want to extract samples into two arrays for each of the two channels. As far as I know the direct method for this does not exist in NAudio library, so I tried to run the following code to read a few of interlaced samples but the buffer array stays empty (just a bunch of zeros): using (WaveFileReader pcm = new WaveFileReader(@"file.wav")) { byte[] buffer = new byte[10000]; using (WaveStream aligned = new BlockAlignReductionStream(pcm)) { aligned

Playing ohLibSpotify pcm data stream in C# with NAudio

心已入冬 提交于 2019-12-03 20:24:22
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/ ). With the following code snippet i can play a mp3 file from disk. Is it possible to directly pass the

Naudio - Convert 32 bit wav to 16 bit wav

末鹿安然 提交于 2019-12-03 17:06:25
I've been trying to convert a 32 bit stereo wav to 16 bit mono wav. I use naudio to capture the sound I and thought that using just the two of four more significant bytes will work. Here is the DataAvailable implementation: void _waveIn_DataAvailable(object sender, WaveInEventArgs e) { byte[] newArray = new byte[e.BytesRecorded / 2]; short two; for (int i = 0, j = 0; i < e.BytesRecorded; i = i + 4, j = j + 2) { two = (short)BitConverter.ToInt16(e.Buffer, i + 2); newArray[j] = (byte)(two & 0xFF); newArray[j + 1] = (byte)((two >> 8) & 0xFF); } //do something with the new array: } Any help would

Recording with NAudio using C#

喜你入骨 提交于 2019-12-03 13:41:02
问题 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 =