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
103
votes
10 answers

Play audio from a stream using C#

Is there a way in C# to play audio (for example, MP3) direcly from a System.IO.Stream that for instance was returend from a WebRequest without saving the data temporarily to the disk? Solution with NAudio With the help of NAudio 1.3 it is possible…
Martin
  • 10,738
  • 14
  • 59
  • 67
27
votes
6 answers

Stream wrapper to make Stream seekable?

I have a readonly System.IO.Stream implementation that is not seekable (and its Position always returns 0). I need to send it to a consumer that does some Seek operations (aka, sets the Position) on the stream. It's not a huge seek -- say +/- 100…
Brannon
  • 5,324
  • 4
  • 35
  • 83
16
votes
1 answer

naudio record sound from microphone then save

I'm having some issues with naudio and saving sound recordings. The code I currently have works to the point where it saves the wav file, but when I open it up, Windows Media Player returns an error: "Windows Media Player encountered a problem while…
Spencer
  • 612
  • 2
  • 12
  • 26
16
votes
2 answers

Enumerate Recording Devices in NAudio

How can you get a list of all the recording devices on a computer using NAudio? When you want to record, you have to give it the index of the device you want to use, but there's no way of knowing what device that is. I'd like to be able to select…
Adam Haile
  • 30,705
  • 58
  • 191
  • 286
15
votes
7 answers

change format from wav to mp3 in memory stream in NAudio

Hi there iam trying to convert text to speech (wav) in the memorystream convert it to mp3 and then play it on the users page.so need i help what to do next? here is my asmx code : [WebMethod] public byte[] StartSpeak(string Word) { …
user2431114
  • 361
  • 3
  • 8
  • 19
13
votes
5 answers

NAudio to split mp3 file

I am very new to audio or mp3 stuff, was looking for a way to have a feature to split an mp3 file in C#, asp.net. After googling for a good 3-day without much of a great help, I am hoping that somebody here can point me to a right direction. Can I…
joe kirk
  • 700
  • 2
  • 10
  • 25
13
votes
3 answers

How to play a MP3 file using NAudio

WaveStream waveStream = new Mp3FileReader(mp3FileToPlay); var waveOut = new WaveOut(); waveOut.Init(waveStream); waveOut.Play(); This throws an exception: WaveBadFormat calling waveOutOpen The encoding type is "MpegLayer3" as NAudio. How can I…
Rookian
  • 19,841
  • 28
  • 110
  • 180
12
votes
1 answer

NAudio pitch shifting

I am using the NAudio DLL and I am looking for example code for pitch shifting sound.
mehdiattar
  • 121
  • 1
  • 3
12
votes
3 answers

Record live audio from mic input and save simultanously

I was trying to develop a Voice recorder in C#. I have tried many ways, like NAudio, DirectX, Microsoft.Xna.Framework.Audio, etc. Everything gives the same result. After we stop the recording, the output file mp3/wav get saved. The mp3/wav file get…
12
votes
2 answers

How do I create a seekbar in C#\NAudio Music Player?

I am new to both NAudio and C# and I managed to create a simple MP3 player where you can choose a file and play it. It also has a play/pause button. I would now like to add a seek bar but have no clue on how to do this. Also is it possible to have…
GunJack
  • 1,928
  • 2
  • 22
  • 35
11
votes
3 answers

Detecting beats in a song

I'm working on a project which requires me to add beat detection when a song is playing in the application (WinForms - C#). I'm currently using NAudio.NET for playing the song & displaying details about the song. Is there a library that would allow…
MisdartedPenguin
  • 258
  • 1
  • 2
  • 12
10
votes
4 answers

Precision timing in .NET

I've just seen this question, where one of the answers indicates that System.Diagnostics.Stopwatch should only be used for diagnosing performance and not in production code. In that case, what would be the best way to get precision timing in .NET?…
geofftnz
  • 9,954
  • 2
  • 42
  • 50
9
votes
2 answers

Record input from NAudio WaveIn, and output to NAudio WaveOut

I want to be able to get input from a microphone device via NAudio.WaveIn, and then output that exact input to an output device via NAudio.WaveOut. How would I do this?
Joshua Coffey
  • 320
  • 2
  • 3
  • 8
9
votes
3 answers

How to record audio with WasapiLoopbackCapture when no voice is coming out from speaker in c#?

The below is my sample code to record audio coming from a speaker. It is working fine. But it is recording audio only when some audio is coming out from speaker. If there is no audio then it is not recording. Actually i am doing screen recording…
9
votes
2 answers

How to difference headphones from integrated audio in PC

I am using amazing NAudio framework to get the list of the audio devices. But as I see is impossible difference which audio device is PC's integrated audio and which is a headphones. I mean they have the same name and only if we plug the headphones…
NoWar
  • 36,338
  • 80
  • 323
  • 498
1
2 3
99 100