Receiving a VBAN Audio Stream

VB-Audio Network Protocol and applications
Vincent Burel
Site Admin
Posts: 445
Joined: Sun Jan 17, 2010 12:01 pm

Receiving a VBAN Audio Stream

Postby Vincent Burel » Wed Dec 09, 2015 5:04 pm

the VBAN protocol is made simple to receive audio stream. It just needs to process VBAN packets according the wanted stream (name / ip from).

VBAN incoming packet process example: (general algorithm base)

Code: Select all

PROCESS_UDP_PACKET(void * packet, long packetsize, SOCKADDR_IN from);
{
   LPT_VBAN_HEADER lpHeader = (LPT_VBAN_HEADER)packet;
   //Detect a VBAN packet in a single 32 bit instruction
   if (lpHeader->vban == 'NABV')
   {
      //check the IP-From and Stream Name (different stream can come in)
      fOk=CheckIfWeProcessThisStream(lpHeader, from);
      if (fOk)
      {
         //get datasize (ater header) and protocol/codec index
         Datasize = packetsize - sizeof(T_VBAN_HEADER);
         protocol = lpHeader->format_SR & VBAN_PROTOCOL_MASK;
         codec = lpHeader->format_bit & VBAN_CODEC_MASK;
         //protocol selector
         if (protocol == VBAN_PROTOCOL_AUDIO)
         {
            //codec selector
            switch (codec)
            {
            case VBAN_CODEC_PCM:
               //get audio stream information
               SR =VBAN_SRList[lpHeader->format_SR & VBAN_SR_MASK];
               nbChannel =((long)lpHeader->format_nbc)+1;
               fReserved =lpHeader->format_bit & 0x08;
               BitResolution = lpHeader->format_bit & VBAN_DATATYPE_MASK;
               sampleSize = VBAN_SampleSize[BitResolution];
               nbSample =((long)lpHeader->format_nbs)+1;
               nbByte = sampleSize * nbChannel * nbSample;
               //Push Data in Audio Stack (to be sent to audio device output for
               //example) NOTE that waiting cycles are not allowed in this thread.
               if (fReserved == 0)
               {
                  if (nbByte == datasize)
                  {
                     MyStream_PushSignal(pStreamObj, lpHeader+1, nbByte,
                     SR, nbChannel, BitResolution);
                  }
                  else nError_corrupt++
               }
            }
         }
      }
   }
}



get full source code example of a VBAN-Receptor app for linux on github: https://github.com/quiniouben/vban_receptor

brickviking
Posts: 18
Joined: Sat Jan 30, 2016 11:07 am

Re: Receiving a VBAN Audio Stream

Postby brickviking » Tue Feb 16, 2016 12:35 am

Thanks for this, it works quite well once I've selected all the relevant information in VoiceMeeter-Banana. I do have some questions though.

* Has anyone made an application that sends audio from Pulseaudio into VBAN? I know about vban_receptor, but I was interested in something going the other way.
* Could I point VLC (VideoLan Client) at a VBAN network stream, and would it understand it?

Regards, BrickViking (a.k.a. DrSmokey)

Vincent Burel
Site Admin
Posts: 445
Joined: Sun Jan 17, 2010 12:01 pm

Re: Receiving a VBAN Audio Stream

Postby Vincent Burel » Tue Feb 16, 2016 9:46 am

thanks for your interest,

brickviking wrote:* Has anyone made an application that sends audio from Pulseaudio into VBAN? I know about vban_receptor, but I was interested in something going the other way.


no, i don't think so, there is basic information in other thread to generate VBAN stream. Feel free to create a new thread for this subject if required...

* Could I point VLC (VideoLan Client) at a VBAN network stream, and would it understand it?


no, but there is maybe a plug-in infra-struture to make it possible... if you want to do it , you are welcome.

pswiatki
Posts: 2
Joined: Tue Sep 20, 2016 8:15 am

Re: Receiving a VBAN Audio Stream

Postby pswiatki » Thu Sep 22, 2016 8:11 pm

I tried VBAN streaming between two Voicemeeter applications running on two PCs. I guess I requested too many channels, too high sample rate, etc. because I got choppy audio and errors.
I have to calculate how fast the connection must be to ensure reliable transfer of PCM stream. Nevertheless, what are these error indicators:

Image

or (when left-clicked) the numbers:

Image

I can sometimes see activity on those even when no audible effects are present. As a side question: is WLAN ok for VBAN, or it isn't sufficiently reliable and should be avoided?

Vincent Burel
Site Admin
Posts: 445
Joined: Sun Jan 17, 2010 12:01 pm

Re: Receiving a VBAN Audio Stream

Postby Vincent Burel » Fri Sep 23, 2016 7:45 am

Choppy audio can be due to different points:
you first need to validate that your Voicemeeter is working correct...
that your monitoring (output A1 device) is working correct (no choppy).

VBAN stream usually does not produce choppy sound, it can produce some cut or frequent cut , but choppy sound usually comes from Voicemeeter bad configuration (too small latency / buffer size ... possibly bad driver... or bad working audio interface) .

When you are sure that your Voicemeeter is working correct, you can setup a VBAN Stream.
a 16 bits / 48 kHz / Stereo Stream asks for less than 3 mbps (so the network can support that easily).

if you get some hearable error (usually on the receptor side) we recommend to decrease the network quality on the receptor side...
select Medium for example (instead of Optimal or Fast).

VBAN works on WLAN too, but it is pending on network and router capabilities... (only recent WIFI point support Broadcast Stream).
but you can send unicast stream (to a specific ip address) to your WIFI device without any problem... if the WIFI link is good you will be able to use Optimal Network Quality and get audio nearly in real time (enough real time to watch a movie with a iOS device for example)

VBAN Receptor for iOS is available on Apple Store since June 2016.
https://itunes.apple.com/us/app/vban-re ... ?ls=1&mt=8

pswiatki
Posts: 2
Joined: Tue Sep 20, 2016 8:15 am

Re: Receiving a VBAN Audio Stream

Postby pswiatki » Fri Sep 23, 2016 10:59 pm

I worded my message incorrectly, I guess. I actually meant I got frequent cuts in audio (depending on audio settings - either very noticeable cuts, or only occasional errors). Surely, Voicemeeter works OK and local audio is good even @ 192/24 (2ch). No problem here. It is only when I use VBAN that issues pop-up and error indicators in VBAN panel become active.
I think I will have to experiment with VBAN a bit more to find out what is going on.

Side question: I forgot I could use local broadcast address to send audio to more than one PC in parallel and created two outgoing streams for two other local PCs. Strangely enough, one received VBAN stream without any issues (apart from occasional errors) but the other could not play the stream for some reason (although it detected incoming stream as expected and notified this fact).

Vincent Burel
Site Admin
Posts: 445
Joined: Sun Jan 17, 2010 12:01 pm

Re: Receiving a VBAN Audio Stream

Postby Vincent Burel » Sat Sep 24, 2016 6:00 am

in case of frequent cut in the sound (in relation with VBAN error), decrease the Network Quality on Receiver Side to "Medium" quality... or Very Slow to see the impact... if it does not solve the problem you can also decrease the Network quality on the Transmitter side to Medium (but it has generally no impact).

Generally speaking, If the NETWORK QUALITY parameter solve the problem (below MEDIUM), it means that your Network is not optimal for audio stream... (Warning if you have routeur on your network, some router could have limited UDP Stream and Broadcast - to be checked)

best network performence are gien with local network managed by switch only (no router).

let me know...

tomc
Posts: 2
Joined: Sat Sep 03, 2016 5:37 pm

Re: Receiving a VBAN Audio Stream

Postby tomc » Sun Oct 16, 2016 5:00 pm

Hello,

I can't use VBAN because of a "buffer underrun" problem.

I tried lots of things like changing quality, no router in network...

How can I troubleshot this issue?

Thanks,
thomas.

Vincent Burel
Site Admin
Posts: 445
Joined: Sun Jan 17, 2010 12:01 pm

Re: Receiving a VBAN Audio Stream

Postby Vincent Burel » Sun Oct 16, 2016 5:10 pm

1- check that Voicemeeter transmitter works correct (audio monitor gives a correct sound)
2- is it on a local wire or wifi network ?
3- could you post screenshot of VBAN configuration page on transmitter and receiver side ?

tomc
Posts: 2
Joined: Sat Sep 03, 2016 5:37 pm

Re: Receiving a VBAN Audio Stream

Postby tomc » Sun Oct 16, 2016 8:03 pm

Yes,transmitter works correct
I tested both local wire and wifi network

Capture.PNG
receiver
Capture.PNG (38.55 KiB) Viewed 9121 times


2016-10-16_20-51-34.png
2016-10-16_20-51-34.png (135.5 KiB) Viewed 9121 times


is configuration ok?


Return to “VBAN Procotol”

Who is online

Users browsing this forum: No registered users and 1 guest