Go Bindings for libsamplerate

libsamplerate binding for Golang

Go Report Card Build Status Coverage Status

This is a Golang binding for libsamplerate (written in C), probably the best audio Sample Rate Converter available to today.

A classical use case is converting audio from a CD sample rate of 44.1kHz to the 48kHz sample rate used by DAT players.

libsamplerate is capable of arbitrary and time varying conversions (max sampling / upsampling by factor 256) and comes with 5 converters, allowing quality to be traded off against computation cost.

API implementations

gosamplerate implements the following libsamplerate API calls:

not (yet) implemented is:

License

This library (gosamplerate) is published under the the permissive BSD license. You can find a good comparison of Open Source Software licenses, including the BSD license at choosealicense.com

libsamplerate has been republished in 2016 under the 2-clause BSD license.

How to install samplerate

Make sure that you have libsamplerate installed on your system.

On Mac or Linux it can be installed conveniently through your distro's packet manager.

Linux:

using apt (Ubuntu), yum (Centos)...etc.

    $ sudo apt install libsamplerate0

MacOS

using Homebrew:

    $ brew install libsamplerate

Install gosamplerate

    $ go get github.com/dh1tw/gosamplerate

Documentation

The API of gosamplerate can be found at godoc.org. The documentation of libsamplerate (necessary in order to fully understand the API) can be found here.

Tests & Examples

The test coverage is close to 100%. The tests contain various examples on how to use gosamplerate.

Owner
Tobias Wellnitz
Linux, Embedded Systems, Amateur Radio, Avionics, Golang, C, C++ & DevOps
Tobias Wellnitz
Similar Resources

Go bindings for Lua C API - in progress

Go Bindings for the lua C API Simplest way to install: # go get github.com/aarzilli/golua/lua You can then try to run the examples: $ cd golua/_examp

Dec 28, 2022

Go bindings for libmagic to detect MIME types

magicmime magicmime is a Go package which allows you to discover a file's mimetype by looking for magic numbers in its content. It could be used as a

Nov 9, 2022

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

raylib-go Golang bindings for raylib, a simple and easy-to-use library to enjoy videogames programming. Requirements Ubuntu X11 apt-get install libgl1

Dec 28, 2022

Go bindings for the Cartographic Projections Library PROJ.4

The Go package proj provides a limited interface to the Cartographic Projections Library PROJ. For PROJ version 5 and beyond, see also: https://github

Nov 10, 2022

Go bindings for GLFW 3

GLFW 3.3 for Go Installation GLFW C library source is included and built automatically as part of the Go package. But you need to make sure you have d

Jan 8, 2023

Go bindings for GLFW 3

GLFW 3.3 for Go Installation GLFW C library source is included and built automatically as part of the Go package. But you need to make sure you have d

Dec 25, 2022

Go bindings for OpenGL (generated via glow)

gl This repository holds Go bindings to various OpenGL versions. They are auto-generated using Glow. Features: Go functions that mirror the C specific

Dec 12, 2022

Go bindings to OpenGL Utility Library

GLU This package offers minimal bindings for GLU functions. Usage go get github.com/go-gl-legacy/glu License Copyright 2012 The go-gl Authors. All ri

Aug 18, 2018

Go bindings for audio capture and playback with ALSA and libasound

Go ALSA bindings These bindings allow capture and playback of audio via ALSA using the alsa-lib library. Installation go get github.com/cocoonlife/goa

Nov 26, 2022

naive go bindings to GnuPlot

naive go bindings to GnuPlot

go-gnuplot Simple-minded functions to work with gnuplot. go-gnuplot runs gnuplot as a subprocess and pushes commands via the STDIN of that subprocess.

Nov 8, 2021

go-gtk3 - GTK3 BINDINGS FOR GO

go-gtk3 - GTK3 BINDINGS FOR GO THIS IS: Hopefully GTK3 Bindings using gobject binding for Go. Goal is to have fairly complete gtk3 widgets with pango

May 25, 2021

Experimental OpenAL bindings for Go.

Experimental OpenAL bindings for Go. ==================================== Everything is evolving quickly and nothing is totally done. If you want to

Jul 24, 2022

Go bindings for OpenCV / 2.x API in gocv / 1.x API in opencv

Go OpenCV binding A Golang binding for OpenCV. OpenCV 1.x C API bindings through CGO, and OpenCV 2+ C++ API (GoCV) through SWIG. Disclaimer This is a

Dec 21, 2022

Go bindings for GStreamer (retired: currently I don't use/develop this package)

Retired. I don't use/develop this package anymore. Go bindings for GStreamer at a very early stage of maturity. This package is based on GLib bindings

Nov 10, 2022

Go bindings for libVLC and high-level media player interface

Go bindings for libVLC and high-level media player interface

Go bindings for libVLC 2.X/3.X/4.X and high-level media player interface. The package can be useful for adding multimedia capabilities to applications

Dec 31, 2022

Go bindings for OpenCV1.1 (Dev/Zero Dependencies).

Go bindings for OpenCV1.1 (Dev/Zero Dependencies).

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa Go bindings for OpenCV1.1 PkgDoc: http://godoc

Dec 6, 2022

Cgo bindings to PulseAudio's Simple API, for easily playing or capturing raw audio.

pulse-simple Cgo bindings to PulseAudio's Simple API, for easily playing or capturing raw audio. The full Simple API is supported, including channel m

Dec 17, 2022

Vulkan API bindings for Go programming language

Vulkan API bindings for Go programming language

Golang Bindings for Vulkan API Package vulkan provides Go bindings for Vulkan — a low-overhead, cross-platform 3D graphics and compute API. Updated Oc

Jan 3, 2023

Basic Go bindings for FLTK

Go FLTK This is a simple go wrapper for FLTK2, which I did to support my Go version of Ober (based on Acme), Gober. It's very small and should be fair

Mar 12, 2022
Comments
  • Fixed memory allocation problem on Simple function

    Fixed memory allocation problem on Simple function

    Using go version 1.10.3 sometimes a problem involving sweep built in go function ocoured. Substituting make([]C.float, dataInLength) to C.malloc(C.sizeof_float * C.ulong(dataInLength)) this problem didn't ocour anymore because of the use of C memory allocation.

  • don't truncate returned samples in Simple

    don't truncate returned samples in Simple

    Instead of truncating the ratio, round it upwards to make sure we always allocate enough samples. This gets rid of the "margin" (which wasn't large enough for all cases, anyway), and supports ratios less than 1, which previously only returned up to 20 samples.

  • heap memory corruption in Simple function

    heap memory corruption in Simple function

    The Simple function creates a C pointer to Go object, which becomes a dangling pointer if the Go gc frees the Go object while the cgo function is running.

    There are two open pull requests both dealing with this issue (I just noticed there is an existing pull request for the same issue).

  • Fix heap corruption caused by dangling C pointer

    Fix heap corruption caused by dangling C pointer

    In func Simple, the inputBuffer and outputBuffer are created as slices, then the address of each is copied to a C pointer (member of struct allocated with malloc). At this point, the Go gc can free or move the memory - go only guarantees that the gc won't free an object if the address of the object is passed as a cgo function parameter, no such guarantee is made for pointers in structs allocated with malloc.

    Fix this by passing inputBuffer and outputBuffer as parameters to the cgo call.

    Fixes: runtime: pointer 0xc000c32000 to unused region of span span.base()=0xc00062e000 span.limit=0xc00062fe00 span.state=1 fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)

Go bindings for libportmidi

portmidi Want to output to an MIDI device or listen your MIDI device as an input? This package contains Go bindings for PortMidi. libportmidi (v. 217)

Dec 25, 2022
Golang bindings for the Telegram Bot API

Golang bindings for the Telegram Bot API All methods are fairly self explanatory, and reading the godoc page should explain everything. If something i

Jan 6, 2023
OpenSSL bindings for Go

OpenSSL bindings for Go Please see http://godoc.org/github.com/spacemonkeygo/openssl for more info License Copyright (C) 2017. See AUTHORS. Licensed u

Dec 29, 2022
Golang bindings for libxlsxwriter for writing XLSX files
Golang bindings for libxlsxwriter for writing XLSX files

goxlsxwriter provides Go bindings for the libxlsxwriter C library. Install goxlsxwriter requires the libxslxwriter library to be installe

Nov 18, 2022
Go bindings for ForestDB

goforestdb Go bindings for ForestDB Building Obtain and build forestdb: https://github.com/couchbaselabs/forestdb (run make install to install the lib

Sep 26, 2022
Go bindings for GLib type system.

Go bindings for GLib type system. This package is designed for building bindings to C libraries based on GLib type system (like GTK, GStreamer, and ot

Aug 13, 2019
Source code editor written in Go using go-gtk bindings. It aims to handle navigation effectively among large number of files.
Source code editor written in Go using go-gtk bindings. It aims to handle navigation effectively among large number of files.

tabby Source code editor written in Go using go-gtk bindings. It aims to handle navigation effectively among large number of files. screenshot: depend

Nov 16, 2022
Duktape JavaScript engine bindings for Go

Duktape bindings for Go(Golang) Duktape is a thin, embeddable javascript engine. Most of the api is implemented. The exceptions are listed here. Usage

Jan 6, 2023
PHP bindings for the Go programming language (Golang)

PHP bindings for Go This package implements support for executing PHP scripts, exporting Go variables for use in PHP contexts, attaching Go method rec

Jan 1, 2023
naive go bindings to the CPython C-API

go-python Naive go bindings towards the C-API of CPython-2. this package provides a go package named "python" under which most of the PyXYZ functions

Jan 5, 2023