Giter Club home page Giter Club logo

lamemp3forandroid's Introduction

LameMp3ForAndroid

image

本次demo使用AndroidStudio+Cmake+NDK进行开发
利用Android SDK提供的AndroidRecorder进行录音,得到PCM数据,并使用jni调用Lame这个C库将PCM数据转换为MP3文件。并使用MediaPlayer对录音的MP3文件进行播放。

主要类的介绍

  • Mp3Recorder—— 是负责调用AudioRecorder进行录音的类
  • SimpleLame——是负责将MP3Recorder录制出的PCM数据转换成MP3文件
  • DataEncodeThread——是负责执行PCM转MP3的线程
  • LameMp3Manager——是对Mp3Recorder的多一次封装,增加了取消后删除之前录制的数据的逻辑
  • MediaPlayerUtil——是对系统的MediaPlay进行简单的封装,使其只需要三步就可以播放音频文件
  • MediaRecorderButton ——是一个仿微信录音按键的控件,按下录制,松开结束,录制时上滑则取消录制

录制的流程

  1. Mp3Recorder调用startRecording()开始录制并初始化DataEncoderThread线程,并定期将录制的PCM数据,传入DataEncoderThread中。
  2. 在DataEncoderThread里,SimpleLame将Mp3Recorder传入的PCM数据转换成MP3格式并写入文件,其中SimpleLame通过jni对Lame库进行调用
  3. Mp3Recorder调用stopRecording()停止录制,并通知DataEncoderThread线程录制结束,DataEncoderThread将剩余的数据转换完毕。

编译过程

详细点的讲解

lamemp3forandroid's People

Contributors

clam314 avatar

Watchers

 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.