Git Product home page Git Product logo

Comments (2)

AndyW999 avatar AndyW999 commented on June 7, 2024

Do you mean the JSON or the Opus codec?

Both are well documented and used everywhere - try Google?

from zello-channel-api.

tlstpierre avatar tlstpierre commented on June 7, 2024

I was able to get this to work in Go without any issues. This is binary data, so you may have to do a bit of bit-banging to make it work:

  1. Look at the first byte of the binary message. If it == 0x01, then this is an audio stream.
  2. Take bytes 1-4 and decode them to a Uint32 type with BigEndian encoding. Not sure how to do this with Python, but presumably you can take a sub-set of the byte array and there is a function that will take the four bytes and give you a Uint32 back. This is your stream ID (save this to a variable somewhere).
  3. Take bytes 5-8 and decode these the same way - this is your packet ID. This number will increment for every packet.
  4. The rest of the binary data from bytes 9 to the end is your Opus encoded audio. Send that to your Opus decoder to get the audio frame.

Here's a few other tips that might help:

  • In order to initialize your Opus decoder, you need to get the format information from the stream start message. In my application, I use this to create a data structure to receive the audio, open up the sound card stream, etc.
  • You will need to create some sort of jitter buffer structure to hold the incoming audio frames before you play them out, to ensure that the output doesn't get starved if there is a delay in a packet arriving. It isn't a big concern with TCP based audio, but you may want to look at the packet ID numbers to make sure they increment without a gap, and go in order.
  • Here's an example of the signal flow: incoming packet > decode header (stream ID and packet ID) > Opus decoder > slice (array?) of Int16 audio samples > buffer > output.

The documentation is quite good, once you understand the binary encoding part of it. Do you have any more specific detail about where you are stuck?

from zello-channel-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.