Quantcast
Channel: naudio Work Item Rss Feed
Viewing all 738 articles
Browse latest View live

Created Unassigned: WaveFormatConversionStream class attempting to reference a null pointer... [16430]

$
0
0
Greetings all,

I am using 1.7 to play around with WaveOut Audio using the Event callback mechanism.

Whenever I exit out of the demo while audio is playing the Visual Studio is raising an unhandled exception error. When I look further into it I have found that the WaveFormatConversionStream class is attempting to access either "sourceStream" or "conversionStream" and both of these members are null. I think it has to do with closing the demo window (using the red "X" in the upper right corner) while audio is playing because if I stop the audio first (click on the square block) then there are no exceptions raised. I am going to guess that these exceptions go unnoticed if you are not running under Visual Studio.

To reproduce:

1. Load the NAudio.sln in VS2010.
2. Set the NAudioDemo project as the Startup Project.
3. Be building and running in "Debug" mode.
4. Hit "F5" to kick things off.
5. Select "Audio File Playback" and press Load.
6. Select "Event" "Callback Mechanism:" and start playing a .wav file.
7. Click on the red "X" in the upper right hand corner to close NAudio Demo.

Edited Unassigned: WaveFormatConversionStream class attempting to reference a null pointer... [16430]

$
0
0
Greetings all,

I am using 1.7 to play around with WaveOut Audio using the Event callback mechanism.

Whenever I exit out of the demo while audio is playing Visual Studio is raising an unhandled exception error. When I look further into it I have found that the WaveFormatConversionStream class is attempting to access either "sourceStream" or "conversionStream" and both of these members are null. I think it has to do with closing the demo window (using the red "X" in the upper right corner) while audio is playing because if I stop the audio first (click on the square block) then there are no exceptions raised. I am going to guess that these exceptions go unnoticed if you are not running under Visual Studio.

To reproduce:

1. Load the NAudio.sln in VS2010.
2. Set the NAudioDemo project as the Startup Project.
3. Be building and running in "Debug" mode.
4. Hit "F5" to kick things off.
5. Select "Audio File Playback" and press Load.
6. Select "Event" "Callback Mechanism:" and start playing a .wav file.
7. Click on the red "X" in the upper right hand corner to close NAudio Demo.

Commented Unassigned: WaveFormatConversionStream class attempting to reference a null pointer... [16430]

$
0
0
Greetings all,

I am using 1.7 to play around with WaveOut Audio using the Event callback mechanism.

Whenever I exit out of the demo while audio is playing Visual Studio is raising an unhandled exception error. When I look further into it I have found that the WaveFormatConversionStream class is attempting to access either "sourceStream" or "conversionStream" and both of these members are null. I think it has to do with closing the demo window (using the red "X" in the upper right corner) while audio is playing because if I stop the audio first (click on the square block) then there are no exceptions raised. I am going to guess that these exceptions go unnoticed if you are not running under Visual Studio.

To reproduce:

1. Load the NAudio.sln in VS2010.
2. Set the NAudioDemo project as the Startup Project.
3. Be building and running in "Debug" mode.
4. Hit "F5" to kick things off.
5. Select "Audio File Playback" and press Load.
6. Select "Event" "Callback Mechanism:" and start playing a .wav file.
7. Click on the red "X" in the upper right hand corner to close NAudio Demo.
Comments: good spot. The AudioPlaybackPanel should not really be trying to reposition the file after it has been disposed. But I could add some protection into AudioFilePlayer as well

Commented Unassigned: Wrong BitsPerSample with WasapiLoopbackCapture [16401]

$
0
0
Hello

I have a 24 bits per sample / 192kHz sound board and I am using the Wasapi Loopback Capture method to get data from it.

When I print out the capabilities of the board, it shows 32 bits per sample instead of 24 bits per sample...

```
private void button2_Click(object sender, EventArgs e)
{
waveIn = new WasapiLoopbackCapture();
waveIn.DataAvailable += OnDataAvailable;
waveIn.RecordingStopped += OnRecordingStopped;
waveIn.StartRecording();

Console.WriteLine(waveIn.WaveFormat.BitsPerSample);
Console.WriteLine(waveIn.WaveFormat.AverageBytesPerSecond);
Console.WriteLine(waveIn.WaveFormat.Channels);
Console.WriteLine(waveIn.WaveFormat.SampleRate);
Console.WriteLine(waveIn.WaveFormat.Encoding);
}
```

Which prints out...

```
32
1536000
2
192000
Extensible
```

If I check the e.Buffer data that the callback delivers, I see that most of the bytes have data indeed, but I was hoping to see 3 bytes with data and then an empty byte (24 bits and a spare byte), but all bytes have data.

So, how should I merge those bytes and in which order?

The Audio Board specs are:

Realtek Semiconductor Corp.
Audio driver 6.0.1.5919
DirectX 11.0
ALC889A

Thanks!
Comments: Linketo, what do you mean by " ata[] contains the left and right channels, make sure to separate them in your application." why do you have to separate them? how would you separate them?

Commented Unassigned: Wrong BitsPerSample with WasapiLoopbackCapture [16401]

$
0
0
Hello

I have a 24 bits per sample / 192kHz sound board and I am using the Wasapi Loopback Capture method to get data from it.

When I print out the capabilities of the board, it shows 32 bits per sample instead of 24 bits per sample...

```
private void button2_Click(object sender, EventArgs e)
{
waveIn = new WasapiLoopbackCapture();
waveIn.DataAvailable += OnDataAvailable;
waveIn.RecordingStopped += OnRecordingStopped;
waveIn.StartRecording();

Console.WriteLine(waveIn.WaveFormat.BitsPerSample);
Console.WriteLine(waveIn.WaveFormat.AverageBytesPerSecond);
Console.WriteLine(waveIn.WaveFormat.Channels);
Console.WriteLine(waveIn.WaveFormat.SampleRate);
Console.WriteLine(waveIn.WaveFormat.Encoding);
}
```

Which prints out...

```
32
1536000
2
192000
Extensible
```

If I check the e.Buffer data that the callback delivers, I see that most of the bytes have data indeed, but I was hoping to see 3 bytes with data and then an empty byte (24 bits and a spare byte), but all bytes have data.

So, how should I merge those bytes and in which order?

The Audio Board specs are:

Realtek Semiconductor Corp.
Audio driver 6.0.1.5919
DirectX 11.0
ALC889A

Thanks!
Comments: the samples are interleaved left, right, left, right. So bytes 0,1,2,3 are left sample, 4,5,6,7 are a right sample, and so on.

Commented Unassigned: WaveFormatConversionStream class attempting to reference a null pointer... [16430]

$
0
0
Greetings all,

I am using 1.7 to play around with WaveOut Audio using the Event callback mechanism.

Whenever I exit out of the demo while audio is playing Visual Studio is raising an unhandled exception error. When I look further into it I have found that the WaveFormatConversionStream class is attempting to access either "sourceStream" or "conversionStream" and both of these members are null. I think it has to do with closing the demo window (using the red "X" in the upper right corner) while audio is playing because if I stop the audio first (click on the square block) then there are no exceptions raised. I am going to guess that these exceptions go unnoticed if you are not running under Visual Studio.

To reproduce:

1. Load the NAudio.sln in VS2010.
2. Set the NAudioDemo project as the Startup Project.
3. Be building and running in "Debug" mode.
4. Hit "F5" to kick things off.
5. Select "Audio File Playback" and press Load.
6. Select "Event" "Callback Mechanism:" and start playing a .wav file.
7. Click on the red "X" in the upper right hand corner to close NAudio Demo.
Comments: Sounds good Mark. I would think that the WaveFormatConversionStream class itself should check for this condition and either take alternative action or raise an explicit exception. Allowing the null pointer access exception seems like the wrong thing to do to me. Just my two cents, your mileage may vary. Thanks again for letting me know what was going on. Marc

Commented Unassigned: Wrong BitsPerSample with WasapiLoopbackCapture [16401]

$
0
0
Hello

I have a 24 bits per sample / 192kHz sound board and I am using the Wasapi Loopback Capture method to get data from it.

When I print out the capabilities of the board, it shows 32 bits per sample instead of 24 bits per sample...

```
private void button2_Click(object sender, EventArgs e)
{
waveIn = new WasapiLoopbackCapture();
waveIn.DataAvailable += OnDataAvailable;
waveIn.RecordingStopped += OnRecordingStopped;
waveIn.StartRecording();

Console.WriteLine(waveIn.WaveFormat.BitsPerSample);
Console.WriteLine(waveIn.WaveFormat.AverageBytesPerSecond);
Console.WriteLine(waveIn.WaveFormat.Channels);
Console.WriteLine(waveIn.WaveFormat.SampleRate);
Console.WriteLine(waveIn.WaveFormat.Encoding);
}
```

Which prints out...

```
32
1536000
2
192000
Extensible
```

If I check the e.Buffer data that the callback delivers, I see that most of the bytes have data indeed, but I was hoping to see 3 bytes with data and then an empty byte (24 bits and a spare byte), but all bytes have data.

So, how should I merge those bytes and in which order?

The Audio Board specs are:

Realtek Semiconductor Corp.
Audio driver 6.0.1.5919
DirectX 11.0
ALC889A

Thanks!
Comments: Yeap, as Mark says the samples come in that way. This is the function I used to sum both channels into one signal. ``` /// <summary> /// This is called when audio samples are ready /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnDataAvailable(object sender, WaveInEventArgs e) { Int32 sample_count = e.BytesRecorded / (waveIn.WaveFormat.BitsPerSample / 8); Single[] data = new Single[sample_count]; for (int i = 0; i < sample_count; ++i) { data[i] = BitConverter.ToSingle(e.Buffer, i * 4); } int j = 0; Audio_Samples = new Double[sample_count / 2]; for (int sample = 0; sample < data.Length; sample += 2) { Audio_Samples[j] = (Double)data[sample]; Audio_Samples[j] += (Double)data[sample + 1]; ++j; } Data_Available = true; } ```

Commented Unassigned: PlaybackStopped event is not fired in Windows Embedded Standard 8 [16429]

$
0
0
Using NAudio 1.6.0.0

When the code below is running in a console application under Windows Embedded Standard 8, it doesn't raise the "PlaybackStopped" event.
The exact same application works fine under Windows 7 (haven't tested it under "normal" Windows 8).

I also tried to change the wavePlayer to the following (with the given result):
- DirectSoundOut: Plays the sound, doesn't raise the event
- WaveOut: Doesn't play the sound at all
- WaveOutEvent: Plays the sound, doesn't raise the event
- AsioOut: Plays the sound, doesn't raise the event

I also tried (after reading some postings on StackOverflow) to use the WaveChannel32 (with padding disabled) in many of the above situations (including DirectSoundOut) and none resulted in the event being fired.

```
internal class FileItem : ItemBase
{
private readonly IWavePlayer wavePlayer;
private readonly WaveStream reader;

private bool disposed;

public FileItem(string fileName)
{
this.fileName = fileName;
this.wavePlayer = new new DirectSoundOut();
this.reader = new AudioFileReader(fileName);
this.wavePlayer.Init(this.reader);
this.wavePlayer.PlaybackStopped += this.WavePlayerOnPlaybackStopped;
}

public override void Start()
{
this.wavePlayer.Play();
}

public override void Stop()
{
this.wavePlayer.Stop();
}

public override void Dispose()
{
if (this.disposed)
{
return;
}

this.disposed = true;
ThreadPool.QueueUserWorkItem(
s =>
{
this.wavePlayer.PlaybackStopped -= this.WavePlayerOnPlaybackStopped;
this.wavePlayer.Stop();
this.reader.Dispose();
this.wavePlayer.Dispose();
});
}

private void WavePlayerOnPlaybackStopped(object sender, StoppedEventArgs e)
{
this.RaiseCompleted(EventArgs.Empty);
}
}
```
(Code simplified to focus on real issue; might not compile "as is")
Comments: So, I've done some testing (as you suggested recompiling the NAudio code with some logging). Turns out that this console application has an invisible Window to capture some messages (like user logout, ...). But even having that in a simplified sample application didn't cause the issue. In our application somehow there was the WindowsFormsSynchronizationContext available on the thread where we created the WaveOut (but that wasn't on the same thread the WinForm was running!). If I manually set the synchronization context to null on that thread, everything works like a charm. Since this only happens in this weird case and only under Windows Embedded Standard 8, I think you can close this issue and forget about it. Thanks again for your help!

Commented Unassigned: Wrong BitsPerSample with WasapiLoopbackCapture [16401]

$
0
0
Hello

I have a 24 bits per sample / 192kHz sound board and I am using the Wasapi Loopback Capture method to get data from it.

When I print out the capabilities of the board, it shows 32 bits per sample instead of 24 bits per sample...

```
private void button2_Click(object sender, EventArgs e)
{
waveIn = new WasapiLoopbackCapture();
waveIn.DataAvailable += OnDataAvailable;
waveIn.RecordingStopped += OnRecordingStopped;
waveIn.StartRecording();

Console.WriteLine(waveIn.WaveFormat.BitsPerSample);
Console.WriteLine(waveIn.WaveFormat.AverageBytesPerSecond);
Console.WriteLine(waveIn.WaveFormat.Channels);
Console.WriteLine(waveIn.WaveFormat.SampleRate);
Console.WriteLine(waveIn.WaveFormat.Encoding);
}
```

Which prints out...

```
32
1536000
2
192000
Extensible
```

If I check the e.Buffer data that the callback delivers, I see that most of the bytes have data indeed, but I was hoping to see 3 bytes with data and then an empty byte (24 bits and a spare byte), but all bytes have data.

So, how should I merge those bytes and in which order?

The Audio Board specs are:

Realtek Semiconductor Corp.
Audio driver 6.0.1.5919
DirectX 11.0
ALC889A

Thanks!
Comments: Does your fft have a lot of noisy low frequencies ?

Created Unassigned: Is there a plan for NAudio to support WP? [16431]

$
0
0
Hi,

Is there a plan for NAudio to support WP?

Cheers,
LD

Commented Unassigned: Is there a plan for NAudio to support WP? [16431]

$
0
0
Hi,

Is there a plan for NAudio to support WP?

Cheers,
LD
Comments: hi I would love to do so, but due to limited time, this is not something being actively worked on

Commented Unassigned: PlaybackStopped event is not fired in Windows Embedded Standard 8 [16429]

$
0
0
Using NAudio 1.6.0.0

When the code below is running in a console application under Windows Embedded Standard 8, it doesn't raise the "PlaybackStopped" event.
The exact same application works fine under Windows 7 (haven't tested it under "normal" Windows 8).

I also tried to change the wavePlayer to the following (with the given result):
- DirectSoundOut: Plays the sound, doesn't raise the event
- WaveOut: Doesn't play the sound at all
- WaveOutEvent: Plays the sound, doesn't raise the event
- AsioOut: Plays the sound, doesn't raise the event

I also tried (after reading some postings on StackOverflow) to use the WaveChannel32 (with padding disabled) in many of the above situations (including DirectSoundOut) and none resulted in the event being fired.

```
internal class FileItem : ItemBase
{
private readonly IWavePlayer wavePlayer;
private readonly WaveStream reader;

private bool disposed;

public FileItem(string fileName)
{
this.fileName = fileName;
this.wavePlayer = new new DirectSoundOut();
this.reader = new AudioFileReader(fileName);
this.wavePlayer.Init(this.reader);
this.wavePlayer.PlaybackStopped += this.WavePlayerOnPlaybackStopped;
}

public override void Start()
{
this.wavePlayer.Play();
}

public override void Stop()
{
this.wavePlayer.Stop();
}

public override void Dispose()
{
if (this.disposed)
{
return;
}

this.disposed = true;
ThreadPool.QueueUserWorkItem(
s =>
{
this.wavePlayer.PlaybackStopped -= this.WavePlayerOnPlaybackStopped;
this.wavePlayer.Stop();
this.reader.Dispose();
this.wavePlayer.Dispose();
});
}

private void WavePlayerOnPlaybackStopped(object sender, StoppedEventArgs e)
{
this.RaiseCompleted(EventArgs.Empty);
}
}
```
(Code simplified to focus on real issue; might not compile "as is")
Comments: Glad you got to the bottom of this, and thanks for sharing what the issue was

Created Unassigned: BufferedWaveProvider "Clear when Empty" [16432]

$
0
0
If i clear BufferedWaveProvider when its empty, i get an exception that it doesn't point to an object.

This should be fixed, or rather, adjustable, as in some cases one could want to be certain that it's empty, and not want to close the application (or force Try/Catch) just because it happened to be empty).

Commented Unassigned: BufferedWaveProvider "Clear when Empty" [16432]

$
0
0
If i clear BufferedWaveProvider when its empty, i get an exception that it doesn't point to an object.

This should be fixed, or rather, adjustable, as in some cases one could want to be certain that it's empty, and not want to close the application (or force Try/Catch) just because it happened to be empty).
Comments: I can't see anything in the code that would cause this. Can you post a short code snippet that reproduces this issue?

Commented Unassigned: BufferedWaveProvider "Clear when Empty" [16432]

$
0
0
If i clear BufferedWaveProvider when its empty, i get an exception that it doesn't point to an object.

This should be fixed, or rather, adjustable, as in some cases one could want to be certain that it's empty, and not want to close the application (or force Try/Catch) just because it happened to be empty).
Comments: Simply make a BufferedWaveProvider. Then use ClearBuffer(). This will cause the issue. Don't do it after Adding samples or anything, as that will work. But clearing buffer when there is none, should simply ignore it.

Commented Unassigned: BufferedWaveProvider "Clear when Empty" [16432]

$
0
0
If i clear BufferedWaveProvider when its empty, i get an exception that it doesn't point to an object.

This should be fixed, or rather, adjustable, as in some cases one could want to be certain that it's empty, and not want to close the application (or force Try/Catch) just because it happened to be empty).
Comments: The following code works just fine for me: ``` var b = new BufferedWaveProvider(new WaveFormat()); b.ClearBuffer(); ``` What version of NAudio are you using?

Commented Unassigned: BufferedWaveProvider "Clear when Empty" [16432]

$
0
0
If i clear BufferedWaveProvider when its empty, i get an exception that it doesn't point to an object.

This should be fixed, or rather, adjustable, as in some cases one could want to be certain that it's empty, and not want to close the application (or force Try/Catch) just because it happened to be empty).
Comments: Hmm weird, i can't do that. 1.7-alpha06 (prerelease)

Commented Unassigned: BufferedWaveProvider "Clear when Empty" [16432]

$
0
0
If i clear BufferedWaveProvider when its empty, i get an exception that it doesn't point to an object.

This should be fixed, or rather, adjustable, as in some cases one could want to be certain that it's empty, and not want to close the application (or force Try/Catch) just because it happened to be empty).
Comments: Okay i updated, now it works, thought i had the latest, seems i was wrong:)

Created Unassigned: Remove metadata from MP3 and WAV [16433]

$
0
0
Hi,

I am using NAudio.dll for my project for converting MP3 files to WAV files and WAV files to given WAV format ( as per given BitsPerSample, Channel, and sample rate).

Now i having another task to remove metadata from MP3, WAV files. How to remove metadata from these files and save using NAudio Assembly ?

Warm Regards
Sathyanarayanan.R

Commented Unassigned: WaveFormatConversionStream class attempting to reference a null pointer... [16430]

$
0
0
Greetings all,

I am using 1.7 to play around with WaveOut Audio using the Event callback mechanism.

Whenever I exit out of the demo while audio is playing Visual Studio is raising an unhandled exception error. When I look further into it I have found that the WaveFormatConversionStream class is attempting to access either "sourceStream" or "conversionStream" and both of these members are null. I think it has to do with closing the demo window (using the red "X" in the upper right corner) while audio is playing because if I stop the audio first (click on the square block) then there are no exceptions raised. I am going to guess that these exceptions go unnoticed if you are not running under Visual Studio.

To reproduce:

1. Load the NAudio.sln in VS2010.
2. Set the NAudioDemo project as the Startup Project.
3. Be building and running in "Debug" mode.
4. Hit "F5" to kick things off.
5. Select "Audio File Playback" and press Load.
6. Select "Event" "Callback Mechanism:" and start playing a .wav file.
7. Click on the red "X" in the upper right hand corner to close NAudio Demo.
Comments: I've fixed the demo app. Probably classes like WaveFormatConversionStream and AudioFIleReader should throw ObjectDisposedException to make this obvious if you call methods after calling Dispose
Viewing all 738 articles
Browse latest View live


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