Questions tagged [naudio]

NAudio is an open source audio library for .NET, supporting audio playback, recording and sample manipulation as well as reading and writing various audio file formats.

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 2002 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 can be quickly added to your .NET application using NuGet.

Features:

  • Play back audio using a variety of APIs
  • WaveOut
  • DirectSound
  • ASIO
  • WASAPI (Windows Vista and above)
  • 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, WASAPI or ASIO
  • 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

Official Website: http://naudio.codeplex.com/

Official Website on github: https://github.com/naudio/NAudio

Useful Links:

FAQ:

1557 questions
6
votes
3 answers

How do can I use LAME to encode an wav to an mp3 c#

I am currently using NAudio to capture the sound and it only creates a wav file. I am looking for a way to encode it to an mp3 before saving the file. I found LAME but when ever i try to add the lame_enc.dll file it says "A reference could not be…
user2843871
  • 61
  • 1
  • 1
  • 2
6
votes
2 answers

.Net How to play audio samples directly

I have audio samples extracted through NAudio, i know parameters: channels bytes per sample, samplerate How to play that samples by using .Net api / or other .Net library Here code: openFileDialog1.ShowDialog(); using (var reader = new…
testCoder
  • 7,155
  • 13
  • 56
  • 75
6
votes
1 answer

MonoDevelop + NAudio + Ubuntu Linux tells me Winmm.dll not found?

So I'm attempting to use MonoDevelop with NAudio and Ubuntu Linux, For some reason It errors saying that winmm.dll isn't found so I attempted to download it and and the "Add Reference" dialogue claims its not a valid .NET library. Here is my…
Xenland
  • 510
  • 1
  • 6
  • 19
6
votes
3 answers

Spectrum Analyzer with NAudio & WPFSoundVisualizationLib

I'm working on a C#4.0/WPF Real time Spectrum Analyser (as a base of another project). I use NAudio last version to get real time audio output on sound card, and WPFSoundVisualizationLib (http://wpfsvl.codeplex.com/) for the Spectrum Analyser WPF…
Floyd
  • 363
  • 1
  • 4
  • 11
6
votes
3 answers

Naudio,how to tell playback is completed

I am using the NAudio library to write a simple WinForms audio recorder/player. My problem is how can I tell that playback is completed? I need to close the wave stream after that. I knew there is a PlaybackStopped event listed below: wfr = new…
Steven Du
  • 1,681
  • 19
  • 35
5
votes
3 answers

NAudio looping an audio file

I already have the code of the mp3/wma audio playing/stopping and browsing. I just need to know how can I loop the song? Thank you.
user1139211
  • 115
  • 1
  • 2
  • 5
5
votes
2 answers

Delay (approx 200 ms) in streamed audio playback

I have an application which plays the streamed audio data (like a chat client). The workflow involves three simple steps: The file header info (sample rate, bits per sample and num of channels) is sent first. Audio waveout device is initialized…
Vikram.exe
  • 4,565
  • 3
  • 29
  • 40
5
votes
1 answer

Naudio: How to play MP3 and WAV file?

Okay, I know this sounds like a very easy question to some but I am really stuck here. Indeed, I am building an audio player using Naudio and I have realized that in many tutorials people always show easy ways to get you started. However, in my…
Dillion Ecmark
  • 704
  • 3
  • 10
  • 23
5
votes
1 answer

Analyzing audio to create Guitar Hero levels automatically

I'm trying to create a Guitar-Hero-like game (something like this) and I want to be able to analyze an audio file given by the user and create levels automatically, but I am not sure how to do that. I thought maybe I should use BPM detection…
Symbol
  • 145
  • 3
  • 10
5
votes
1 answer

NAudio - How to send sine wave only to one audio channel on jack

I took an existing mono (non-stereo) NAudio example for Visual Studio 2010 from: http://mark-dot-net.blogspot.com/2009/10/playback-of-sine-wave-in-naudio.html and changed it to have two channel stereo audio as shown below: public abstract class…
5
votes
1 answer

NAudio's BufferedWaveProvider gets full when recording and mixing an audio

I'm having an issue with a BufferedWaveProvider from NAudio library. I'm recording 2 audio devices (a microphone and a speaker), merge them into 1 stream and send it to an encoder (for a video). To do this, I do the following: Create a thread where…
Veler
  • 161
  • 2
  • 13
5
votes
2 answers

How to insert a silence of specific duration at an arbitrary position of a MP3 file?

Scenario I have a bunch of MP3 files which some have a constant bit-rate, others have variable bitrate, some are encoded at 128 kbps, some at other bitrate, some are stereo and some are joint stereo. All are at 44,100 khz In order to automate a task…
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
5
votes
0 answers

Bad types trying to use audio recognition loopback

The Microsoft Speech system has a good example code, but I have a problem when adding loopback to record what it is playing not what is coming through mic. To give text description of a video for example while not playing it on the speaker. It seems…
NoBugs
  • 9,310
  • 13
  • 80
  • 146
5
votes
2 answers

Detect headphones in Windows

I'm trying to detect if the headphones are plugged in on Windows. I've already tried DirectSound and the NAudio library and have not had any success. Does anyone have any suggestions? NOTE: this question is a duplicate of this question, but the…
Izzy Rodriguez
  • 2,097
  • 3
  • 21
  • 32
5
votes
1 answer

How to convert wav file to mp3 in memory?

I have an application written using c# on the top of Asp.Net MVC 5 framework. My objective is to make a call to 3rd party service to download a wave file. Then I want to convert this file into mp3. Finally, I want to return the mp3 file as (byte[])…
Junior
  • 11,602
  • 27
  • 106
  • 212