NAudio 2 plans
Just a quick update about my plans for a v2 of NAudio. NAudio 2 will have a few small bugfixes, but should mostly be a highly backwards compatible update. Most of the changes will be to do with project organization.
Multiple Assemblies
The biggest change is that NAudio is now a collection of smaller libraries. This is because a lot of NAudio contains platform specific interop wrappers that are not applicable to all users.
- NAudio.Core is a .NET Standard package which includes all of the cross-platform parts of NAudio. All of the interfaces, lots of helpers plus things like
WaveFileReader
andWaveFileWriter
are in here - NAudio.MIDI contains the MIDI events, which can be used cross platform, and also the WinMM MIDI interop which is Windows specific.
- NAudio.WinMM contains all of the Windows audio API support for the long-standing WinMM APIs. Most notably the
WaveInEvent
andWaveOutEvent
classes which are still often the best choice for audio recording and playback on Windows, plus other old Windows API support such as ACM (codecs) and the mixer. - NAudio.WASAPI contains all the interop for the newer Windows audio APIs including WASAPI, DMO (DirectX Media Objects) and MediaFoundation
- NAudio.WinForms contains anything with a WinForms dependency. This includes the original
WaveIn
andWaveOut
classes which use Windows messages for callbacks. Note that it is totally fine to use these in a WPF application. However, this package is probably not needed in most cases - NAudio.Asio contains the interop for ASIO
- NAudio.Uap contains all the support for the UAP platform, with a new minimum version of 17763 (Windows 10 version 1809). To be honest, most of this is still experimental and I'm tempted to drop it. It was really just a proof of concept I made a few years back and is a pain to maintain.
- NAudio this still exists as a top-level package that references all of the sub-packages, hopefully making it easy for people who don't want to know or care about what is where. There are a couple of classes that had to go at this layer, which are
AudioFileReader
since that combines readers from several different sub-assemblies, andMp3FileReader
which by default uses ACM. However a newMp3FileReaderBase
can be used if you want to provide a different MP3 frame decoder (e.g. NLayer) - NAudio.Extras - contains some useful helper classes from the demo applications. This is also a potential good place for contributors to add some of their own helper classes that aren't a good fit for the core libraries.
I've kept everything in a monorepo, as this makes life a lot easier testing the code. I might even bring in a few more satellite libraries such as NAudio.SharpMediaFoundation.
Dropped .NET 3.5 support
Note that I've finally dropped .NET 3.5 support. The lowest version NAudio 2 will support is .NET 4.7.2. However you can of course still use NAudio 1 with .NET 3.5 if you are still stuck on a legacy version of the .NET Framework.
Strong Naming
I have also taken this opportunity to strong name the assemblies. This was always a source of controversy, as some people wanted it strong named, and others didn't, and I wasn't sure of the implications of suddenly switching. However, the official guidance from Microsoft has changed over the years, with the recommendation now being that you do strong-name your libraries, and so releasing a new major version seems a good time to introduce it.
Switching to the MIT License
I have also chosen to move away from the MS-PL to the more standard and well-known MIT license. They are both permissive and commercial friendly licenses, so I don't anticipate any problems here.
Azure Pipeline
I also did some work on improving the Azure Pipeline build so it can run the unit tests. The previous build set up was rather unreliable, and this should make it easier to evaluate pull requests.
Feedback
I'd love for you to try out the beta builds of NAudio 2, and let me know if they unexpectedly break anything in your applications. And please give me any feedback on these changes to NAudio. I want to do a bit more testing myself before pushing these changes live, but hopefully it won't be too long.
Comments
Mark great work i wonder if you could point me in the best way of implementing AGC with NAudio
WarwickI was trying to add NAudio 2.0 to my project (Currently still on v.1.10), but it has a dependency to NAudio.WinForms -- so any attempt at using it blows up and requires my cross-platform project with .NET 5 to now require being net50-windows in the build targets. I haven't seen any migration guides or if there is a way to remain as just a "net50" for framework, vs the requirement on WIndows. Any thoughts?
Taylor JeudeHi Mark,
Phil HetheringtonThank you for your efforts with NAudio. Its a great package.
I was wondering when you might support Asio sampletype Float32LSB? I'd like to be able to easily read and write float in the callback without having to do the sample by sample conversions.
Thank you
Hello,
Patrick RogersI was curious if this library will allow me to create a multi-channel stereo wav file from 2 or more mono wav files? For instance, I'd like to put the Agent portion of a call into the left channel, and the client portion into the right channel, and then any 3rd Parties in additional channels.
Thanks,
Pat