Coder Social home page Coder Social logo

codec2-ios's Introduction

codec2-ios

A lightweight swift wrapper for Codec 2

Codec 2 is a low bitrate speech codec with compression modes ranging from 700 bit/s to 3200 bit/s. It is useful for voice compression in bandwidth constrained environments. The codec accepts 16 bit 8Khz PCM audio as input.

This framework is based on a fork of the Codec 2 source code. The original source can be found on SVN here and on GitHub here.

Installing

Carthage

  • Add this line to your Cartfile: github "Beartooth/codec2-ios"
  • Use the typical carthage workflow to add Codec2.framework to your project.

Usage

Instantiating a codec using 1.2kbps compression:

import Codec2

let codec = Codec2(mode: ._1200)!
let nBitsPerFrame = codec.bitsPerEncFrame
let nBytesPerFrame = codec.bytesPerEncFrame
let nSamplesPerFrame = codec.samplesPerFrame

Encoding and Decoding:

import Codec2

let codec = Codec2(mode: ._1200)!

func encodeVoiceFrame(_ toEnc: inout [Int16]) -> [UInt8]? {
  guard toEnc.count == codec.samplesPerFrame else { return nil }
  return codec.encode(speech: toEnc)
}

func decodeVoiceFrame(_ toDec: inout [UInt8]) -> [Int16]? {
  guard toDec.count == codec.bytesPerEncFrame else { return nil }
  return codec.decode(frame: toDec) 
}

Building

Required tools

  • Xcode
  • Homebrew
  • Cmake (brew install cmake)
  • git (brew install git)

Build steps

  • Clone the repository: git clone --recursive https://github.com/Beartooth/codec2-ios.git
  • Build the codec2-ios scheme from XCode or using xcodebuild

Contributors

David Rowe originally developed the codec, along with support from other researchers.
Jeff Jones developed the Swift port and cross compilation build script.

codec2-ios's People

Contributors

blanu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

blanu han-gang

codec2-ios's Issues

VHF FM Support

It would be great to get support for mode 2400B for compatibility with VHF FM radios. As far as I can tell, this requires exposing not just the Codec2 codec2_encode/codec2_decode functions, but also the freedv API functions (freedv_open, freedv_tx, freedv_rx, etc.) in order to get access to the VHF FM modem implementation.

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.