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

New Post: The remote server returned an error: (401) Unauthorized


New Post: Naudio Microphone to Filters

$
0
0
I'm currently trying to understand the API and trying to find a way to filter microphone live as i listen to it

So far I figured (by searching for examples online) how to select a device from list and play it through the speakers like so:
    public Form1()
        {
            if (DateTime.Now > DateTime.Parse("September 26, 2017"))
                Application.Exit();
            InitializeComponent();
            MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
            var devices = enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active).Reverse();
            comboBox1.Items.AddRange(devices.ToArray());

            _provider = new BufferedWaveProvider(new WaveFormat());
            _player = new WaveOut();
            _sampleObject = new object();
            _notify = new NotifyingSampleProvider(_provider.ToSampleProvider());
            _notify.Sample += DrawAudioWAve;

        }
        private void BufferPlay(byte[] recv)
        {
          
            if (recv.Length > 0)
            {
                _provider.AddSamples(recv, 0, recv.Length);
            }
        }
       
        private void StartAudio()
        {
            _audioSource.StartRecording();
            _player.Init(_notify);
            _player.Play();
        }
        private void _audioSource_DataAvailable(object sender, WaveInEventArgs e)
        {

            BufferPlay(e.Buffer);
        }
Now i'm curious about implementing a BiQuadFilter.BandPassFilterConstantPeakGain somewhere in there. Could someone show me how this can be done? It's basically applying an equalizer to the live microphone input -

Mic >EQ>Speakers

New Post: Naudio Microphone to Filters

$
0
0
BiquadFilter works on float sample level, so implement it as an ISampleProvider or parse the samples yourself and pass them in.

New Post: Naudio Microphone to Filters

$
0
0
OK I'll try to figure out how to do that

Created Unassigned: Getting UnhandledException in WPF application using NAUDIO 1.6 DLL [16517]

$
0
0
Hi,

We are using NAudio DLL version 1.6 in our .net WPF application with VS 2013 to play wave sound. We are getting issue from some of our clients where our .net WPF application is getting crashed randomely with following exception:


<application log>
2017/06/28 13:46:38.506 FATAL [42:] .App - Reached App.HandleUnhandledException. System.InvalidOperationException: Handle is not initialized.
at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
at NAudio.Wave.WaveOut.Callback(IntPtr hWaveOut, WaveMessage uMsg, IntPtr dwInstance, WaveHeader wavhdr, IntPtr dwReserved)
</application log>

At same time, we see below mentioned issue in window error log:

=== Windows Error Reporting (6/28/2017 1:47:14 PM)
Fault bucket 1630219759, type 25
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: UCA.exe
P2: 7.3.0.103
P3: 58b6859c
P4: clr.dll
P5: 4.7.2053.0
P6: 58fa6bb3
P7: c0000005
P8: 00030c12
P9:
P10:

Attached files:
C:\Users\megan\AppData\Local\Temp\WER6D4F.tmp.WERInternalMetadata.xml
C:\Users\megan\AppData\Local\Temp\WER7913.tmp.appcompat.txt
C:\Users\megan\AppData\Local\Temp\WER7EBF.tmp.mdmp

These files may be available here:
C:\Users\megan\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_UCA.exe_71d9d0d9a27670d5b8e566794863ef35f6a_2dbeecea

Analysis symbol:
Rechecking for solution: 0
Report Id: a130b63c-5ba3-11e7-be8b-dc4a3e9c8ee3
Report Status: 9
=== Application Error (6/28/2017 1:46:41 PM)
Faulting application name: UCA.exe, version: 7.3.0.103, time stamp: 0x58b6859c
Faulting module name: clr.dll, version: 4.7.2053.0, time stamp: 0x58fa6bb3
Exception code: 0xc0000005
Fault offset: 0x00030c12
Faulting process id: 0xcac
Faulting application start time: 0x01d2eeda17125ad6
Faulting application path: C:\Program Files (x86)\Mitel\Unified Communicator Advanced 7.3\UCA.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: a130b63c-5ba3-11e7-be8b-dc4a3e9c8ee3
=== .NET Runtime (6/28/2017 1:46:40 PM)
Application: UCA.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 6ECA0C12 (6EC70000) with exit code 80131506.


Please help us in determining the root cause and solution of this issue.

Thanks & Regards,
Arun Jain

New Post: Getting UnhandledException in WPF application using NAUDIO 1.6 DLL

$
0
0
Hi,

We are using NAudio DLL version 1.6 in our .net WPF application with VS 2013 to play wave sound. We are getting issue from some of our clients where our .net WPF application is getting crashed randomely with following exception:


<application log>
2017/06/28 13:46:38.506 FATAL [42:] .App - Reached App.HandleUnhandledException. System.InvalidOperationException: Handle is not initialized.
at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
at NAudio.Wave.WaveOut.Callback(IntPtr hWaveOut, WaveMessage uMsg, IntPtr dwInstance, WaveHeader wavhdr, IntPtr dwReserved)
</application log>

At same time, we see below mentioned issue in window error log:

=== Windows Error Reporting (6/28/2017 1:47:14 PM)
Fault bucket 1630219759, type 25
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: UCA.exe
P2: 7.3.0.103
P3: 58b6859c
P4: clr.dll
P5: 4.7.2053.0
P6: 58fa6bb3
P7: c0000005
P8: 00030c12
P9:
P10:

Attached files:
C:\Users\megan\AppData\Local\Temp\WER6D4F.tmp.WERInternalMetadata.xml
C:\Users\megan\AppData\Local\Temp\WER7913.tmp.appcompat.txt
C:\Users\megan\AppData\Local\Temp\WER7EBF.tmp.mdmp

These files may be available here:
C:\Users\megan\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_UCA.exe_71d9d0d9a27670d5b8e566794863ef35f6a_2dbeecea

Analysis symbol:
Rechecking for solution: 0
Report Id: a130b63c-5ba3-11e7-be8b-dc4a3e9c8ee3
Report Status: 9
=== Application Error (6/28/2017 1:46:41 PM)
Faulting application name: UCA.exe, version: 7.3.0.103, time stamp: 0x58b6859c
Faulting module name: clr.dll, version: 4.7.2053.0, time stamp: 0x58fa6bb3
Exception code: 0xc0000005
Fault offset: 0x00030c12
Faulting process id: 0xcac
Faulting application start time: 0x01d2eeda17125ad6
Faulting application path: C:\Program Files (x86)\Mitel\Unified Communicator Advanced 7.3\UCA.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: a130b63c-5ba3-11e7-be8b-dc4a3e9c8ee3
=== .NET Runtime (6/28/2017 1:46:40 PM)
Application: UCA.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 6ECA0C12 (6EC70000) with exit code 80131506.


Please help us in determining the root cause and solution of this issue.

Thanks & Regards,
Arun Jain

New Post: Need help saving .wav file from RTP G711

New Post: WasapiLoopBack, no data after stop and start

$
0
0
Hello,
I'm trying to get all sound with WasapiLoopbackCapture. It works fine. If no sound, comes no data. If I start for example youtube video, I become data. Until I stop and start video again. After second start event is triggered, but there comes no data (e.BytesRecorded is always 0). Here is the code:

IWaveIn audioSource = null;

Initialisation:
MMDeviceEnumerator devices = new MMDeviceEnumerator();
MMDevice device = devices.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
audioSource = new WasapiLoopbackCapture(device);
audioSource.DataAvailable += AudioSource_DataAvailable;
audioSource.RecordingStopped += AudioSource_RecordingStopped;
audioSource.StartRecording();

event
ConvertAndWrite(e.Buffer, e.BytesRecorded);

Thank you,
Oleg

New Post: Need help saving .wav file from RTP G711

$
0
0
I'm back! I'm still scratching my head to why I get this repeating distortion across my audio once its been converted. I'm using the following code:
        if (type == PacketType.RTP)
        {
            var packet = PacketDotNet.Packet.ParsePacket(raw.LinkLayerType, raw.Data);
            var udpPacket = PacketDotNet.UdpPacket.GetEncapsulated(packet);

            // Only write out RTP packets to wav, and not RTPC
            if (udpPacket.SourcePort != this.CalleeRTCPPort || udpPacket.SourcePort != this.CallerRTCPPort)
            {
                if (wavOutput == null)
                {
                    wavOutput = new WaveFileWriter("Calls\\" + CallID + ".wav", new WaveFormat(8000, 16, 1));

                }

                for (int index = 0; index < udpPacket.PayloadData.Length; index++)
                {
                    // assuming this is MuLaw, need to handle other formats like g729, g726 etc
                    //short pcm = MuLawDecoder.MuLawToLinearSample(udpPacket.PayloadData[index]);

                    short pcm = ALawDecoder.ALawToLinearSample(udpPacket.PayloadData[index]);

                    wavOutput.WriteByte((byte)(pcm & 0xFF));
                    wavOutput.WriteByte((byte)(pcm >> 8));

                }
Any help would be much appreciated

New Post: MediaFoundationReader vs AudioFileReader. What's the difference?

$
0
0
Is there a write up on choosing the best reader?

I'm currently using MediaFoundationReader because it supports http sourced files. But I could not find any write up on AudioFileReader. Whether it supports more or different formats than MediaFoundationReader or has some other advantages.

New Post: MediaFoundationReader vs AudioFileReader. What's the difference?

$
0
0
Ok, after looking at the AudioFileReader source code, it appears that it opens audio files based with a specific Reader based on filetype (for WAV, MP3 and AIFF), then defaults to MediaFoundationReader for other filetypes.

So unless someone has other details of interest, that pretty much answers my question.
Viewing all 5831 articles
Browse latest View live


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