Posted in:

I have finally got round to releasing the long overdue version 1.5 of NAudio. There are loads of bugfixes and improvements, so I recommend upgrading if possible. Here’s the highlights.

  • Now available on NuGet!
  • Numerous bugfixes mean we are now working fully in x64 as well as x86, so NAudio.dll is now marked as AnyCPU. (You can still force x86 by marking your own executable as x86 only.)
  • WaveOutEvent – a new WaveOut mode with event callback, highly recommended instead of WaveOut with function callbacks
  • 24 bit ASIO driver mode (LSB)
  • Float LSB ASIO driver mode
  • WaveFileWriter has had a general code review and API cleanup
  • Preview of new ISampleProvider interface making it much easier to write custom 32 bit IEEE (float) audio pipeline components, without the need to convert to byte[]. Lots of examples in NAudioDemo of using this and more documentation will follow in future.
  • Several ISampleProvider implementations to get you started. Expect plenty more in future NAudio versions:
    • PanningSampleProvider
    • MixingSampleProvider
    • MeteringSampleProvider
    • MonoToStereoSampleProvider
    • NotifyingSampleProvider
    • Pcm16BitToSampleProvider
    • Pcm8BitToSampleProvider
    • Pcm24BitToSampleProvider
    • SampleChannel
    • SampleToWaveProvider
    • VolumeSampleProvider
    • WaveToSampleProvider
  • Added AiffFileReader courtesy of Giawa
  • AudioFileReader to simplify opening any supported file, easy volume control, read/reposition locking
  • BufferedWaveProvider uses CircularBuffer instead of queue (less memory allocations)
  • CircularBuffer is now thread-safe
  • MP3Frame code cleanup
  • MP3FileReader throws less exceptions
  • ASIOOut bugfixes for direct 16 bit playback
  • Some Demos added to NAudioDemo to give simple examples of how to use the library
    • NAudioDemo has an ASIO Direct out form, mainly for testing the AsioOut class at different bit depths (still recommended to convert to float before you get there).
    • NAudioDemo has simple MP3 streaming form (play MP3s while they download)
    • NAudioDemo has simple network streaming chat application
    • NAudioDemo playback form uses MEF to make it much more modular and extensible (new output drivers, new file formats etc)
    • NAudioDemo can play aiff GSM 6.10 ACM codec support
  • DSP Group TrueSpeech ACM codec support
  • Fully managed G.711 a-law and mu-law codecs (encode & decode)
  • Fully managed G.722 codec (encode & decode)
  • Example of integration with NSpeex
  • Fix to PlaybackStopped using SyncContext for thread safety
  • Obsoleted IWavePlayer.Volume (can still set volume on WaveOut directly if you want)
  • Improved FFT display in WPF demo
  • WaveFileReader - tolerate junk after data chunk
  • WaveOut constructor detects if no sync context & choose func callbacks
  • WaveOut function mode callbacks hopefully chased out the last of the hanging bugs (if in a WaveOutWrite at same time as WaveOutReset, bad things happen - so need locks, but if WaveOutReset called during a previous func callback that is about to call waveOutWrite we deadlock)
  • Now has an msbuild script allowing me to more easily create releases, run tests etc
  • Now using Mercurial for source control, hopefully making bug fixing old releases and accepting user patches easier. n.b. this unfortunately means all old submitted patches are no longer available for download on the CodePlex page.
  • WPF Demo enhancements:
    • WPF Demo is now .NET 4, allowing us to use MEF, and will be updated hopefully with more examples of using NAudio.
    • WPF Demo uses windowing before FFT for a more accurate spectrum plot
    • WPF Demo has visualization plugins, allowing me to trial different drawing mechanisms
    • WPF Demo has a (very basic) drum machine example

I also intend that this will be the last NAudio that targets .NET 2.0 (1.6 will be .NET 3.5). Let me know if you have any objections.

Hope you have fun using it, and do send me the links to any cool stuff you make with it.

Want to get up to speed with the the fundamentals principles of digital audio and how to got about writing audio applications with NAudio? Be sure to check out my Pluralsight courses, Digital Audio Fundamentals, and Audio Programming with NAudio.


Comment by Anonymous

Great! Thank you and please keep up your good work.

Comment by Mdwf

Great job again ! I'll make a new version of SharpMod with this release to make a full AnyCPU release too :)

Comment by Mark H

@mdwf awesome, email me when you've done it

Comment by David

Great work Mark!
Does NAudio currently have capabilities to provide audio onset detection (beat) or conversion of audio to midi?

Comment by Anonymous

Does the NAudio can play multiple mp3 file simultaneously to multiple channels of a sound card

Comment by Mark H

@David - I'm afraid not
@Anonymous - NAudio can open as many channels as the sound card driver allows. You will need to write your own multi-channel waveprovider though.

Comment by suntzu

+1 for DotNet 2.0 compatibilty. Please keep the compatibilty with DotNet 2.0.

Comment by suntzu

NAudio library life is a life saver for our product.
+1 for keeping compatibility with DotNet 2.0.
Please retain NAudio compatibility with DotNet 2.0

Comment by Anonymous

hi guys.,i have tried using Naudio 1.5 in WinRT(.NetFrameWork 4.5)when i ran my application at very first time i got the output..thereafter i couldn't get output..
Getting the following error

Error 1 Cannot resolve Assembly or Windows Metadata file 'System.Windows.Forms.dll' C:\Users\umapathi.a\Documents\Visual Studio 2012\Projects\SampleMp3\SampleMp3\SampleMp3.csproj SampleMp3
Error 2 Type universe cannot resolve assembly: System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089. SampleMp3

Anyhelp would be appreciated..

Comment by Mark H

hi @anonymous, NAudio 1.5 does not support WinRT. It is something I would like to do for a future NAudio, but there are a large number of classes in NAudio that simply won't work under WinRT as you can't call into any Windows API you want. What is needed is a new IWavePlayer and a new IWaveIn that works with the new WinRT APIs.