VST.NET vs NAUDIO (vstaudiobuffer vs pcmstream buffer)

Jun 20, 2010 at 8:48 PM

I have tried all above solutions http://vstnet.codeplex.com/Thread/View.aspx?ThreadId=205889 but nothing works for me.

Please help me how to converts from

byte[] Buffer


VstAudioBufferManager inputMgr = new VstAudioBufferManager(inputCount, blockSize);
VstAudioBuffer rightInputBuffer = inputMgr.ToArray()[0];
VstAudioBuffer leftInputBuffer = inputMgr.ToArray()[1];

what should i do to populate rightInputBuffer and leftInputBuffer from byte[] Buffer?


Vise Versa


VstAudioBufferManager outputMgr = new VstAudioBufferManager(outputCount, blockSize);

VstAudioBuffer rightOutputBuffer = outputMgr.ToArray()[0];
VstAudioBuffer leftOutputBuffer = outputMgr.ToArray()[1];


byte[] Buffer

what should i do to populate byte[] Buffer from rightOutputBuffer and leftOutputBuffer?


Jun 21, 2010 at 4:57 AM

A quick look at NAudio seem to indicate that the audio is 16 bits. So you need to read two bytes at a time from the buffer instead of just one.

Hope it helps,

Jun 21, 2010 at 7:19 PM
Edited Jun 21, 2010 at 7:24 PM
Thax for your reply, can you please send me any code sample
Jun 21, 2010 at 9:00 PM
Edited Jun 21, 2010 at 9:05 PM
This code is not working on my side buffer[i] = (float)destBuffer[i] / 128.0f - 1.0f;
Jun 23, 2010 at 5:19 AM
Edited Jun 23, 2010 at 5:20 AM

You should find out first what the format of the audio buffer is. How many bytes does one audio sample take up? When multiple bytes are used by a sample, how is it laid out: most significant values first or last (big/little endian). Only when you have all this information can you start to write code. That code -for an Int16- would be something like:

- read 2 bytes from the pcm buffer
- turn those 2 bytes into an Int16 (little/big endian?)
- coerce the int to a float (adjust the value range of the sample)
- add it to the VstAudioBuffer

Hope it helps.