A "native" ogg vorbis decoder for Go (uses inline stb_vorbis)

vorbis

GoDoc Build Status

This Go package provides a "native" ogg vorbis decoder, but still requires cgo, as it uses inline code from stb_vorbis. Someday, it won't.

The package exports a single function:

var data []byte
…
samples, nchannels, sampleRate, err := vorbis.Decode(data)

This corresponds to stb_vorbis_decode_memory(), but is a little different. Samples is a []int16, corresponding to stb's dynamic array of shorts if you're on the right platforms. The samples seem to be stored native-endian, but I haven't tested many vorbis files. Nchannels is the number of channels, which are interleaved in the samples slice. Err is non-nil if the data is not an ogg vorbis stream according to stb.

Comments
  • Bug Failed assertion

    Bug Failed assertion

    I ran some fuzzing tests and uncovered a triggered failed assertion. It is reported as: vorbis.go:1063: int compute_codewords(Codebook *, uint8 *, int, uint32 *): Assertion0' failed.`

    See attached crashers: mccoyst-vorbis.zip

  • spell err ?

    spell err ?

    https://github.com/mccoyst/vorbis/blob/9dbc0f6a44d4c242c03121df78584382b6a27061/vorbis.go#L5522

    type Vorbis struct {
    	Channels   int
    	SampleRate int
    	buf        []byte
    	r          io.Reader
    	v          *_Ctype_struct_stb_vorbis
    }
    

    is _Ctype_struct_stb_vorbis a typo? I can't find it's definition

  • Fixed a few compiler issues in stb_vorbis

    Fixed a few compiler issues in stb_vorbis

    I've tried to get rid of anything that causes compiler warnings for the sake of a clean build, and I don't believe it's had any effect on functionality. Since GCC on Linux requires the -lm flag to include "math.h", I've added that as a #cgo preprocessor to add that when necessary. This has been tested on Windows 8 (64-bit) and Linux Mint 12 (32-bit).

  • A/B test setup

    A/B test setup

    Progress has been slowed partially by my lack of tools for testing decoding (unit tests with raw bytes are a pain). A naive A/B tester + some example audio files should help a lot. This will likely be a separate project so that this one isn't bloated with files.

  • Write a real port

    Write a real port

    This would be good for three reasons:

    • Remove the cgo requirement
    • Improve performance significantly, since the decoded data won't have to be copied from C land.
    • Understand it well enough to write a generalized function that takes a Reader.
Related tags
Sequence-based Go-native audio mixer for music apps

Mix https://github.com/go-mix/mix Sequence-based Go-native audio mixer for music apps See demo/demo.go: package main import ( "fmt" "os" "time"

Dec 1, 2022
ID3, MP4 and OGG/FLAC metadata parsing in Go

MP3/MP4/OGG/FLAC metadata parsing library This package provides MP3 (ID3v1,2.{2,3,4}) and MP4 (ACC, M4A, ALAC), OGG and FLAC metadata detection, parsi

Jan 7, 2023
Example of using Pion WebRTC to play H264 + Ogg from disk

This repo demonstrates how you can use Pion WebRTC to play H264 and Ogg from disk. These same APIs can be used to pull from other sources. You can use

Sep 18, 2021
Nfc-sun-decoder - A Decoder for NXP 424 DNA SUN (Secure Unique) messages

NFC SUN Decoder A Decoder for NXP 424 DNA SUN (Secure Unique) messages This library makes decoding 424 DNA SUN messages easier. While the 424 DNA chip

Aug 24, 2022
COBS implementation in Go (Decoder) and C (Encoder & Decoder) with tests.

COBS Table of Contents About The project COBS Specification Getting Started 3.1. Prerequisites 3.2. Installation 3.3. Roadmap Contributing License Con

May 22, 2022
Inline styling for html mail in golang

go-premailer Inline styling for HTML mail in golang Document install go get github.com/vanng822/go-premailer/premailer Example import ( "fmt" "gith

Nov 30, 2022
An inline buildpack for deploying a mattermost-irc bridge

Matterbridge-Heroku An inline buildpack for hosting Matterbridge on Heroku. Heroku is a platform for easily deploying applications. A buildpack provid

Nov 26, 2022
Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading.

Knit Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading. Example openapi: "

Sep 15, 2022
RBTI Golang Server uses PostgreSQL and for its main database and uses Elasticsearch

RBTI Golang Server This server is used for my thesis project, it uses PostgreSQL and for its main database and uses Elasticsearch for faster query spe

Jan 17, 2022
A Cloud Native Buildpack that contributes SDKMAN and uses it to install dependencies like the Java Virtual Machine

gcr.io/paketo-buildpacks/sdkman A Cloud Native Buildpack that contributes SDKMAN and uses it to install dependencies like the Java Virtual Machine. Be

Jan 8, 2022
An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers
An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers

Developer-oriented Continuous Delivery Product ⁣ English | 简体中文 Table of Contents Zadig Table of Contents What is Zadig Quick start How to use? How to

Oct 19, 2021
GAAD (Go Advanced Audio Decoder)

GAAD (Go Advanced Audio Decoder) Package currently provides AAC parsing capabilities. This package performs a full parse of AAC-LC and HE-AACv1 bitstr

Oct 24, 2022
Fast, secure and efficient secure cookie encoder/decoder

Encode and Decode secure cookies This package provides functions to encode and decode secure cookie values. A secure cookie has its value ciphered and

Dec 9, 2022
yenc decoder package for Go (golang)

yenc.go A single/multipart yenc decoder. Usually used for binary files stored on Usenet servers. Installation The easy way: go get github.com/chrisfar

Apr 24, 2020
Package polyline implements a Google Maps Encoding Polyline encoder and decoder.

go-polyline Package polyline implements a Google Maps Encoding Polyline encoder and decoder. Encoding example func ExampleEncodeCoords() { coords :=

Dec 1, 2022
BPG decoder for Go (Zero Dependencies).

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa BPG for Go BPG is defined at: http://bellard.o

Sep 7, 2020
Rich TIFF/BigTIFF/GeoTIFF decoder/encoder for Go (Pure Go/Zero Dependencies)

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa TIFF for Go Features: Support BigTiff Support

Nov 16, 2022
WebP decoder and encoder for Go (Zero Dependencies).
WebP decoder and encoder for Go (Zero Dependencies).

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa webp ██╗ ██╗███████╗██████╗ ██████╗ ██║

Dec 28, 2022
Golang binary decoder for mapping data into the structure

binstruct Golang binary decoder to structure Install go get -u github.com/ghostiam/binstruct Examples ZIP decoder PNG decoder Use For struct From file

Dec 17, 2022
Fixed width file parser (encoder/decoder) in GO (golang)

Fixed width file parser (encoder/decoder) for GO (golang) This library is using to parse fixed-width table data like: Name Address

Sep 27, 2022