MyGit

kevinho/opencore-amr-android

Fork: 74 Star: 198 (更新于 2024-10-28 07:15:40)

license: Apache-2.0

Language: C++ .

opencore amr codec for android

最后发布版本: v1.1.1 ( 2016-04-05 14:45:59)

GitHub网址

opencore-amr-android

An opencore amr codec JNI wrapper with explanation, And one solution for packaging amr audio files.

!!!AMR-WB support wanted, welcome PR.!!!

中文文档请移步README_CN

QQ group for help: 453503476

Background

  • opencore is the multimedia framework of android, which is a originallly contributed by PacketVideo.
  • amr is abbreviation for Adaptive Multi-Rate audio codec, which is an audio compression format optimized for speech coding.
  • opencore-amr is extracted from opencore as an codec for amr<->pcm encode/decode

What Is This

  • opencore-amr-dndroid is a wrapper for handy usage. You can usage wrapped api in Android Application without any troubles of writing c++ wrapper or ndk mk file.
  • amr project offer a solution for packaging amr audio files, in elegant code structure.

Setup

Android Studio

  • Add jcenter as your repository in project's build.gradle:

    allprojects {
          repositories {
              jcenter()//this is the default setting
          }
        }
    
  • Add dependency in your module's build.gradle:

    dependencies {
          compile fileTree(dir: 'libs', include: ['*.jar'])
          compile 'io.kvh:amr:1.1.1'//this is the lib
    }
    

    OR: Copy the content if Codec/amr to your module, as follows:

    Integration

ADT(Eclipse)

Copy the content if Codec/amr to your project:

Copy content of libs and src to the corresponding folder

Quick Start Up

  • encode
AmrEncoder.init(0);

int mode = AmrEncoder.Mode.MR122.ordinal();
short[] in = new short[160];//short array read from AudioRecorder, length 160
byte[] out = new byte[32];//output amr frame, length 32
int byteEncoded = AmrEncoder.encode(mode, in, out);

AmrEncoder.exit();        

Arm-2-File

  • decode
long state = AmrDecoder.init();

byte[] amrframe = new byte[32];//amr frame 32 bytes
short[] pcmframs = new short[160];//pcm frame 160 shorts
AmrDecoder.decode(state, amrframe, pcmframs);

AmrDecoder.exit(state);

AmrFileDecoder.java

Prerequisite Knowledge

  • Amr file has 6 bytes of header "23 21 41 4D 52 0A" => "#!amr.", please remember to remove the header before decoding frames, thanks to AAccount's explaination.

Packaging amr audio to file system

record->encode->package amr file->upload(not implemented)

Audio steam is packaged to file in slices, the slice last a few seconds(customizable). This policy is suitable for this scenario: client is under unstable mobile network, client records amr file, sends slice by slice, server re-assembles the slices.

If you are interested in this solution, please refer to Codec/app

Milestone

v1.2.0 April-15-2015

  • format converter for amr/wav
  • test cases

Changelog

v1.1.1 2020-04-23

  • add docs for framesize

v1.1.1 2016-04-05

  • fix decoding bug of 32bit

v1.1.0 2016-04-02

  • add prebuilds for all archs
  • rename package

FAQ

Please edit the FAQ files to help others, thanks! (赠人玫瑰,手留余香)

FAQ_CN

FAQ

最近版本更新:(数据更新于 2024-10-21 16:00:05)

2016-04-05 14:45:59 v1.1.1

2016-04-02 00:34:02 v1.1.0

2016-03-04 16:55:55 v1.0.1

kevinho/opencore-amr-android同语言 C++最近更新仓库

2024-11-12 03:39:28 PCSX2/pcsx2

2024-11-11 01:07:39 mudler/LocalAI

2024-11-10 05:02:57 LizardByte/Sunshine

2024-11-08 16:52:36 ExpressLRS/ExpressLRS

2024-11-08 05:48:17 ClickHouse/ClickHouse

2024-11-07 05:10:33 pwsafe/pwsafe