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

Source code checked in, #94dd83be9967

$
0
0
Adding experimental interop for IMFTransform, IMFMediaElement, IMFCollection and IMFActivate plus supporting enums and structures in order to enable us to call MFTEnumEx (n.b. may temporarily break Win8 project)

Source code checked in, #04dc12d92312

$
0
0
added a change that should have been in the last commit

New Post: NAudio 1.6 - Wasapi Loopback COMException

$
0
0

when you call stoprecording, don't immediately dispose Wasapi and set it to nothing - that should be done in the RecordingStopped handler

New Post: NAudio 1.6 - Wasapi Loopback COMException

$
0
0

 

 

 

that's right,  i made slight modifications, the final code for those who write in VB.Net  is:

 

Imports naudio
Imports naudio.wave
Imports NAudio.CoreAudioApi


Public Class Form1
    Dim WithEvents Wasapi As WasapiLoopbackCapture
    Dim Writer As WaveFileWriter
    Dim mmdev As MMDeviceEnumerator
    Dim Audio As MMDevice



    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        mmdev = New MMDeviceEnumerator
        Audio = mmdev.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia)
        Wasapi = New WasapiLoopbackCapture(Audio)
        Writer = New WaveFileWriter("E:\4.wav", Audio.AudioClient.MixFormat)
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles ExitProgram.Click
        '''''
        If Writer IsNot Nothing Then
            Writer.Flush()
            Writer.Close()
            Writer.Dispose()
            Writer = Nothing
        End If

        ''''
        If Wasapi IsNot Nothing Then
            Wasapi.StopRecording()
            Wasapi.Dispose()
            Wasapi = Nothing
        End If

        ''''
        Application.Exit()
    End Sub

    Private Sub Wasapi_DataAvailable(sender As Object, e As WaveInEventArgs) Handles Wasapi.DataAvailable
        Writer.Write(e.Buffer, 0, e.BytesRecorded)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles StartRecording.Click
        If Wasapi IsNot Nothing Then
            Wasapi.StartRecording()
        End If
        ''''
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles StopRecording.Click
        If Wasapi IsNot Nothing Then
            Wasapi.StopRecording()
        End If
        ''


    End Sub

    Private Sub Wasapi_RecordingStopped(sender As Object, e As EventArgs) Handles Wasapi.RecordingStopped
        '''''
        If Writer IsNot Nothing Then
            Writer.Flush()
        End If

    End Sub

  
    Private Sub Button4_Click(sender As Object, e As EventArgs)
        If Wasapi IsNot Nothing Then

        End If
        ''
    End Sub
End Class

 

Source code checked in, #ec4cf3d7de55

$
0
0
added new MediaFoundation interfaces in to Win8 project

Source code checked in, #9360651233a5

$
0
0
stopped using ApplicationException

Source code checked in, #c08a312996ee

$
0
0
stopped using ASCII encoding, as not supported in Win 8, either use UTF8 or ByteEncoding utility

Source code checked in, #7697828a97ad

$
0
0
moving some obsolete classes out of NAudio.Utils (FileAssociations, ProgressEventArgs)

Source code checked in, #4136b5fba503

$
0
0
ability to enumerate MediaFoundation transforms. Example code added to WPF Demo

Source code checked in, #569799226a61

$
0
0
improved output for enumerating MFTs

New Post: NAudio Audio Playback

$
0
0

set the DeviceNumber property of WaveOut.

New Post: Need help with exception thrown by NAudio

$
0
0

Ok, initial tests with the suggested change seem to indeed have solved the problem.

I'll keep testing, but it's very promising!

Thanks for the help and keep up with the good work!

Created Issue: MediaFoundation Output Format Float [16375]

$
0
0
Hello,
Here is a modified version of MediaFounfationReader.

Modification for operation with WASAPI, ASIO, WaveOutEvent

I added an option :: The output format (WaveFormat) is PCM or IEEE

Compatible with the version NAudio 569799226a61

This version is still a prototype!

New Post: Multiple WaveIn MMException

$
0
0

Hi again,

I have changed the code and recorded from one input channel with WASAPI like RecordingPanel.cs. And then I have selected second microphone and recorded successfully with WASAPI. (changing deviceNumber on the second line below).

 

MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator(); //three devices listed
MMDevice wspidevice = deviceEnum.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active)[deviceNumber];//changed this line for every other device, respectively 0,1,2
waveIn = new WasapiCapture(wspidevice);

 

But again if I tried to record two inputs at the same time, same problem has been existed.

I think the problem is regardless of the method or objects used (traditional WaveIn, or WASAPI can't work without the soundcard drivers' ability).

The main problem is all about windows detection of souncards' channels. All input channels must be detected as a seperate device. 

Am I thinking true? Or in any case(regardless of the driver), if I use WASAPI, it should work?

Thanks again.

New Post: Multiple WaveIn MMException

$
0
0

Windows won't present the channels as separate devices unless the soundcard driver has set it up that way. The best way is to capture all your soundcard inputs at once, and route the captured audio separately within your program.


New Post: Multiple WaveIn MMException

$
0
0

MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator(); 
MMDevice wspidevice = DeviceEnum.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active) [deviceNumber];
waveIn = new WasapiCapture(wspidevice);
waveIn.DataAvailable += OnDataAvailable;
waveWriter = new WaveFileWriter(fileName, waveIn.WaveFormat);privatevoid OnDataAvailable(object sender, WaveInEventArgs e)
            {if (waveWriter == null) return;
                waveWriter.Write(e.Buffer, 0, e.BytesRecorded);
                waveWriter.Flush();
            }

I think that routing will be done in OnDataAvailable event, by checking sender object? Am I true, or is there an another way to do that?

New Post: Multiple WaveIn MMException

$
0
0

yes, your samples will come in interleaved. (one sample for channel 1, one sample for channel 2, one sample for channel 3) etc

New Post: Multiple WaveIn MMException

New Post: Multiple WaveIn MMException

$
0
0

so you could write code like this if you had an array of waveFileWriters one for each channel:

 

privatevoid OnDataAvailable(object sender, WaveInEventArgs e)
{
    int bytesPerSample = 2; //(for 16 bit, set to 4 forfloat)
    int offset = 0;
    while (offset < e.BytesRecorded)
    {
        for (int n = 0; n < channels; n++) 
        {
            waveFileWriter[n].Write(e.Buffer,offset,bytesPerSample);
            offset += bytesPerSample;
        }
    }
}

Source code checked in, #c547a182efd4

$
0
0
adding interop for IMFSinkWriter
Viewing all 5831 articles
Browse latest View live


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