问题描述
我正在开发一款具有琶音/音序功能的音乐应用,需要极高的计时精度.目前,使用定时器"我已经达到了平均抖动约 5 毫秒的准确度,但最大抖动为约 11 毫秒,这对于 8 分音符、16 分音符和 16 分音符的快速琶音是不可接受的.尤其是第 32 个音符.
I am working on a musical app with an arpeggio/sequencing feature that requires great timing accuracy. Currently, using `Timer' I have achieved an accuracy with an average jitter of ~5ms, but a max jitter of ~11ms, which is unacceptable for fast arpeggios of 8th, 16th notes & 32nd notes especially.
我读过CADisplayLink"比Timer"更准确,但由于它的准确度限制在 1/60 秒(~16-17 毫秒),因此它似乎不太准确比我使用 Timer
实现的方法更接近.
I've read the 'CADisplayLink' is more accurate than 'Timer', but since it is limited to 1/60th of a second for it's accuracy (~16-17ms), it seems like it would be a less accurate approach than what I've achieved with Timer
.
深入 CoreAudio 是实现我想要的唯一方法吗?还有其他方法可以实现更准确的计时吗?
Would diving into CoreAudio be the only way to achieve what I want? Is there some other way to achieve more accurate timing?
推荐答案
对于可接受的音乐准确节奏,唯一合适的计时源是使用 Core Audio 或 AVFoundation.
For acceptable musically accurate rhythms, the only suitable timing source is using Core Audio or AVFoundation.
这篇关于如何在 Swift 中实现非常准确的计时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!