Giter VIP home page Giter VIP logo

go-soxr's Introduction

go-soxr

Go bindings for the libsoxr audio down and up sample library (go包装的soxr音频升降采样库)

Usage:

Create an SoxR instance

  
  var spec soxr.IoSpec
  
  //输入采样点精度
  //Input sampling point width
  spec.Itype = soxr.SOXR_INT16_I
  //输出采样点精度
  //Output sampling point width
  spec.Otype = soxr.SOXR_INT16_I
  spec.Scale = 1

  //Create an SoxR instance
  s, err := soxr.Create(float64(*inSample), float64(*outSample), 1, spec)

For processing functions, n is the number of bytes exported, and err is an error.

  n, err = s.Process(inBuf[:n], outBuf)
  if err != nil {
    fmt.Printf("soxr process fail:%s\n", err)
  }

Destroy the SoxR instance

defer s.Close()

examples:

env GOPATH=`pwd` go build github.com/guonaihong/go-soxr/examples/resample

Audio downsampling

./resample -in 21.16k.pcm -in_sample 16000 -out out_pcm_file_8k -out_sample 8000

Audio upsampling

./resample -in 21.8k.pcm -in_sample 8000 -out out_pcm_file_16k -out_sample 16000

This raw audio file may be played using ffplay:

ffplay -f s16le -ar 16000 ./out_pcm_file_16k
ffplay -f s16le -ar 8000 ./out_pcm_file_8k

go-soxr's People

Contributors

guonaihong avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.