README
¶
Pion Opus
Pure Go implementation of the Opus Codec
This package provides a Pure Go implementation of the Opus Codec
Why Opus?
- open and royalty-free - No license fees or restrictions. Use it as you wish!
- versatile - Wide bitrate support. Can be used in constrained networks and high quality stereo.
- ubiquitous - Used in video streaming, gaming, storing music and video conferencing.
Why a Go implementation?
- empower interesting use cases - This project also exports the internals of the Encoder and Decoder. Allowing for things like analysis of a Opus bitstream without decoding the entire thing.
- learning - This project was written to be read by others. It includes excerpts and links to RFC 6716
- safety - Go provides memory safety. Avoids a class of bugs that are devastating in sensitive environments.
- maintainability - Go was designed to build simple, reliable, and efficient software.
- inspire - Go is a power language, but lacking in media libraries. We hope this project inspires the next generation to build more media libraries for Go.
You can read more here
RFCs
Implemented
- RFC 6716: Definition of the Opus Audio Codec
Running
See our examples for demonstrations of how to use this package.
Roadmap
The library is used as a part of our WebRTC implementation. Please refer to that roadmap to track our major milestones.
See also Issue 9
Community
Pion has an active community on the Slack.
Follow the Pion Twitter for project updates and important WebRTC news.
We are always looking to support your projects. Please reach out if you have something to build! If you need commercial support or don't want to use public methods you can contact us at team@pion.ly
Contributing
Check out the contributing wiki to join the group of amazing people making this project possible
License
MIT License - see LICENSE for full text
Documentation
¶
Overview ¶
Package opus provides a Opus Audio Codec RFC 6716 implementation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bandwidth ¶
type Bandwidth byte
The Bandwidth the Opus codec scales from 6 kbit/s narrowband mono speech to 510 kbit/s fullband stereo music, with algorithmic delays ranging from 5 ms to 65.2 ms. At any given time, either the LP layer, the MDCT layer, or both, may be active. It can seamlessly switch between all of its various operating modes, giving it a great deal of flexibility to adapt to varying content and network conditions without renegotiating the current session. The codec allows input and output of various audio bandwidths, defined as follows: +----------------------+-----------------+-------------------------+ | Abbreviation | Audio Bandwidth | Sample Rate (Effective) | +----------------------+-----------------+-------------------------+ | NB (narrowband) | 4 kHz | 8 kHz | | | | | | MB (medium-band) | 6 kHz | 12 kHz | | | | | | WB (wideband) | 8 kHz | 16 kHz | | | | | | SWB (super-wideband) | 12 kHz | 24 kHz | | | | | | FB (fullband) | 20 kHz (*) | 48 kHz | +----------------------+-----------------+-------------------------+
https://datatracker.ietf.org/doc/html/rfc6716#section-2
const ( BandwidthNarrowband Bandwidth = iota + 1 BandwidthMediumband BandwidthWideband BandwidthSuperwideband BandwidthFullband )
Bandwidth constants.
func (Bandwidth) SampleRate ¶
SampleRate returns the effective SampleRate for a given bandwidth.
type Configuration ¶
type Configuration byte
Configuration numbers in each range (e.g., 0...3 for NB SILK- only) correspond to the various choices of frame size, in the same order. For example, configuration 0 has a 10 ms frame size and configuration 3 has a 60 ms frame size. +-----------------------+-----------+-----------+-------------------+ | Configuration | Mode | Bandwidth | Frame Sizes | | Number(s) | | | | +-----------------------+-----------+-----------+-------------------+ | 0...3 | SILK-only | NB | 10, 20, 40, 60 ms | | | | | | | 4...7 | SILK-only | MB | 10, 20, 40, 60 ms | | | | | | | 8...11 | SILK-only | WB | 10, 20, 40, 60 ms | | | | | | | 12...13 | Hybrid | SWB | 10, 20 ms | | | | | | | 14...15 | Hybrid | FB | 10, 20 ms | | | | | | | 16...19 | CELT-only | NB | 2.5, 5, 10, 20 ms | | | | | | | 20...23 | CELT-only | WB | 2.5, 5, 10, 20 ms | | | | | | | 24...27 | CELT-only | SWB | 2.5, 5, 10, 20 ms | | | | | | | 28...31 | CELT-only | FB | 2.5, 5, 10, 20 ms | +-----------------------+-----------+-----------+-------------------+
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
decode
Package main is an example of an Opus decoder that save the output PCM to disk
|
Package main is an example of an Opus decoder that save the output PCM to disk |
playback
Module
|
|
internal
|
|
pkg
|
|
oggreader
Package oggreader implements the Ogg media container reader
|
Package oggreader implements the Ogg media container reader |