AudioKit 音序器时钟 [英] AudioKit sequencer clock

查看:78
本文介绍了AudioKit 音序器时钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划使用 audioKit 构建一个音序器.

我想根据用户交互动态生成 midiNotes,因此我希望能够录制和播放 MIDI,但不仅如此(我还想录制一些带时间戳的对象).

我想我必须在某处设置一个带有延迟的递归循环,但我不知道拥有可以远程控制的稳定时钟的最佳方法是什么(停止或暂停,改变节奏......).

audioKit 中是否已经实现了一些组件来实现这一点?或者我应该使用一些系统组件(Grand central Dispatch 或 NSTimer...)

欢迎任何建议,

谢谢:-)

解决方案

我从 Aurelius Prochazka(AudioKit 开发人员)那里得到了答案AKOperations 不能触发任意代码."

我找到了一个在 swift 中使用dispatch_after"的解决方案,似乎可以解决问题.(即使在操场上稳定,时钟设置为每滴答 1 毫秒)

但在挖掘网络后,根据 Aurelius 的说法,使用 CADisplayLink 似乎更适合拥有稳定的时钟.

AudioKit Playgrounds 中有一个触发时钟示例(AudioKit.playground/Sources 文件夹中的 AKPlaygroundLoop.swift)

I plan to build a sequencer using audioKit.

I would like to generate midiNotes on the fly according to user interactions, so I'd like to be able to record and play midi but not only (I'd like to record some time stamped objects as well).

I guess I have to set a recursive loop with a delay somewhere, but I don't know what is the best way to have a stable clock that I could control remotely (stop or suspend, change tempo...).

Is there some components already implemented in audioKit to achieve this? Or should I use some system components (Grand central Dispatch or NSTimer...)

Any suggestion is welcome,

Thanks :-)

解决方案

I got an answer from Aurelius Prochazka (AudioKit Developper) "AKOperations can't trigger arbitrary code."

I found a solution using "dispatch_after" in swift that seems to do the trick. (stable even in playground with a clock set to 1 ms per tick)

But after digging the web and according to Aurelius, using CADisplayLink seems to be more appropriate to have a stable clock.

There's an example in AudioKit playgrounds of a triggering clock (AKPlaygroundLoop.swift in AudioKit.playground/Sources folder)

这篇关于AudioKit 音序器时钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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