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
5
votes
1 answer

NAudio Convert Byte Array to Wav

I looked into NAudio classes but couldn't see a class that converts byte array to WAV file. If there is no class like this, how can I convert byte array to WAV file using NAudio? I want to send a text to RS232 as bytes, then I will get back those…
Blast
  • 955
  • 1
  • 17
  • 40
5
votes
4 answers

What determines the order for sound devices in windows when using winmm.dll?

I am trying to use NAudio to create a multiple sound output application. We have 8 USB sound cards installed. NAudio lets me use all 8 but I can't figure out a pattern for determining which device index is which card. The cards will be hooked up…
Robin Robinson
  • 1,595
  • 1
  • 20
  • 24
5
votes
2 answers

Using NAudio for .NET how do I remove the silence wave at the end of mp3 file?

I am working on a C# WPF application that groups a group of words (from about 17,000 words) together and generates a playlist matching mp3 files (each mp3 file being a word). Currently each mp3 file has a random silence between 1 second to 30…
user677607
5
votes
3 answers

Saving each WAV channel as a mono-channel WAV file using Naudio

I'm trying to convert a WAV file(PCM,48kHz, 4-Channel, 16 bit) into mono-channel WAV files. I tried splittiing the WAV file into 4 byte-arrays like this answer and created a WaveMemoryStream like shown below but does not work. byte[] chan1ByteArray…
CharlesBryan
  • 181
  • 1
  • 16
5
votes
1 answer

NAudio - pause, then resume

Why sometimes after waveOut.Pause when I do waveOut.Resume audio starts stuttering very bad?
apocalypse
  • 5,764
  • 9
  • 47
  • 95
5
votes
1 answer

NAudio WaveStream and multiple channels

I have a WaveStream, and I can read WaveFormat to obtain number of channels. When I read from that WaveStream am I reading the first channel or data from all the channels mixed? I want to do a user control to display WaveForm, but I'm not sure if my…
apocalypse
  • 5,764
  • 9
  • 47
  • 95
4
votes
1 answer

NAudio MeteringSampleProvider not firing events?

From all the samples I've seen using NAudio's MeteringSampleProvider to update a VolumeMeter control, I think I've got the right code, but it seems that the event for the MeteringSampleProvider as well as the SampleChannel never fire. I'm writing…
Redth
  • 5,464
  • 6
  • 34
  • 54
4
votes
0 answers

WasapiLoopbackCapture is receiving silence on some devices when speakers are muted

I am using NAudio library and recording "what you hear" using its WasapiLoopbackCapture in a very simplistic way: var outputFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "NAudio"); …
forlayo
  • 1,371
  • 2
  • 13
  • 23
4
votes
3 answers

How to Change Playback Speed using NAudio C#

I am implementing a Media Player and using NAudio to play my files. Is there any way to increase the playback speed like (2X or 4X) while the sound is playing. Code samples will be appreciated. Thanks in Advance Cheers.
wahab mehboob
  • 303
  • 1
  • 6
  • 11
4
votes
1 answer

C# get frequency spectrum lines of a .wav file

i want to display the frequency spectrum of a .wav (or .mp3) file. I stuck a little bit now and cant find anything good. I use C# with naudio nuget to handle the audio data and oxyplot to display the points (and the…
tuke307
  • 411
  • 5
  • 13
4
votes
1 answer

WasapiLoopbackCapture internal audio recognition gives jibberish and text when no audio

I finally have built a program to listen to the internal audio loopback using NAudio, and output recognized text. The problem is it listens, and always says, eg: Recognized text: had Recognized text: had Recognized text: had Recognized text:…
NoBugs
  • 9,310
  • 13
  • 80
  • 146
4
votes
1 answer

Can I use NAudio to record audio in a Blazor app?

In a dotnetcore 3.0 Blazor app I want to be able to record audio using NAudio, instead of implementing an HTML5 control in Javascript. Does NAudio support this? I have already tried the sample code below. I am getting a 0 byte wave file written to…
4
votes
2 answers

Process confliction C#

I have the following code: while (condition == true) { //First part using (var stream = File.Create(audioPath)) { using (WaveFileWriter writer = new WaveFileWriter(stream, waveFormat)) { …
Harry Stuart
  • 1,781
  • 2
  • 24
  • 39
4
votes
2 answers

How to Add NAudio to my Project?

so, sorry if this is a stupid question, but I've been working with audio a lot, and I'm going to try out NAudio, so I went to the website (which, by the way, is blocked in Chrome), and downloaded it. Then I searched and searched through the files.…
Jumanji
  • 51
  • 1
  • 4
4
votes
1 answer

NAudio converting samples buffer to wave buffer

My goal - to make processing and playback of audio data in real-time by NAudio. The application uses different formats: 8bit pcm, 16bit pcm, 24bit pcm. For playback, I use WaveOut and BufferedWaveProvider. The difficulty arises with the processing…
SolderingIronMen
  • 554
  • 1
  • 5
  • 20