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

New Post: How to detect silence?

$
0
0
Good day!
Can NAudio detect silence with some simple Api way?
Or, may be some peace of code.

Thank you!

New Post: Play Audio File on InputDevice (Microphone)

$
0
0
You could try this one

Making a custom one would be a lot of work, as it involves creating a Windows Device Driver

New Post: MixingSampleProvider to Output

$
0
0
that's a bit more tricky. You'd want to create a custom pausing sampleprovider that returns silence from the Read method while a channel is paused. That way the mixing sample provider can keep reading from all its inputs, but will get silence from the paused ones.

New Post: Unmanaged memory keeps growing

$
0
0
The nature of .NET is that it has a garbage collector. so just because memory is growing, doesn't necessarily mean there is a leak.
You could try a simple test to see if it is the AudioFileReader by writing an app that repeatedly opens an MP3 file, reads it to the end, and disposes it. That would fairly quickly reveal if there is a memory leak in the ACM interop somewhere.

New Post: Pipe audio between separate applications/processes

$
0
0
I'm not aware of any built-in facility to do this. You'd need to come up with your own solution, pipes, shared memory, sockets etc

New Post: Unmanaged memory keeps growing

$
0
0
The MSACM32.dll memory usage is Unmanaged so the .NET garbage collector will not manage that memory. It has to be explicitly allocated and freed by the code using it.

Also, when I take a memory snapshot the profiler triggers a full garbage collection before taking the snapshot. I just took another snapshot and MSACM32.dll is now using 73MB after 4 days.

I will look into creating a test program, but that will take a few days due to my schedule.

Thanks for the response.

New Post: AsioSampleType

$
0
0
Hi! Do I understand right that AsioSampleType is the same as bit depth of my soundcard?
If yes, is it possible to get an AsioSampleType not in the AudioAvailable method?

The essence of my problem: In description of my soundcard says that one supports 24-bit and 32-bit, but that can't be changed in control panel of soundcard. I tried to change it in WIndows audio settings (deffault is 24-bit), but it automacally changing to deffault state (24-bit). AsioSampleType return Int32LSB and I have to manipulate with 32-bit audio, because only that works well. So, I can't undarstand anything.

New Post: How to detect silence?

$
0
0
Easiest way is probably to check each sample processed for being 0 = silence.

E.g. create a custom SampleProvider that raises an event each time a sample passed is zero.

New Post: Unmanaged memory keeps growing

$
0
0
If MSACM32.dll is the problem, then the problem is for sure in the MP3FileReader that uses ACM codecs installed on your OS.

If you can´t fix this unmanaged issue, you should give https://nlayer.codeplex.com/ a chance, which is fully managed.

New Post: Unmanaged memory keeps growing

$
0
0
are you definitely disposing all your AudioFileReader instances?

New Post: AsioSampleType

$
0
0
This most likely means a 24 bit sample is being stored in a 32 bit integer. Most ADCs don't have much more than 20 bit resolution anyway.

Updated Wiki: Home

$
0
0

NAudio Overview

IMPORTANT The latest NAudio source code can now be found on GitHub. For now, CodePlex remains the place to access documentation, discussions and downloads.

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.

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.
  • 24 Nov 2014 NAudio 1.7.2 Released with lots of minor enhancements and bugfixes
  • 4 Nov 2013Programming Audio with NAudio training course released on Pluralsight
  • 29 Oct 2013 NAudio 1.7 Released. Read the release notes
  • 26 Oct 2012 NAudio 1.6 Released. Read the release notes
  • 9 Sep 2012 ASIO Recording Support added
  • 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
    • 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

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.
  • Skype Voice Changer - Modify your voice with audio effects while talking on Skype
  • .NET Voice Recorder - Record your voice, save to MP3, and visualise the waveform using WPF. Now includes autotune
  • Pree - Record spoken word without the need for editing.
  • MIDI File Mapper - Utility for mapping MIDI drum files for use on other samplers
  • MIDI File Splitter - Split MIDI files up at their markers
  • SharpMod - managed port of MikMod, can play mod files in both WinForms and Silverlight
  • NVorbis - Fully managed Vorbis decoder, with support for NAudio
  • Practice# - Windows tool for practicing playing an instrument with playback music. Includes FLAC playback support and an equaliser for NAudio.
  • WPF Sound Visualization Library - beautiful waveform and spectrum analyzer code written for WPF, comes with NAudio sample
  • Q2Cue - application for running audio cues in a theatrical or other performance related settings
  • TuneBlade - Stream Windows' audio to AirPlay receivers
  • Teachey Teach - utility to help English language conversation teachers generate feedback for students
  • Sound Mill - an audio player, list organizer and automation manager
  • Bravura Studio - a modular, extensible application and platform for creating and experimenting with music and audio.
  • musiX
  • SIPSorcery - .NET softphone framework
  • Squiggle - A free open source LAN Messenger
  • Helix 3D toolkit - Multi-format audio player
  • airphone-tv - A revival of axStream to implement control through the iPhone
  • JamNet - a Silverlight drum sample player
  • Jingle Jim - Jingle Software (German language)
  • All My Music
  • iSpy - Open Source Camera Security Software
  • RadioTuna - Online internet radio player
  • Fire Talk New - chat program
  • AVR Audio Guard - utility to fix a HDMI related issue
  • Locutor da Hora - Educational app simulating a radio studio

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: NAudio WinRT sample app stops working after few seconds

$
0
0
Hi,

I'm using NAudio WinRT sample app to play .wav file. On one PC it works fine, but on the other one, audio stops playing after few seconds. I've tried changing the .wav file but issue still persists. Any help will be appreciated.

New Post: Unmanaged memory keeps growing

$
0
0
Yes, all AudioFileReader are getting disposed of after they finish reading. I used the memory profiler to verify that there is only one AudioFileReader live instance when my application is playing audio. When no audio is playing there are no live instances of AudioFileReader.

Instead of using AudioFileReader I switched to MediaFoundationReader and memory usage does not seem to be growing after two days. I do loose XP support, but that's not a huge issue. I will keep testing MediaFoundationReader and see if the memory usage grows.

New Post: Read audio samples from a wav file

$
0
0
Hi,

I was wondering, are you able to obtain all the samples from a wav file, to do filtering of samples in naudio? How would you obtain all the samples from a wav file and put them into a 16bit float array?

New Post: Get Jack Information of Audio Device

$
0
0
Is it possible to get Jack Information of Audio Device using NAudio?
My Question
Thank you!

New Post: Read audio samples from a wav file

$
0
0
Source chain needed: AudioFileReader -> ToSampleProvider -> Read method (recieve samples into buffer)

This buffer contains a packet of samples, that u can pass to other functions then.

10s google and u could have achived this on your own...

New Post: How to detect silence?

$
0
0
I want to save the captured mic sound to different wave files by splitting the sound by silence
  1. Can I identify the silence immediately, once volume samples become 0 or do I need to check the 0 for some period of time (ex 2 sec silence time)?
  2. What is the best way to identify the silence, when there are background noise?
Thank you.

New Post: How to detect silence?

$
0
0
1) Yes, you should check for at least some ms of audio. Because from time to time audio contains some zero crossings that would lead to false detection.
2) Either filter out the noise (e. g. cut a specified peak amaount) or calculate it in. As (white) noise contains all frequencies, you can´t easily filter out out by an eq or sth.

New Post: Network chat between regular C# and Raspberry Pi 2 using NAudio

$
0
0
Hi,

I am having problems attempting to create network chat between a regular C# console app using naudio and a raspberry pi 2 using the NAudio universal library. Right now I am just trying to get it to go from the Raspberry pi to the C# console app.

I believe my issue is in my limited understanding of which codecs are actually the same between the two. My network communication is successful however I hear only static for a few seconds then a buffer overflow error.

The following is my code on the RPi:
        public void record()
        {

            if (recorder == null)
            {
                recorder = new WasapiCaptureRT();
                recorder.DataAvailable += RecorderOnDataAvailable;
            }

            if (reader != null)
            {
                reader.Dispose();
                reader = null;
            }
            recorder.StartRecording();
           
        }

        private async void RecorderOnDataAvailable(object sender, WaveInEventArgs waveInEventArgs)
        {
            if (reader == null)
            {
                recordStream = new MemoryStream();
                reader = new RawSourceWaveStream(recordStream, recorder.WaveFormat);

            }
                writer.WriteBytes(waveInEventArgs.Buffer);
                await writer.StoreAsync();
            
                
           
        }
And on the C# app:
     public void test()
        {
            udpListener = new UdpClient(listenPort);
            IPEndPoint groupEP = new IPEndPoint(IPAddress.Any, listenPort);
            var _format = WaveFormat.CreateIeeeFloatWaveFormat(44100,1);


            waveOut = new WaveOut();
            waveProvider = new BufferedWaveProvider(_format);
            waveProvider.BufferDuration = new TimeSpan(1,0,0);
            waveOut.Init(waveProvider);
            waveOut.Play();
            connected = true;
            var state = new ListenerThreadState { EndPoint = groupEP };
            ThreadPool.QueueUserWorkItem(ListenerThread, state);
        }

        private void ListenerThread(object state)
        {
            var listenerThreadState = (ListenerThreadState)state;
            var endPoint = listenerThreadState.EndPoint;
            try
            {
                while (connected)
                {
                    byte[] b = udpListener.Receive(ref endPoint);
                    waveProvider.AddSamples(b, 0, b.Length);

                }
            }
            catch (SocketException)
            {
                // usually not a problem - just means we have disconnected
            }
        }
Any help would be appreciated!

Thanks,
Dan
Viewing all 5831 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>