C/C++/Objective-C 中的声音合成框架?

发布于 2024-07-30 13:14:42 字数 105 浏览 5 评论 0原文

我在网上搜索过但没有发现任何有趣的东西。 也许我做错了什么。

我正在寻找用C、C++甚至Objective-C编写的声音合成API,它可以合成不同类型的波浪,效果是可选的。

I've searched the net but didn't found anything interesting. Maybe I'm doing something wrong.

I'm looking for sound synthesis API written on C, C++ or even Objective-C, which can synthesize different types of waves, effects are optional.

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

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

发布评论

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

评论(6

弱骨蛰伏 2024-08-06 13:14:42

这是用于 FM(频率调制)合成的完整库/工具包:

link1
link2

如果您有空闲时间...从头开始创建简单的声音合成实际上是一项有趣的尝试。 如果您创建一个包含 256 个 16 位样本的小缓冲区,这些样本代表正弦。 锯齿波、块或脉冲,您可以将它们复制到不断循环的实时音频缓冲区(例如,一个小缓冲区(例如 16kb))。 通过保持在播放位置的前面,并不断用新值填充缓冲区,您可以创建声音输出。
您可以使用小缓冲区以有趣的方式组合它们(最简单的是将它们添加在一起(加法合成))。

可以通过小缓冲区使用更大或更小的采样步长来操纵音调的频率。 在将样本放入输出缓冲区之前,可以通过缩放样本来操纵幅度。

尝试这个非常有趣!

如果您掌握了这一步,您可以添加更复杂的效果,例如滤波器(低通、高通等)和效果(混响、回声等)

R

Here's a complete library/toolkit for FM (Frequency Modulation) synthesis:

link1
link2

If you have time to spare... creating simple sound synthesis from scratch is actually a fun endeavor. If you create a small buffer of 256 16 bit samples which represent either a sine. a sawtooth, block or pulse, you can copy these to a live audiobuffer (e.g. a small buffer (say 16kb)) which constantly loops. By staying ahead of the playposition, and constantly filling up the buffer with new values, you can create the soundoutput.
You can use the small buffers to combine these in interesting ways (simplest is just to add them together (additive synthesis)).

The frequency of the tone can be manipulated by using a bigger or smaller sampling step through the small buffers. Amplitude can be manipulated by scaling the samples before putting them into the output buffer.

Great fun experimenting with this!

If you have this step nailed, you can add more sophisticated effects like filters (low pass, high pass, etc) and effects (reverbs, echoes, etc)

R

椵侞 2024-08-06 13:14:42

您看过综合工具包(STK)吗? 它是用 C++ 编写的(我不认为 ObjC 是音频合成的正确语言,事实上音频单元,Apple 自己的音频处理方式,包括生成器/过滤器/效果...是用 C++ 编写的)。

STK 将在 Mac OS X 和 iOS 上运行没有问题(支持 CoreAudio),但也可以在 Linux 和 Windows 上运行(Direct sound 和 ASIO),使用 RtAudio。 它确实做得很好而且很轻量,这些人花了很多时间思考它,它肯定会给你一个很好的开始。 它可以处理大量不同的音频文件格式 + midi(希望 OSC 很快...)。

还有 Create 和 CLAM,它们很大,其中包括 GUI 组件和许多其他您可能会或可能不会的东西想。 如果您只对声音合成感兴趣,我强烈推荐 STK。

Have you looked at the synthesis toolkit (STK)? It's in C++ (I don't think ObjC is the right language for audio synthesis, in fact audio units, Apple's own way of doing audio stuff, including generators/filters/effects... is in C++).

STK will run on Mac OS X, and iOS no problem (CoreAudio is supported), but will also run on Linux and Windows (Direct sound and ASIO), using RtAudio. It's really nicely done and lightweight, these guys have spent a lot of time thinking about it and it will definitely give you a big head start. It can handle loads of different audio file formats + midi (and hopefully OSC soon...).

There is also Create and CLAM which is huge, these include GUI components and many other things which you might or might not want. If you're only interested in doing sound synthesis I really recommend STK.

亚希 2024-08-06 13:14:42

PortAudio 也是一个很棒的 C API,我们在上学期的音频编程课程中使用过它。 它提供了音频回调...您还需要什么!?

我还没有尝试将它与 Objective-C 中的任何内容结合起来,但我会在尝试时进行报告。

PortAudio is also a great C API that we used last semester in an audio programming course. It provides an audio callback...what more could you need!?

I haven't tried incorporating it with anything in Objective-C yet, but will report back when I do.

装纯掩盖桑 2024-08-06 13:14:42

在我看来,用 C/obj-C 编写音频合成算法相当困难。 我建议使用 PureData 编写信号处理算法,然后使用 ZenGardenlibpd 嵌入和解释您的应用程序中的 pd 补丁。

Writing audio synthesis algorithms in C/obj-C is quite difficult in my opinion. I would recommend writing your signal processing algorithms using PureData and then use ZenGarden or libpd to embed and interpret the pd patches in your app.

凶凌 2024-08-06 13:14:42

另一个 C++ 库是 nsound:

http://nsound.sourceforge.net

人们可以使用以下命令生成任何类型的调制信号: Generator 类或使用提供的 Sine 类。 每个时间步长都可以有自己的瞬时频率和相位偏移。

您还可以尝试使用 Python 模块快速构建算法原型,然后用 C++ 实现。 它可以从 Python 甚至 C++ 生成漂亮的 matplotlib 绘图!

Another C++ library is nsound:

http://nsound.sourceforge.net

One can generate any kind of modulated signal using the Generator class or using the provided Sine class. Each time-step can have it's own instantaneous frequency and phase offset.

You can also experiment with the Python module to prototype your algorithm quickly, then implement in C++. It can produce pretty matplotlib plots from Python and even from C++!

归途 2024-08-06 13:14:42

您看过CSound吗? 它是一个非常灵活的音频生成平台,可以处理从简单波形生成到 FM 合成和各种滤波器的一切。 它还提供 MIDI 支持,您可以通过编写自定义操作码来扩展它。 还有一个完整的 C API 和几个 C++ API。

Have you looked at CSound? It's an incredibly flexible audio generation platform, and can handle everything from simple waveform generation to FM synthesis and all kinds of filters. It also provides MIDI support, and you can extend it by writing custom opcodes. There's a full C API and several C++ APIs as well.

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