Latest 0.1.2
Homepage https://github.com/qq631192328/PFAudioLib
License MIT
Platforms ios 9.0
Frameworks AVFoundation
Authors

CI Status
Version
License
Platform

Introduction

音频文件格式的转换工具

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Demo请参照PFAudioLib/TEST_SWIFT

设置好源文件的音频属性

首先设置好音频文件的属性
// 这个是音频文件的默认配置,如果你的因为文件不一致,可以进行改动
let configDic: [String: AnyObject] = [
    // 编码格式
    AVFormatIDKey: NSNumber(value: Int32(kAudioFormatLinearPCM)),
    // 采样率
    AVSampleRateKey: NSNumber(value: 8000),
    // 通道数
    AVNumberOfChannelsKey: NSNumber(value: 2),
    // 录音质量
    AVEncoderAudioQualityKey: NSNumber(value: Int32(AVAudioQuality.min.rawValue))
]
// 设置音频文件的属性
PFAudio.shareInstance()?.attrs = self.configDic

进行文件格式的转换

// 将pcm文件转换成amr,第一个参数是音频文件的路径,第二个参数是转化后是否需要将源文件删除
PFAudio.shareInstance()?.pcm2Amr(recordFilePath, isDeleteSourchFile: false)
// 将pcm文件转换成mp3,第一个参数是音频文件的路径,第二个参数是转化后是否需要将源文件删除
PFAudio.shareInstance()?.pcm2Mp3(recordFilePath, isDeleteSourchFile: false)

Requirements

Installation

PFAudioLib is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'PFAudioLib'

Author

qq631192328, [email protected]

License

PFAudioLib is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PFAudioLib",
    "version": "0.1.2",
    "summary": "u97f3u9891u6587u4ef6u8f6cu6362u5de5u5177",
    "description": "u97f3u9891u6587u4ef6u8f6cu6362u5de5u5177 u652fu6301pcm,mp3,arm,wavu6587u4ef6u683cu5f0fu7684u8f6cu6362",
    "homepage": "https://github.com/qq631192328/PFAudioLib",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "qq631192328": "[email protected]"
    },
    "source": {
        "git": "https://github.com/qq631192328/PFAudioLib.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "PFAudioLib/Classes/**/**/*.{h,m,mm}",
    "vendored_libraries": "PFAudioLib/Classes/**/*.a",
    "frameworks": "AVFoundation",
    "libraries": "c++",
    "static_framework": true
}

Pin It on Pinterest

Share This