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

New Post: Error when play/stop recording

$
0
0

Because of my karaoke scenario I need to Init my playback device every time with a new recorder stream because I need this recording with a particular level of volume to be mixed later. The exception occurs if I make play/stop iterations several times. If I invoke Init just once then there is no problem with play/stop iterations.


New Post: NAudio comparison with BASS .NET

$
0
0

Hi,

thank you for this library - it is awesome.

I'm going to create an application that will play internet radio streams. I have several URLs of the radio streams to test - BASS library supports all of them but i dont want to use unmanaged code in my application with managed wrappers. And i want to know - what stream types does NAudio support? Does it support streaming MP3, WMA, AAC, or OGG?

Thanks in advance.

New Post: When playback ends

$
0
0
markheath wrote:

it may be that the waveprovider you gave to waveOut never stops returning data from the Read function. this is quite possible as some streams pad with zeroes. you can simply test it by setting up a loop that reads from your waveprovider and see if it ever exits


I record sample with using NAudio and then I play it. Come on, there must be some other, normal way to do this.

New Post: NAudio comparison with BASS .NET

$
0
0

NAudio has support for decoding MP3 frames using ACM or DMO codecs, and there are some WMA classes that might be usable for streaming. There is unfortunately no AAC support. For OGG, there are some other open source .NET wrappers that you could use in conjunction with NAudio.

Mark

New Post: NAudio Reference

$
0
0

NAudio has XML documentation on all public classes and methods, but this hasn't been compiled into a separate document unfortunately.

Mark

New Post: Error when play/stop recording

$
0
0

you can only call Init once on a playback device. The best approach for you might be to create an IWaveProvider that reads from a source that you can swap out. Remember though that you can't change the WaveFormat after calling Init.

Mark

New Post: NAudio Recording Performance

$
0
0

ASIO recording has not yet been added to NAudio. I hope to do that in the near future (it is not a particularly big change)

Commented Issue: WaveFileChunkReader.ReadWaveHeader assumes that the stream supports position/seek [16354]

$
0
0
I am using this class to read a wave stream but the derived stream class that I am using that contains the wave does not support setting the Postion (CanSeek == false).
public void ReadWaveHeader(Stream stream)
{ ...
while (stream.Position <= stopPosition - 8)
{...
stream.Position += chunkLength; //This line throws an expection.
}
...
}
Is it posible to use another metholody to read the wave that is not based on Postion? or is there another alternative?
Comments: the trouble is, after reading all the chunks, it then will go back to the start of the data position. However, I guess it would be possible to make a version of this class that does not set position (just does read), and stops before going past the data chunk

New Post: Using WaveOutEvent to playback in a cycle

$
0
0

thanks for this suggestion. I'll try to get something like this incorporated in for a future version. Probably WaveInEvent would need a similar fix

New Post: NAudio audio conference

$
0
0

echo is a big problem when doing audio conferencing. you either need to listen on headphones, or to add an echo suppression algorithm (which can be tricky to write). Skype for example has built in echo-suppression for this very reason.

To track down background noise, try just recording directly to a WAV file. That will tell you if the speex or network streaming code is introducing the noise or if it is coming from the microphone.

New Post: NAudio Reference

$
0
0

I see, Mark.

So It's much better work with Source rather than compiled .dll

I'd like to put my hands on explore and generating Sounds. An old vague quirk since I got half deaf.

Thank you.

dan

New Post: NAudio Reference

$
0
0

Visual Studio will show the help as intellisense, so long as the NAudio.XML file is in the same folder as NAudio.dll

Commented Issue: WaveFileChunkReader.ReadWaveHeader assumes that the stream supports position/seek [16354]

$
0
0
I am using this class to read a wave stream but the derived stream class that I am using that contains the wave does not support setting the Postion (CanSeek == false).
public void ReadWaveHeader(Stream stream)
{ ...
while (stream.Position <= stopPosition - 8)
{...
stream.Position += chunkLength; //This line throws an expection.
}
...
}
Is it posible to use another metholody to read the wave that is not based on Postion? or is there another alternative?
Comments: Thank you for your answer. I can add some code so you can see it. The wave files are in a zip file, what I am doing is reading each wav from the zip directly to a stream (this is my business requirement, no file should copied to the hard drive) using codeplex DOTNETZIP. This is all work good expect that the stream class used by DONEZIP does not support Position/Seek (CanSeek == false). The class name is CrcCalculatorStream. I tried to change the WaveFileChunkReader class to do a stream.Read(buffer, 0, chunkLength); instead of a stream.Position += chunkLength; but after a few reads I get this error ex.Message = "Specified argument was out of the range of valid values.\r\nParameter name: count". You said "(just does read), and stops before going past the data chunk" how do I do that?

Source code checked in, #ce0dd0f66d78

$
0
0
improved locking in WaveMixerStream32

Commented Issue: Bug in the NotifyingSampleProvider class [16355]

$
0
0
The NotifyingSampleProvider class notifies also on non read samples because it uses the "sampleCount" variable which is the size of the incoming buffer. However the amount of bytes read may be smaller than the destination buffer! So the samplesRead variable should be used.

Wrong code:

public int Read(float[] buffer, int offset, int sampleCount)
{
int samplesRead = source.Read(buffer, offset, sampleCount);
if (Sample != null)
{
for (int n = 0; n < sampleCount; n += channels)
{
sampleArgs.Left = buffer[offset + n];
sampleArgs.Right = channels > 1 ? buffer[offset + n + 1] : sampleArgs.Left;
Sample(this, sampleArgs);
}
}
return samplesRead;
}

Right code:
public int Read(float[] buffer, int offset, int sampleCount)
{
int samplesRead = source.Read(buffer, offset, sampleCount);
if (Sample != null)
{
for (int n = 0; n < samplesRead ; n += channels)
{
sampleArgs.Left = buffer[offset + n];
sampleArgs.Right = channels > 1 ? buffer[offset + n + 1] : sampleArgs.Left;
Sample(this, sampleArgs);
}
}
return samplesRead;
}
Comments: good spot

Source code checked in, #5019c8f1c6fc

$
0
0
fixing issue 16355, bug in NotifyingSampleProvider

Commented Issue: Bug in the NotifyingSampleProvider class [16355]

$
0
0
The NotifyingSampleProvider class notifies also on non read samples because it uses the "sampleCount" variable which is the size of the incoming buffer. However the amount of bytes read may be smaller than the destination buffer! So the samplesRead variable should be used.

Wrong code:

public int Read(float[] buffer, int offset, int sampleCount)
{
int samplesRead = source.Read(buffer, offset, sampleCount);
if (Sample != null)
{
for (int n = 0; n < sampleCount; n += channels)
{
sampleArgs.Left = buffer[offset + n];
sampleArgs.Right = channels > 1 ? buffer[offset + n + 1] : sampleArgs.Left;
Sample(this, sampleArgs);
}
}
return samplesRead;
}

Right code:
public int Read(float[] buffer, int offset, int sampleCount)
{
int samplesRead = source.Read(buffer, offset, sampleCount);
if (Sample != null)
{
for (int n = 0; n < samplesRead ; n += channels)
{
sampleArgs.Left = buffer[offset + n];
sampleArgs.Right = channels > 1 ? buffer[offset + n + 1] : sampleArgs.Left;
Sample(this, sampleArgs);
}
}
return samplesRead;
}
Comments: good spot, have checked in a fix

New Post: Copying files and "file is being used by another process" problem.

$
0
0

are you sure you're not trying to create the same file twice?

New Post: When playback ends

$
0
0

the playback stopped event will only fire when playback actually stops. If you send in a never-ending stream you would instead check on a timer if the current position was greater than the length of the file and then stop.

Mark

New Post: Error when play/stop recording

$
0
0

I made custom WaveRecorder with BeginRecording and EndRecording methods, so I can control when the stream is written to the disk. Thus I call Init just once with one instance of my custom WaveRecorder. I call BeginRecording when start to play the sample and EndRecording when stop playing the sample. I think this solution works for now.

Yavor

Viewing all 5831 articles
Browse latest View live


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