All Projects → qssq → Recordutil

qssq / Recordutil

support free record mp3 amr wav aac format可以录制android ios兼容的aac mp3格式切换录制格式也支持体积极少的amr格式,只需要改变工厂方法改变一句话就能实现,和iOS不撕逼录音,这是一个通用解决方案,你值得拥有!

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Recordutil

nipper
🌶 💽 Nipper - Youtube playlist (& video) ripper
Stars: ✭ 23 (-74.73%)
Mutual labels:  mp3, aac, recorder
Recorder
html5 js 录音 mp3 wav ogg webm amr 格式,支持pc和Android、ios部分浏览器、和Hybrid App(提供Android IOS App源码),微信也是支持的,提供H5版语音通话聊天示例 和DTMF编解码
Stars: ✭ 2,891 (+3076.92%)
Mutual labels:  recorder, mp3, record
Lal
🔥 Golang live stream lib/client/server. support RTMP/RTSP/HLS/HTTP[S]-FLV/HTTP-TS, H264/H265/AAC, relay, cluster, record, HTTP API/Notify, GOP cache. 官方文档见 https://pengrl.com/lal
Stars: ✭ 480 (+427.47%)
Mutual labels:  aac, record
Freac
The fre:ac audio converter project
Stars: ✭ 518 (+469.23%)
Mutual labels:  mp3, aac
Ion.sound
JavaScript plugin for playing sounds and music in browsers
Stars: ✭ 694 (+662.64%)
Mutual labels:  mp3, aac
slibs
Single file libraries for C/C++
Stars: ✭ 80 (-12.09%)
Mutual labels:  mp3, aac
Pyinstalive
Python script to download Instagram livestreams and replays.
Stars: ✭ 336 (+269.23%)
Mutual labels:  recorder, record
Webrtc apm
webrtc中apm相关代码的提取,包括AEC/NS/AGC/VAD ,另外还包括mp3/aac编码器、SoundTouch
Stars: ✭ 65 (-28.57%)
Mutual labels:  mp3, aac
arduino-audio-tools
Arduino Audio Tools (Music Player, Music Recorder supporting I2S, Microphones, DAC, ADC, A2DP, Url, MP3, AAC, AudioKit, ES8388)
Stars: ✭ 393 (+331.87%)
Mutual labels:  mp3, aac
Esp8266audio
Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
Stars: ✭ 972 (+968.13%)
Mutual labels:  mp3, aac
Spy Spotify
🎤 Records Spotify to mp3 without ads and adds media tags to the files 🎵
Stars: ✭ 929 (+920.88%)
Mutual labels:  recorder, mp3
Audioworks
A cross-platform, multi-format audio conversion and tagging suite
Stars: ✭ 35 (-61.54%)
Mutual labels:  mp3, aac
libwinmedia
[Archived] A cross-platform simple media playback library for C/C++.
Stars: ✭ 35 (-61.54%)
Mutual labels:  mp3, aac
loudgain
ReplayGain 2.0 loudness normalizer based on the EBU R128/ITU BS.1770 standard (-18 LUFS, FLAC, Ogg, MP2, MP3, MP4, M4A, AAC, ALAC, Opus, ASF, WMA, WAV, AIFF, WavPack, APE)
Stars: ✭ 127 (+39.56%)
Mutual labels:  mp3, aac
Recorder
html5 js 浏览器 web端录音
Stars: ✭ 429 (+371.43%)
Mutual labels:  recorder, mp3
aplay-
a simple BitPerfect player
Stars: ✭ 23 (-74.73%)
Mutual labels:  mp3, aac
Trinity
android video record editor muxer sdk
Stars: ✭ 609 (+569.23%)
Mutual labels:  recorder, aac
React Mp3 Recorder
Microphone recorder for React that captures mp3 audio 🎵
Stars: ✭ 59 (-35.16%)
Mutual labels:  recorder, mp3
canvas-record
A one trick pony package to record and download a video from a canvas animation.
Stars: ✭ 64 (-29.67%)
Mutual labels:  recorder, record
goicy
AAC and MPEG (MP1, MP2, MP3) Icecast/Shoutcast source client written in Go
Stars: ✭ 58 (-36.26%)
Mutual labels:  mp3, aac

图片演示

演示图片地址

使用方法

gradle

 compile 'cn.qssq666:recordutil:0.1'//回调duration由秒改成毫秒


maven

<dependency>
  <groupId>cn.qssq666</groupId>
  <artifactId>recordutil</artifactId>
  <version>0.2</version>
  <type>pom</type>
</dependency>

支持录制amr,wav,mp3,aac,只需要改变工厂方法即可,都是一个抽象实现,因此用户轻松切换解决boss的变动需求。 提供了如下管理器 AACMediaRecorderManager

AmrRecorderManager

MP3RecordManager

Mp3RecordFromWavManager WavRecordManager

建议使用工厂的方式,这样切换录音格式只需要改一句工厂代码就行。 RecordFactory

如果要拿到具体的MediaRecorder 类 比如Amr的, 可以直接强转AmrRecorderManager 然后 getMediaRecorder()

工厂返回的录音接口类 接口类已被上面4个音频管理器类实现,可以直接进行强转拿如果要拿到具体的MediaRecorder 也可以直接从工厂的getInternAudioRecord()返回的Object对象强转具体的AudioRecord/MediaRecorder对象。

public interface RecordManagerI {
    public boolean startRecordCreateFile(int stopTime) throws IOException;

    public boolean stopRecord();

    public void setOnTimeSecondChanage(OnTimeSecondChanage onTimeSecondChanage);

    public void setSoundAmplitudeListenr(SoundAmplitudeListenr soundAmplitudeListenr);

    public void setOnTimeOutStopListener(RecordManagerI.OnTimeOutStopListener onTimeOutStopListener);

    public boolean isRecordIng();

    public int getCurrenttime();

    public File getFile();

    public interface SoundAmplitudeListenr {
        public void amplitude(int amplitude);
    }

    public interface OnTimeOutStopListener {
        void onStop();
    }

    /**
     * 当前流逝的时间
     */
    public interface OnTimeSecondChanage {
        void onSecondChnage(int duration);
    }

}

另外 需要注意的是 监听录制声音高低setSoundAmplitudeListenr改变某些格式不支持如mp3格式的直接录制。如果你很牛比你可以做这件事情,我已经封装的很好了,基于我这个基础扩展还是很简单的哈。

如果用户要自定义临时生成的文件名已经产生的路径,可以 在Application创建的时候设置一下方法即可。如果返回的文件名是空,则表示该方法不需要改动,这个方法是静态的哈。


 MediaDirectoryUtils.setMediaManagerProvider(new MediaDirectoryUtils.MediaManagerProvider() {
             @Override
             public File getTempCacheWavFileName() {
                 return null;
             }
 
             @Override
             public File getTempAmrFileName() {
                 return null;
             }
 
             @Override
             public File getTempMp3FileName() {
                 return null;
             }
 
             @Override
             public File getTempAACFileName() {
                 return null;
             }
 
             @Override
             public File getTempCachePcmFileName() {
                 return null;
             }
 
             @Override
             public File getCachePath() {
                 return null;//存储目录可以自定义逻辑,我这里是磁盘的某个文件夹
             }
 
             @Override
             public String productFileName(String postfix) {
                 return null;//这里是控制文件名生成格式 某些服务器端比较变态让你们这边修改
             }
         });
 

demo中部分代码 采用工厂模式轻松切换任意录制格式 RecordFactory类提供了5种录音姿势封装的演示

`    public RecordManagerI getRecordManager() {
         if (recordManager == null) {
 //                    recordManager = AudioManager.isErrorLoadSo() ? RecordFactory.getAAcRocrdInstance() : RecordFactory.getMp3RecordInstance();
 
             switch (mediaType) {
                 case AAC:
                     recordManager = RecordFactory.getAAcRocrdInstance();
                     break;
                 case WAV:
                     recordManager = RecordFactory.getWavRecordInstance();
                     break;
                 case MP3:
                     recordManager = RecordFactory.getMp3RecordInstance();
                     break;
                 case WAV_TO_MP3:
                     recordManager = RecordFactory.getWavRecordMp3OutInstance();
                     break;
                 case AMR:
                     recordManager = RecordFactory.getAmrRocrdInstance();
                     break;
             }
             recordManager = AudioManager.isErrorLoadSo() ? RecordFactory.getAAcRocrdInstance() : RecordFactory.getMp3RecordInstance();
             recordManager.setOnTimeSecondChanage(new RecordManagerI.OnTimeSecondChanage() {
                 @Override
                 public void onSecondChnage(int duration) {
                     int time = duration * 1000;
                     String s = generateTime(time);
                     tvTitle.setText("" + s + ",time:" + time);
                     Log.w(TAG, "" + s);
                     mDuration = duration;
                 }
             });
             recordManager.setOnTimeOutStopListener(new RecordManagerI.OnTimeOutStopListener() {
                 @Override
                 public void onStop() {
                     mAudioFile = recordManager.getFile();
                     tvPath.setText("audioPth:" + (mAudioFile == null ? null : mAudioFile.getAbsolutePath()));
                     File tempCacheMp3FileName = MediaDirectoryUtils.getTempMp3FileName();
                     try {
                         tempCacheMp3FileName.createNewFile();
                     } catch (IOException e) {
                         e.printStackTrace();
                     }
 
                     setRecordState(false);
                 }
             });
         }
         return recordManager;
     }

其它注意事项

混淆问题

m3p录制使用了jni 因此要保持这个不能被混淆

-keep class cn.qssq666.audio.AudioManager{*;}

如果完全不需要mp3录制 android节点加上

packagingOptions {
        exclude "lib/arm64-v8a/libmp3lame.so"
        exclude "lib/armeabi-v7a/libmp3lame.so"
        exclude "lib/x86/libmp3lame.so"
        exclude "lib/x86_64/libmp3lame.so"
        exclude "lib/mips/libmp3lame.so"
        exclude "lib/mips64/libmp3lame.so"
    }
    
<!-- -libraryjars ../XXX(此处为library名称)/src/main/jniLibs/x86/xxxxx.so -->

关于平台so优化问题.

建议设置为一个so,这样可以节省不少体积

  ndk {

            //APP的build.gradle设置支持的SO库架构

            abiFilters 'armeabi-v7a'
        }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].