|
|
Thanks for this great library!
Is support for Windows 8 WinRT Metro Style apps planned by leveraging the
MediaCapture API?
|
|
Coordinator
May 7, 2012 at 9:15 PM
|
I'd love to do this for a future version of NAudio. Not top of the priority list at the moment though.
Mark
|
|
|
|
@markheath
Would you accept patches that would add support for WinRT and/or other platforms?
- Tom
|
|
Coordinator
Aug 27, 2012 at 8:58 PM
|
hi Tom,
I do accept patches but please read
these notes about submitting patches. NAudio currently builds against .NET 2.0, and maintaining backwards compatibility is important. There would only be a certain subset of NAudio that would apply with WinRT in any case, so I could imagine a separate project
just bringing in fewer files might be possible. I have got VS2012 installed on my dev PC myself now, so I may get the chance at some point to experiment with how WinRT and NAudio can be combined.
Mark
|
|
|
|
Hi Tom,
Have you done your patch yet ? I'm also considering doing mine. I want to convert a subset of NAudio (CoreAudio) in order to use it in a store application. Right now I'm stuck with custom marshaling (ICustomMarshaler doesn't exist). Is your patch available
? Have you the same problem ?
Thanks.
Olivier
|
|
|
|
Hi Mark,
Do you have any plan to release a WinRT version of NAudio? I am currently using NAudio 1.5 in my WinRT Javascript application to convert MP3 to WAV using Naudio. It works like a charm but unfortunately the application does not pass the appcert tool certification...
The tool says that naudio.dll uses some APIs that are forbidden.
I am aware it is not on your priority list but I just check.
The other idea I have is to remove from naudio source all the methods and libraries not necessary in the methods I use. Here is what I do:
public static void ConvertMp3toPcm(string sourceFilename, string outputFileName, string pcmFilename)
{
if (string.IsNullOrEmpty(sourceFilename))
throw new ArgumentNullException("sourceFilename");
if (string.IsNullOrEmpty(outputFileName))
throw new ArgumentNullException("outputFileName");
if (string.IsNullOrEmpty(pcmFilename))
throw new ArgumentNullException("pcmFilename");
using (Mp3FileReader reader = new Mp3FileReader(sourceFilename))
{
using (WaveStream waveStream = WaveFormatConversionStream.CreatePcmStream(reader))
{
WaveFileWriter.CreateWaveFile(outputFileName, waveStream);
}
}
//Re-encode the stream with a mono channel, 16bits and 16kHz
using (WaveStream readWaveStream = new WaveFileReader(outputFileName))
{
WaveFormat target = new WaveFormat(16000, 16, 1);
WaveFormatConversionStream monoStream = new WaveFormatConversionStream(target, readWaveStream);
WaveFileWriter.CreateWaveFile(pcmFilename, monoStream);
}
}
I don't know if the licensing of Naudio would allow me to do this. I have to check.
Thanks a lot,
Omid.
|
|
Coordinator
Oct 8, 2012 at 4:30 PM
|
I'd love to make a WinRT version of NAudio, but as you have discovered, NAudio contains wrappers for lots of APIs that are disallowed in WinRT (I assume this will include all waveIn, waveOut, and acm functions). I'm hoping to experiment with Windows 8 and
see what is possible in the near future. There are some new Audio APIs that are part of WinRT, which I presume Windows Store applications are supposed to use exclusively.
|
|
|
|
Sure I understand. Thanks anyway.
Omid.
|
|
|
|
How is WinRT support efforts going? I downloaded the project and it looks like there's been some progress. Would it be worthwhile for me to fork and do some work?
|
|
Coordinator
Dec 2, 2012 at 6:41 AM
|
Hi tcl,
Did you see my recent
blog post on adding Windows Store support to NAudio? I'm actively working on it at the moment, but there is some way to go. Here's the key tasks that need to be completed.
1. Media Foundation. This is because ACM and DMO which NAudio already supported are both not allowed in Windows Store apps. The main three things we need are a MediaFoundationReader (which is mostly complete, just needs some tweaks), a MediaFoundationEncoder
(which I have prototyped the internals of, just need to give it a nice public API), and a MediaFoundationResampler, which another forum user Manu is kindly helping out with, so hopefully there will be enough Media Foundation interop in the very near future.
2. WASAPI. Even though I have already done all the hard work on WASAPI interop, it will need to be modified to work with Windows Store apps. Currently I've not decided whether to make completely separate WasapiOut and WasapiIn classes for
the Win8. I don't know whether loopback capture is possible. There is a
great article on CodeProject showing how it can be done (in VB), so I'm hoping that when I get onto this in the very near future, it should be done quite quickly.
3. Streams NAudio depends heavily on the Stream base class, but the WinRT API now seems to prefer IInputStream, IOutputStream and IRandomAccessStream. There are a lot of classes (e.g. the WaveFileReader, WaveFileWriter, MP3FileReader, AiffFileReader,
AiffFileWriter) that will at least need new constructors. I don't really want to have to maintain two completely separate versions of all these classes, so one interesting task will be to see what the simplest change that allows them to be used with the regular
Windows Store file APIs is.
4. Demo Project I'm also going to create a Windows Store demo app. It will follow a similar structure to the WPF and WinForms ones, allowing me to very quickly add in new demos. Before we announce WinRT support we need two main demos. One
reads files using MediaFoundationPlayer and plays them through WASAPI, and the other records from the microphone and encodes to WMA/MP3 using the MediaFoundationEncoder. I'll probably throw in some visualisation like waveform drawing as well. Once I've got
the basic demo store app's structure in place, it should be easy for people to contribute other WinRT demos to it.
If you want to contribute, the best way at the moment is probably to prototype a proof of concept for one of these tasks, since the overall project is still very fluid and so I may not be able to merge in large contributions. Let me know if there is anything
above that takes your interest.
|
|
|
|
Mark,
Thanks for the thoughtful reply. I hadn't seen your blog post before. I'll dig into the WinRT project over the next couple of weeks and see if/where I can help.
Todd
|
|
Feb 20 at 1:46 PM
Edited Feb 20 at 1:47 PM
|
Any news on the WinRT front?
In partucular I'm looking for a way to draw an audio graph from the MediaCapture microphone stream in C#.
Similar to yours here
|
|
Coordinator
Feb 21 at 10:45 AM
|
hi, the WinRT support is coming along reasonably well, although I haven't had a chance to work on it in the last few weeks. If you get the latest code out, you can see what has been done so far. The WPF drawing code might be able to translate across, as WinRT has a very similar XAML-based graphics system.
Mark
|
|