Page 1 of 2

[DEV] Receiving a VBAN Audio Stream

Posted: Wed Dec 09, 2015 5:04 pm
by Vincent Burel
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

Re: Receiving a VBAN Audio Stream

Posted: Tue Feb 16, 2016 12:35 am
by brickviking
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)

Re: Receiving a VBAN Audio Stream

Posted: Tue Feb 16, 2016 9:46 am
by Vincent Burel
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.

Re: Receiving a VBAN Audio Stream

Posted: Thu Sep 22, 2016 8:11 pm
by pswiatki
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?

Re: Receiving a VBAN Audio Stream

Posted: Fri Sep 23, 2016 7:45 am
by Vincent Burel
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

Re: Receiving a VBAN Audio Stream

Posted: Fri Sep 23, 2016 10:59 pm
by pswiatki
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).

Re: Receiving a VBAN Audio Stream

Posted: Sat Sep 24, 2016 6:00 am
by Vincent Burel
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...

Re: Receiving a VBAN Audio Stream

Posted: Sun Oct 16, 2016 5:00 pm
by tomc
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.

Re: Receiving a VBAN Audio Stream

Posted: Sun Oct 16, 2016 5:10 pm
by Vincent Burel
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 ?

Re: Receiving a VBAN Audio Stream

Posted: Sun Oct 16, 2016 8:03 pm
by tomc
Yes,transmitter works correct
I tested both local wire and wifi network
receiver
receiver
Capture.PNG (38.55 KiB) Viewed 44845 times
2016-10-16_20-51-34.png
2016-10-16_20-51-34.png (135.5 KiB) Viewed 44845 times
is configuration ok?