naudio

Precision timing in .NET

I've just seen this question, where one of the answers indicates that System.Diagnostics.Stopwatch should only be used for diagnosing performance and not in production code. In that case, what would be the best way to get precision timing in .NET. I'm currently in the early stages of building a very simple MIDI sequencer using the MIDI-...

NAudio - Play mp3 from internet without FileOpenDialog?

Hi, I noticed in the NAudio Demo from the latest version of NAudio that if Filename is empty, then it opens a fileopendialog. So if I paste a http link in that window and click OK, I've noticed that the FileName string looks something like this: "C:\Users\User\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\2FO1NTK2...

Naudio - 'WaveOut' does not contain a constructor that takes '3' arguments

Hi, this question derives from my previous thread Play mp3 from internet without FileOpenDialog I really hope someone knows anything about this. I was told to use a WebRequest to start a download stream and then play the stream instead of playing a locally stored file. However, trying to use the code from PlayMp3FromUrl gives me this e...

Enumerate Recording Devices in NAudio

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. ...

What determines the order for sound devices in windows when using winmm.dll?

I am trying to use NAudio to create a multiple sound output application. We have 8 USB sound cards installed. NAudio lets me use all 8 but I can't figure out a pattern for determining which device index is which card. The cards will be hooked up to different hardware so it is important to make sure you know which card you are using. ...

Reading samples directly from a converted MP3 file using NAudio

I am trying to read PCM samples from a (converted) MP3 file using NAudio, but failing as the Read method returns zero (indicating EOF) every time. Example: this piece of code, which attempts to read a single 16-bit sample, always prints "0": using System; using NAudio.Wave; namespace NAudioMp3Test { class Program { sta...

WaveChannel32 gives me an exception: Offset and length were out of bounds

With the NAudio library I'm trying to mix some audio using a WaveMixerStream32 so I'm using WaveChannel32 to feed it the streams in the proper format. I've got an exception with the following message: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the ...

How can i get 2 wavefilereaders to play sequencially?

Hi I'm trying to play a set of audio wav files being sent over the network for playing as a overall sound stream. How do i get a set of these chunks to play one after the other with no sound breaks or blips using NAudio? I can have 1 file play, but I cant find a way to detect when one sound file ends or how to attach the 2nd sound file ...

Naudio or FMOD libraries in Silverlight applications

Hello guys! I have to grab audio from a microphone and write it to stream 'on fly'. The destination machine will read this data and play it. It's all will be Silverlight applications. So can i use Naudio library or FMOD for my purpose? Thx in advance! ...

Is there a way to stream audio from MIC and play that stream in Silverlight

So I want to stream the audio from a mic using NAudio and then pass that stream to WCF which a Siverlight app can consume to broadcast the live audio sound. I want the latency to be as low as possible. Any suggestions or if some one has already done it please point the source. Thanks in advance ...

How to play a MP3 file using NAudio

WaveStream waveStream = new Mp3FileReader(mp3FileToPlay); var waveOut = new WaveOut(); waveOut.Init(waveStream); waveOut.Play(); This throws an exception: WaveBadFormat calling waveOutOpen The encoding type is "MpegLayer3" as NAudio. How can I play a mp3 file with NAudio? ...

Audio recording and playback using NAudio

When I try recording audio following this here, and using the related source code from here in the (voicerecorder.audio project), I face the problem that the recording stops within moments of starting and so does the playback. the recorded file is 46 bytes, and playback is there for less than a second, basically, the thread jumps to t...

NAudio: How can I get an event that tells me that the MP3 file reached the end?

I tried to use this: private void CreateDevice() { _playbackDevice = new WaveOut(); _playbackDevice.PlaybackStopped += PlaybackDevicePlaybackStopped; } void PlaybackDevicePlaybackStopped(object sender, EventArgs e) { if (OnPlaybackStopped != null) { OnPlaybackStopped(this, e); } } But it never invoked. Th...

Reading a WAV file into VST.Net to process with a plugin

Hello, I'm trying to use the VST.Net and NAudio frameworks to build an application that processes audio using a VST plugin. Ideally, the application should load a wav or mp3 file, process it with the VST, and then write a new file. I have done some poking around with the VST.Net library and was able to compile and run the samples (spec...

Trouble converting an MP3 file to a WAV file using Naudio

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...

NAudio demos not working anymore

I just tried to run the NAudio demos and I'm getting a weird error: System.BadImageFormatException: Could not load file or a ssembly 'NAudio, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null' or one o f its dependencies. An attempt was made to load a program with an incorrect form at. File name: 'NAudio, Version=1.3.8.0, Culture=ne...

NAudio playback wont stop successfully

Hi When using NAudio to playback an mp3 [in the console], I cant figure out how to stop the playback. When I call waveout.Stop() the code just stops running and waveout.Dispose() never gets called. Is it something to do with the function callback? I dont know how to fix that if it is. static string MP3 = @"song.mp3"; s...

Debug NAudio MP3 reading difference?

My code using NAudio to read one particular MP3 gets different results than several other commercial apps. Specifically: My NAudio-based code finds ~1.4 sec of silence at the beginning of this MP3 before "audible audio" (a drum pickup) starts, whereas other apps (Windows Media Player, RealPlayer, WavePad) show ~2.5 sec of silence before...

NAudio - Streaming byte[] of wav makes it play slow

Hi, I am trying to read bytes from a wav file and send it across to a stream but it plays slowly. Could you please help me to know the right way of populating the byte[]? Thanks for you help. ...

byte[] to wav file

Hi, It would be great if you could tell me how I could save a byte[] to a wav file. Sometimes I need to set different samplerate, number of bits and channels. Thanks for your help. ...