音乐音序器编程

发布于 2024-10-25 02:46:57 字数 1431 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白鸥掠海 2024-11-01 02:46:57

需要更多细节才能更好地回答你。您使用什么语言?您的目标节奏范围是多少?您将针对什么音频接口进行编程(重要的是要了解您将处理的延迟)。

另外,它只是一个鼓音序器吗?或者是更复杂的事情?您计划支持多少种“乐器”/“声音”?如果您要支持 <32 个语音,则可以使用单个 [int(tick), int(voices)] 数组。每个单独的声音都是 32 位数字中的一个位。然后要判断是否有声音播放,只需“&”声音标志与数组中的声音 int 相对应。这将避免数组排序/复制/构建。

延迟是这里需要理解的一个重要问题。例如,如果您的节奏为 240bpm,每个节拍有 4 个“滴答声”(实际上,我们讨论的是每个节拍细分为十六分音符的一个小节):

  • 每秒有 4 个节拍(每分钟 240 个节拍/60 秒) )
    ->每个节拍每 250 毫秒发生一次
    ->每个“滴答声”每 62.5 毫秒发生一次

如果音频接口具有高延迟(例如,Windows Vista+ 中的共享模式 WASAPI 的延迟约为 30 毫秒),您将需要生成不同的“窗口”。

如果您正在处理 MIDI 事件,这一点就变得更加重要,因为您可以在单独的刻度内接收 MIDI 事件。

我使用过的大多数 DAW(数字音频工作站)通常都以两种不同的“类型”来看待世界:音频数据和 midi 数据。音频数据往往更加“实时”(或者尽可能实时,因此低于 3 毫秒的延迟非常重要)。 Midi 仍然相当“快节奏”。最终,您可能会根据 MIDI 数据进行思考。

然而,开始此类项目的最佳方法是构建一个非常简单的鼓音序器。带上四个鼓,以及你正在做的事情,然后从那里开始:)。祝你好运!

Would need more details to better answer you. What language are you using? What tempo range are you targeting? What audio interface will you be programming against (important to know when it comes to the latency you will be dealing with).

Also, is it just a drum sequencer? Or is it something more complex? How many "instruments"/"voices" are you planning on supporting? If you are going to be supporting <32 voices, it's possible to have a single array of [int(tick), int(voices)]. Each individual voice is a bit in the 32-bit number. Then to determine whether a voice is playing, you just need to "&" the voice flag against the voices int in the array. This would avoid the array sorting/copying/building.

Latency is an important issue to understand here. If you have a tempo of 240bpm for instance, and four "ticks" per beat (really, we're talking about one measure with each beat subdivided into sixteenth notes):

  • There are 4 beats per second (240 beats per minute / 60 seconds)
    -> Each beat occurs every 250 milliseconds
    -> Each "tick" occurs every 62.5 milliseconds

If the audio interface has a high latency (for example, shared mode WASAPI in Windows Vista+ has a latency of around 30ms), you will have different "windows" that will need to be generated.

If you're processing MIDI events, this becomes even more important because you can be receiving MIDI events within individiual ticks.

Most DAWs (Digital Audio Workstations) I have worked with typically think of the world in two different "types": audio data, and midi data. Audio data tends to be more "realtime" (or as realtime as you can get, hence the importance for sub-3ms latencies). Midi is still fairly "fast paced". Eventually, you'll likely be thinking in terms of midi data.

However, the best way to get started on a project like this is to build a very simple drum sequencer. Take four drums, and the stuff you are doing, and go from there :). Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文