与AVAudioRecorder中的仪表混淆 [英] Confusion with meters in AVAudioRecorder

查看:88
本文介绍了与AVAudioRecorder中的仪表混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简而言之,我正在尝试基于iPhone的麦克风输入流中的分贝读数进行口形同步,而得到的值与我想要的不完全相同.我正在使用AVAudioRecorder的peakPowerForChannel和averagePowerForChannel. (我知道这是一种相当简单的口型同步技术,但质量不是主要问题).

Simply put, I'm trying to lip-sync something based on the decibel reading from the mic input stream of an iPhone, and the values I'm getting aren't quite what I'm after. I'm using AVAudioRecorder's peakPowerForChannel and averagePowerForChannel. (I'm aware that this is a rather simplistic lip-sync technique, but quality isn't a major concern).

当分贝数增加时,仪表会按照我的要求做出反应(响度更高时,该值会更高,因此我可以将其映射到嘴巴的张开度),但是当声音迅速停止时,该值会降低慢慢地,仿佛声音渐渐消失了(即在一两秒钟内逐渐消失为寂静)-不是我想要的.

When the number of decibels increases, the meters react as I'd like them to (higher value when louder, so I can map this to the open-ness of the mouth) but when the sound stops quickly, the values decrease slowly, as though the sound was trailing off (i.e. fading to silence over a second or two) - not what I'd like.

有没有一种配置AVAudioRecorder的方法,使其不具有这种淡入淡出"的效果,或者我可以对它提供给我的值进行某些处理以获得所需的输出吗?另外,还有其他我可以使用的工具吗?

Is there a way of configuring the AVAudioRecorder so that it doesn't have this 'fade' effect, or can I do something with the values that it gives me to get the desired output? Alternatively, is there another tool I can use?

谢谢!

推荐答案

AVAudioPlayer上的仪表弹道是您期望显示传统音频仪表的方式:瞬时增加幅度,但低通过减少.

The meter ballistics on AVAudioPlayer are what you'd expect for displaying traditional audio meters: Instantaneous for increases in amplitude, but lowpassed for decreases.

对于会说话的卡尔"式事物,您需要根据录制的音频对角色进行动画处理,您必须获取原始音频并适当调整自己的计量响应.如果您要对角色进行实时动画处理(即,当用户在设备的麦克风中讲话时),则可能需要使用AudioQueue或RemoteIO来获取音频数据.否则,如果您只是在录制音频文件后对其进行处理,则可以使用ExtAudioFile获取所需的数据.

For the Talking Carl-type thing where you animate a character based on recorded audio you'll have to get at the raw audio and tweak your own metering response as appropriate. If you're animating the character live (i.e., while the user talks in the device's microphone) you'll probably want to use AudioQueue or RemoteIO to get at the audio data. Otherwise, if you're just processing an audio file after it's been recorded, you can get the data you need using ExtAudioFile.

这篇关于与AVAudioRecorder中的仪表混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆