Quantcast
Channel: NAudio
Viewing all 5831 articles
Browse latest View live

Commented Issue: WaveFileChunkReader.ReadWaveHeader assumes that the stream supports position/seek [16354]

$
0
0
I am using this class to read a wave stream but the derived stream class that I am using that contains the wave does not support setting the Postion (CanSeek == false).
public void ReadWaveHeader(Stream stream)
{ ...
while (stream.Position <= stopPosition - 8)
{...
stream.Position += chunkLength; //This line throws an expection.
}
...
}
Is it posible to use another metholody to read the wave that is not based on Postion? or is there another alternative?
Comments: I found a solution DONETZIP has an option to write the wave file directly to a MemoryStream which does support seek/position. Thanks your comement helpped me look further into this.

New Post: midi in problem: Object reference not set to an instance of an object.

$
0
0

is it e.MidiEvent itself that is null?

or is a null reference occurring in the ToString?

If you set your debugger to break on all errors you should be able to find this out

Reviewed: NAudio 1.5 (Jun 12, 2012)

$
0
0
Rated 5 Stars (out of 5) - Excellent architecture, fast implementation and very little bugs in NAudio make it the greatest .NET library for usage in audio applications. Thank you Mark.

Updated Wiki: Documentation

$
0
0

The NAudio Documentation Wiki

NAudio FAQ

What is NAudio?

NAudio is an open source audio API for .NET written in C# by Mark Heath, with contributions from many other developers. It is intended to provide a comprehensive set of useful utility classes from which you can construct your own audio application.

Why NAudio?

NAudio was created because the Framework Class Library that shipped with .NET 1.0 had no support for playing audio. The System.Media namespace introduced in .NET 2.0 provided a small amount of support, and the MediaElement in WPF and Silverlight took that a bit further. The vision behind NAudio is to provide a comprehensive set of audio related classes allowing easy development of utilities that play or record audio, or manipulate audio files in some way.

Can I Use NAudio in my Project?

NAudio is licensed under the Microsoft Public License (Ms-PL) which means that you can use it in whatever project you like including commercial projects. Of course we would love it if you share any bug-fixes or enhancements you made to the original NAudio project files.

Is .NET Performance Good Enough for Audio?

While .NET cannot compete with unmanaged languages for very low latency audio work, it still performs better than many people would expect. On a fairly modest PC, you can quite easily mix multiple WAV files together, including pass them through various effects and codecs, play back glitch free with a latency of around 50ms.

How can I get help?

There are three main ways to get help. If you have a specific question concerning how to use NAudio, then I recommend that you ask on StackOverflow and tag your question with naudio. This gives you the best chance of getting a quick answer. You can also ask a question on the NAudio discussion forums here on CodePlex. I attempt to answer all questions, but since this is a spare time project, occasionally I get behind. Finally, I am occasionally able to offer paid support for situations where you need quick advice, bugfixes or new features. Use the contact feature of the Codeplex website to get in touch with Mark Heath if you wish to pursue this option.

How do I submit a patch?

I welcome contributions to NAudio and have accepted many patches, but if you want your code to be included, please familiarise yourself with the following guidelines:

  • Your submission must be your own work, and able to be released under the MS-PL license.
  • You will need to make sure your code conforms to the layout and naming conventions used elsewhere in NAudio.
  • Remember that there are many existing users of NAudio. A patch that changes the public interface is not likely to be accepted.
  • Try to write "clean code" - avoid long functions and long classes. Try to add a new featue by creating a new class rather than putting loads of extra code inside an existing one.
  • I don't usually accept contributions I can't test, so please write unit tests (using NUnit) if at all possible. If not, give a clear explanation of how your feature can be unit tested and provide test data if appropriate. Tell me what you did to test it yourself, including what operating systems and soundcards you used.
  • If you are adding a new feature, please consider writing a short tutorial on how to use it.
  • Unless your patch is a small bugfix, I will code review it and give you feedback. You will need to be willing to make the recommended changes before it can be integrated into the main code.
  • The easiest way to provide a patch is to create your own fork on Mercurial and issue a pull request. See this video if you are new to Mercurial.
  • Please also bear in mind that when you add a feature to NAudio, that feature will generate future support requests and bug reports. Are you willing to stick around on the forums and help out people using it?

How do I...?

The best way to learn how to use NAudio is to download the source code and look at the two demo applications - NAudioDemo and NAudioWpfDemo. These demonstrate several of the key capabilities of the NAudio framework. They also have the advantage of being kept up to date, whilst some of the tutorials you will find on the internet refer to old versions of NAudio.

Getting Started with NAudio – Downloading and Compiling

  1. Download a copy of the NAudio source code (or a pre-compiled version but the newest available code is available in source form first).
    http://naudio.codeplex.com/SourceControl/list/changesets
  2. The default project is set to the NAudio class library. Class Library’s don’t have anything to look at when you press F5. If this is your first time with NAudio, set the start-up project as NAudioDemo and then hit F5. The NAudioDemo project shows the base functionality you can utilise through your own project.
  3. In the BIN directory for the built solution, you can find a copy of the NAudio library for using and referencing in your own project. Make sure that you grab a copy of the NAudio.XML file as well if your copying it over to your own projects directory, that way you will have the intellisense documentation for use in Visual Studio when working with the NAudio API.

Additional Tutorials from OpenSebJ's blog (n.b. these are for NAudio 1.3):

http://stackoverflow.com/

New Post: Amplify pcm file volume

$
0
0

Hi mark, First i want to thank you for naudio, i used naudio for my app and it help me alot.

Now i have some req to take file with very low vol and amplify the volume that it will be possible to earing something.

I saw you wrote somwhere that you did it in your skype project but i tried to understand from it how to do it without succsess.

So can you help me with it? how can i do it with naudio and what is the general  methode to do it

Thanks in advance

New Post: speech to text dictation

$
0
0

What approach can I take to compare two wavs and get a text output. My goal is to make something like siri using speex.

New Post: speech to text dictation

$
0
0

Speech recognition is hard. Really really hard. Sorry to be so blunt about it, but I have learned to be very clear about this after encountering people with unrealistically high expectations of what they could achieve.

Your best bet is to use the Microsoft speech recognition engine that comes free with Windows. It comes with a managed API.

New Post: disabling MessageBoxes put up by NAudio -URGENT

$
0
0

Hi, I am using Naudio (1.5) in a non-GUI application and I see an occassional "Wavefile not closed" messageBox at shutdown. I dont want the application stuck due to an open messagebox since this is intended for untrained users who dont even interact with the PC directly. An exception or log message would be ok since it can be handled silently and other parts of app can continue to run.

Is there a way to disable the messageboxes? User trial starts in couple of days!

tks,

nan


New Post: disabling MessageBoxes put up by NAudio -URGENT

$
0
0

these are Debug.Asserts and are warning you that you did not dispose of something correctly. There are some heavy-handed ways of disabling Debug.Assert (e.g. http://stackoverflow.com/questions/2854024/how-to-prevent-debug-assert-to-show-a-modal-dialog). Alternatively, get the NAudio code and do a release build and these won't be included. In the future I plan for official releases of NAudio to be done with release builds, but I have tended to use debug builds in the past as I find these asserts helpful for tracking down problems.

New Post: disabling MessageBoxes put up by NAudio -URGENT

$
0
0

thanks mark, that was super fast!!

yes, I agree that they are useful just that I have not yet tested all code paths so cant predict where else they may pop up. I will try the release build too.

thanks once again for the prompt response and keep up the great work!

nan

New Post: hide application from windows volume mixer

Updated Wiki: Home

$
0
0

NAudio Overview

NAudio is an open source .NET audio and MIDI library, containing dozens of useful audio related classes intended to speed development of audio related utilities in .NET. It has been in development since 2001 and has grown to include a wide variety of features. While some parts of the library are relatively new and incomplete, the more mature features have undergone extensive testing and can be quickly used to add audio capabilities to an existing .NET application.

NAudio demo project showing an MP3 file playing:
naudiodemo.png

NAudio WPF Project showing waveform visualisation and spectrum analyser:
NAudioWPF.png

Latest News

For the latest news and more documentation on NAudio, visit Mark Heath's blog.
  • 19 Dec 2011 NAudio 1.5 Released. Read the release notes
  • 20 Apr 2011 NAudio 1.4 Released. Read the release notes
  • 15 Apr 2011 NAudio demo now shows how to select output devices (for WaveOut, DirectSound, WASAPI and ASIO), and can play 8 bit, 16 bit, 24 bit, and 32 bit float WAV files. Fixed a longstanding ASIO issue.
  • 7 Nov 2010 Major improvements to Mp3FileReader
  • 10 Oct 2009 Version 1.3 Released. Read the release notes
  • 20 Sep 2009 We are getting close to feature complete for 1.3. Last chance to get in any feedback on the API
  • 26 Aug 2009 WPF Waveform drawing demo project including FFT added
  • 28 Feb 2009 Lots of new stuff is being added and planned, so do check out the Source Code tab to have a sneak peak at what's coming in 1.3
  • 26 June 2008 Version 1.2 Released. Read the release notes

NAudio Features

  • Play back audio using a variety of APIs
    • WaveOut
    • DirectSound
    • ASIO (not currently working with all soundcards)
    • WASAPI (Windows Vista Core Audio)
  • Decompress audio from different Wave Formats
    • MP3 decode using ACM or DMO codec
    • AIFF
    • G.711 mu-law and a-law
    • ADPCM
    • G.722
    • Speex (using NSpeex)
    • SF2 files
    • Decode using any ACM codec installed on your computer
  • Record audio using WaveIn or WASAPI
  • Read and Write standard .WAV files
  • Mix and manipulate audio streams using a 32 bit floating mixing engine
  • Extensive support for reading and writing MIDI files
  • Full MIDI event model
  • Basic support for Windows Mixer APIs
  • A collection of useful Windows Forms Controls
  • Some basic audio effects, including a compressor

Projects Using NAudio

NAudio currently is used to support a number of audio related utilities, some of which may be moved to be hosted on CodePlex in the future. If you have used NAudio for a project, please get in touch so we can post it here.

More Info

For more information, please visit the NAudio Documentation Wiki

Donate

NAudio is a free open source project that is developed in personal time. You can show your appreciation for NAudio and support future development by donating.
Donate

Updated Wiki: Home

$
0
0

NAudio Overview

NAudio is an open source .NET audio and MIDI library, containing dozens of useful audio related classes intended to speed development of audio related utilities in .NET. It has been in development since 2001 and has grown to include a wide variety of features. While some parts of the library are relatively new and incomplete, the more mature features have undergone extensive testing and can be quickly used to add audio capabilities to an existing .NET application.

NAudio demo project showing an MP3 file playing:
naudiodemo.png

NAudio WPF Project showing waveform visualisation and spectrum analyser:
NAudioWPF.png

Latest News

For the latest news and more documentation on NAudio, visit Mark Heath's blog.
  • 19 Dec 2011 NAudio 1.5 Released. Read the release notes
  • 20 Apr 2011 NAudio 1.4 Released. Read the release notes
  • 15 Apr 2011 NAudio demo now shows how to select output devices (for WaveOut, DirectSound, WASAPI and ASIO), and can play 8 bit, 16 bit, 24 bit, and 32 bit float WAV files. Fixed a longstanding ASIO issue.
  • 7 Nov 2010 Major improvements to Mp3FileReader
  • 10 Oct 2009 Version 1.3 Released. Read the release notes
  • 20 Sep 2009 We are getting close to feature complete for 1.3. Last chance to get in any feedback on the API
  • 26 Aug 2009 WPF Waveform drawing demo project including FFT added
  • 28 Feb 2009 Lots of new stuff is being added and planned, so do check out the Source Code tab to have a sneak peak at what's coming in 1.3
  • 26 June 2008 Version 1.2 Released. Read the release notes

NAudio Features

  • Play back audio using a variety of APIs
    • WaveOut
    • DirectSound
    • ASIO (not currently working with all soundcards)
    • WASAPI (Windows Vista Core Audio)
  • Decompress audio from different Wave Formats
    • MP3 decode using ACM or DMO codec
    • AIFF
    • G.711 mu-law and a-law
    • ADPCM
    • G.722
    • Speex (using NSpeex)
    • SF2 files
    • Decode using any ACM codec installed on your computer
  • Record audio using WaveIn or WASAPI
  • Read and Write standard .WAV files
  • Mix and manipulate audio streams using a 32 bit floating mixing engine
  • Extensive support for reading and writing MIDI files
  • Full MIDI event model
  • Basic support for Windows Mixer APIs
  • A collection of useful Windows Forms Controls
  • Some basic audio effects, including a compressor

Projects Using NAudio

NAudio currently is used to support a number of audio related utilities, some of which may be moved to be hosted on CodePlex in the future. If you have used NAudio for a project, please get in touch so we can post it here.

More Info

For more information, please visit the NAudio Documentation Wiki

Donate

NAudio is a free open source project that is developed in personal time. You can show your appreciation for NAudio and support future development by donating.
Donate

New Post: hide application from windows volume mixer

$
0
0

I'm afraid I don't know how to do this, and it may not even be possible. You could try asking a WASAPI related question on StackOverflow

Mark

New Post: waveIn_DataAvailable handler is not triggered from windows service or console application !

$
0
0

ok I get it, thank u very much, its version 1.5.8 :)


New Post: waveIn_DataAvailable handler is not triggered from windows service or console application !

$
0
0

glad you've found it. I increment the third part of the number every time I release an NAudio build for any reason, and so it is not necessarily related to the prerelease number.

New Post: is it possible to record to mp3 file directly?

$
0
0

hi,

I am using WaveInEvent to record from microphone, and its recording files for now in wav format which is taking really huge size in hard disk, so is there any class or function or a way to save a file or bytes as mp3 directly instead of wav ??

 

 

thanks

New Post: is it possible to record to mp3 file directly?

$
0
0

the way to do this is to use lame.exe and do on the fly conversion by writing to stdin. I hope to do a blog post on this at some point.

Mark

New Post: is it possible to record to mp3 file directly?

$
0
0

ya, what I am doing now, I am saving records per hour, and then I am doing conversion of wav file using lame.exe, but really I dont think its good idea to save as wav then perform conversion, 

but the questions is, how to use stdin in c# and is there any changes required for WaveInEvent ?

New Post: Creating custom sound (Wave)

$
0
0

Hi!

 

I have been used this library sience 2 weeks and I have a problem. I have Wave sound, I check frequency for this and I would like to make my custom sound with the same simple frequency. Could you show me how can I make my own sound with different frequency (i found tutorial with infinity (long.MaxLength) time and only one frequency)?

 

Best Regards

Cookie Monster

Viewing all 5831 articles
Browse latest View live