Skip to content

brownfeng/CoreAudioDemos

Repository files navigation

Demo 概要

这个项目是Learning core Audio书中的内容,包括了5个小的Terminal Demo.

CAMetadata

一个简单的使用AudioFile Service对音频文件读取,使用AudioFileGetPropertyInfo获取音频文件属性的Demo.

CAToneFileGenerator

一个单频率声音的生成Demo.

主要使用AudioStreamBasicDescription进行音频数据format设置,然后通过AudioFileCreateWithURL创建音频文件,使用AudioFileWriteBytes直接将raw data写入AudioFile.

CAStreamFormatTester

这个Demo主要用来显示: audio fileType和 Audio file format 的区别.

音频格式和文件格式是两个不同的概念.具体可以百度.

Recorder

使用AudioQueueService进行录音.录音以后的数据直接通过AudioFileWritePackets写入文件系统.其实在回调函数中,对于录音的PCM数据可以进行其他的音频格式或者压缩算法的封装.在demo中还展示了如何进行AudioQueueBuffer的大小的合理计算方法.

Player

与前一个Recorder的Demo相反,使用AudioQueueService直接播放raw LPCM音频数据.具体的Demo可以看前面提到的书中的内容,里面的代码是完整的.

使用AudioQueueService进行录音和播放最好的实例是Apple官方的SpeakHere,现在官方已经下载不到了.

这里有一份可用的Demo: https://github.com/brownfeng/SpeakHere

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published