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

New Post: G.727 Support

$
0
0

As far as I understand BlockAlign should be 0.5...



However I will try different BlockAlignments affect the buffer size.

 

Thank you

 


New Post: G.727 Support

$
0
0

No, BlockAlign is the number of bytes that must be read together. If you want to read blocks of 819 bytes, then BlockAlign should be 819

New Post: Synthesis of a basic wave , and change the frequency

$
0
0

I've found this that's totally solved my problem --> http://msdn.microsoft.com/en-us/magazine/ee309883.aspx

New Post: G.727 Support

$
0
0

Now I understand! With a block align of 2048 I can process the blocks seemlessy now. Unfortunately that didn't fix the stumbling I experience. I will try further and keep you up to date.

Ciao

New Post: asioOut and Serial input

$
0
0

Hej all!

I build a 3d-sound programm (win Form) with NAudio, that is triggered via an input on the serial port. Great software!

 I got All the mixing: 2 to 6 channel done and played by the ASIO driver. But when I have an active serial connection I get the COMexception as soon as the playback is requested:

Unable to instantiate ASIO. Check if STAThread is set.

I searched the net about threading and found some pieces, but am not able to put it all together. Does anybody know how to put the audio output in a proper thread or how to solve this otherwise?

New Post: asioOut and Serial input

$
0
0

I haven't seen this one before, but maybe you are creating the ASIO object from a callback from the serial port that is on a non STA thread. Why not get back onto the GUI thread before creating ASIO? You can do this with something like mainForm.BeginInvoke(...)

New Post: G.727 Support

$
0
0

Hi Mark,

it seems that BlockAlign needs to be a divisor of 2880. Otherwise I get the mentioned stumbling. I will put up a minimalistic example...


Bye

New Post: G.727 Support

$
0
0
privatestaticvoid Test()
{
	WaveFormatEncoding tag = WaveFormatEncoding.ALaw;int sampleRate = 19200;int channels = 1;int bitsPerSample = 8;int blockAlign = 1024; // (channels * bitsPerSample) / 8;int averageBytesPerSecond = (sampleRate * channels * bitsPerSample) / 8;
	WaveFormat format = WaveFormat.CreateCustomFormat(tag, sampleRate, channels, averageBytesPerSecond, blockAlign, bitsPerSample);string filename = @"C:\Alaw_1Channel_8Bit_19200SamplesPerSec.asf";
	FileStream filestream = new FileStream(filename, FileMode.Open);
	RawSourceWaveStream alawStream = new RawSourceWaveStream(filestream, format);
	WaveStream waveStream = WaveFormatConversionStream.CreatePcmStream(alawStream);
	IWavePlayer wavePlayer = new WaveOut();

	wavePlayer.Init(waveStream);
	wavePlayer.Play();

	MessageBox.Show("Playing...");

	wavePlayer.Stop();
	wavePlayer.Dispose();
	waveStream.Close();
	alawStream.Close();
	filestream.Close();
}


New Post: G.727 Support

$
0
0

That is very odd, because blockAlign should be 1 for A-law. You can decompress each sample individually.

Also, 19200 samples per second is a very odd wave sampling rate, and I'd be surprised if your soundcard plays it correctly.

New Post: PanSlider Object - How to use?

$
0
0

Hello,

I´ am currently programming a small "DJ Software" (Just for Fun) and I want to use a PanSlider for controlling the volume of the left and right speaker. Is it possible?

The "Pan_Changed"-Event is already running. But at this point I don´t what to do in the Event-Function to use the pan.

Does anybody have already use the PanSlider Object? A little Code excerpt would be very nice.

Best regards Moritz M. :)

New Post: CallbackOnCollectedDelegate with ASIOOut

$
0
0

This is probably an error on my part. I'm calling Stop(), then Dispose(), then setting my asioOut instance to null all one line after the other. What do I have to do with callbacks to properly dispose of my asioOut instance?

Here's the error message:

A callback was made on a garbage collected delegate of type 'NAudio!NAudio.Wave.Asio.ASIOCallbacks+ASIOAsioMessageCallBack::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.

New Post: Asio Channel offset pairs

$
0
0

Hi All,

I was wondering if there was a way to display the asio channel offset in pair for stereo?

eg channel offset 0 is the first channel on my card. Is it possable to display that as

Channel 1+2?

Thanks, Wyatt

New Post: Play multiple WAV files simultaneously?

$
0
0

Hey,

I need to play multiple WAV files simultaneously. I found the MultiplexingWaveProvider class, but it does not support playing multiple inputs to one output. Is there a class/provider that would allow me to play several audio tracks simultaneously? If not, how would I go about making one?

Thanks,
Blake 

New Post: Asio Channel offset pairs

$
0
0

I'm not sure what you mean. What you display is up to you. If you are using channel offset 0 and writing two channels, you can call that "Channel 1+2" if you want.

New Post: Play multiple WAV files simultaneously?

$
0
0

There are a number of mixer classes in NAudio. The oldest is WaveMixerStream32, but I recommend using MixingSampleProvider with AudioFileReader as the inputs.

Mark


New Post: CallbackOnCollectedDelegate with ASIOOut

$
0
0

I'd suggest waiting for the PlaybackStopped event to arrive before calling Dispose

New Post: PanSlider Object - How to use?

$
0
0

The PanSlider control is a very simple example control that returns values between -1.0 (left) and 1.0 (right), with 0.0 as centre.

You would use it in conjunction with any class in NAudio that has a Pan property. For example, PanningSampleProvider, or WaveChannel32. PanningSampleProvider lets to choose a panning law to use. Set up playback something like this

var file = new AudioFileReader(myFile);var panningSampleProvider = new PanningSampleProvider(file);var player = new WaveOut();
this.panSlider1.PanChanged += (s,a) => panningSampleProvider.Pan = panSlider1.Pan; player.Init(panningSampleProvider);

 

 

New Post: NAudio Performance

$
0
0

the big problem with .NET for very low latency is the garbage collector. When it kicks in it stops all threads from running and that can cause audio output glitches. There are some best practices for writing audio code in a way that reuses buffers so the garbage collector has less work to do, but unfortunately you have almost no control over exactly when it will run.

Also, only the ASIO and WASAPI output modes are able to work at low latencies. WaveOut and DirectSound won't go much below 50ms.

NAudio hasn't been extensively optimised for very low latency, so you might also need to fine tune some classes if you are serious about doing this.

To make a full-featured DAW that competes in an already crowded market is a very big undertaking, so I suggest you start by creating some smaller audio applications first.

Mark

New Post: CallbackOnCollectedDelegate with ASIOOut

$
0
0
markheath wrote:

I'd suggest waiting for the PlaybackStopped event to arrive before calling Dispose

That should do the trick. Thank you.

New Post: NAudio Performance

$
0
0

Would you recommend temporarily setting GCSettings.LatencyMode to GCLatencyMode.LowLatency temporarily while playback is being done? I set the latency mode back to what it was previously when the audio is paused or stopped. Apparently this setting suppresses garbage collection completely except for in very low free memory situations, which sounds great as long as my code for playing audio is very clean. What's your opinion on the matter?

Viewing all 5831 articles
Browse latest View live


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