NetVST Wiki

networking for VST/AU plugins

User Tools

Site Tools


appendices:the_netvst_protocol

The NetVST protocol

This information is current as of 2017-03-21 but is subject to rapid change.

Present protocol

The input data stream to a networked plugin consists of a sequence of blocks, each corresponding to a “chunk” of stereo audio samples (e.g. between 500 and 1000). Each block is comprised of a header followed by a chunk of input data (PCM audio for effects, MIDI event data for synthesizers). Expressed in C:

#pragma pack(push, 1)
 
typedef struct
{
    UINT16 frameCount;   // defines CHUNKSIZE below
    UINT16 midiCount;    // will be 0 for a filter plugin
    UINT32 timeStamp;    // start time of this block, in units of sampling period, since song start
} SendDataHeader;
 
typedef struct
{
    UINT8 status;
    UINT8 channel;
    UINT8 data1;
    UINT8 data2;
    UINT32 startFrame;   // start time of this event, in units of sampling period, since block start
} MIDIMessageInfoStruct;
 
typedef struct
{
    UINT16  mainByteCount;      // or total bytecount if uncompressed
    UINT16  corrByteCount;      // 0 = lossy compression, 0xFFFF = uncompressed
} SampleDataHeader;
 
// Uncompressed sample data are represented like this:
typedef struct
{
    FLOAT left[CHUNKSIZE];  // Uncompressed PCM audio data, stereo, non-interleaved,
    FLOAT left[CHUNKSIZE];  // normalized to range [-1.0f, 1.0f]
} UncompressedStereoSampleData;
 
// Compressed sample data are represented like this (not syntactically correct C):
typedef struct
{
    BYTE lossyData[mainByteCount];
    BYTE losslessCorrectionData[corrByteCount]; // zero length for lossy-compressed data
} CompressedStereoSampleData;
 
#pragma pack(pop)

For a synthesizer plugin, the header midiCount will be non-zero, and the header is followed by that many MidiMessageInfoStruct items. For a filter plugin, midiCount will be zero.

The output stream consists of a SampleDataHeader followed by EITHER UncompressedStereoSampleData OR CompressedStereoSampleData.

The WavPack audio compression library is used, which can produce either one block of lossy-compressed data, and optionally a second block of “correction” data which can be combined with the first block to reconstruct the original samples exactly (lossless compression).

Current developments

The header structure will be expanded to allow:

  • sending MIDI data to filters (for e.g. parameter automation), in addition to audio
  • sending audio to synths (e.g. sidechain input to a vocoder), in addition to MIDI
  • incorporating audio compression algorithms other than WavPack
  • adding remote parameter-change data, to facilitate remote GUIs and parameter automation/modulation with greater precision than is supported by MIDI.
appendices/the_netvst_protocol.txt · Last modified: 2017/03/22 01:44 by shane