How to generate audio wave form programmatically while recording Voice in iOS?

前端 未结 3 1985
情书的邮戳
情书的邮戳 2021-01-30 11:52

\"enter

How to generate audio wave form programmatically while recording Voice in iOS?

3条回答
  •  故里飘歌
    2021-01-30 12:24

    If you want real-time graphics derived from mic input, then use the RemoteIO Audio Unit, which is what most native iOS app developers use for low latency audio, and Metal or Open GL for drawing waveforms, which will give you the highest frame rates. You will need completely different code from that provided in your question to do so, as AVAssetRecording, Core Graphic line drawing and png rendering are far far too slow to use.

    Update: with iOS 8 and newer, the Metal API may be able to render graphic visualizations with even greater performance than OpenGL.

    Uodate 2: Here are some code snippets for recording live audio using Audio Units and drawing bit maps using Metal in Swift 3: https://gist.github.com/hotpaw2/f108a3c785c7287293d7e1e81390c20b

提交回复
热议问题