以编程方式创建打击垫声音

发布于 2024-09-12 06:23:16 字数 309 浏览 10 评论 0原文

好吧,这个可能有点离谱,但无论如何我都会尝试一下。

打击垫是一种环境电子声音,会发出“嗡嗡声”。像这样的这个

我怎样才能在代码中生成这个?使用Processing、OpenFrameworks、C、Objective-C 或C++。请记住,我已经很久没有编程了。

如果这能得到答案,我将印象深刻!

好吧……走吧!

Okay this one may be a bit out from left field, but I'm going to try anyways.

A pad is a sort of ambient electronic sound that kind of 'hums'. Something like this .

How can I produce this in code? Using either Processing, OpenFrameworks, C, Objective-C or C++. Keep in mind I haven't been programming for that long.

I will be very impressed if this results in an answer!

Okay... Go!

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

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

发布评论

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

评论(4

羁拥 2024-09-19 06:23:16

我从来没有听说过这里使用的术语“pad”,但它听起来像是合成风琴的声音,演奏大和弦。

首先,要表示单个音符,您可以以音符的基频(如果我们谈论的是 A 大调,则为 440Hz)及其接下来的几个倍数(880、1760、3520)生成正弦波,将它们与一些(递减的)权重相加。然后添加以相同方式呈现的和弦的其他音符(C# 和 E)。

如果到目前为止这听起来对您有用,我可以根据需要进行扩展。

编辑:通过“一些(减小的)权重”,我的意思是添加泛音乘以一些放大,例如

F = 440;  // Hz
tone[t] = A * sin(t/F) + B * sin(t/(2*F)) + C * sin(t/(3*F)); // + etc, perhaps

在哪里,也许,

A = 1.0;
B = 1.0/2.0;
C = 1.0/3.0;

或者类似的东西。

对于 ADSR 滤波器(向上查找),您将生成的波形乘以放大倍数,该放大倍数在您选择的“攻击”期间从 0 增加到 1,然后在“衰减”期间下降到您选择的某个数字(可能是0.7),然后当您“释放”持续音符时线性下降到 0。

对于回声/混响,您可以将波形添加回自身并带有一些延迟,例如

D = 4410;  // 10 msec at 44.1 kHz., as an example value
tone[t] += 0.5 * tone[t-D];

I've never heard the term "pad" as applied here, but it sounds like a synth organ sound, playing major chords.

As a start, to represent a single note, you could generate sin waves at the fundamental frequency of the note (say 440Hz if we're talking about an A Major) and the next few multiples of that (880, 1760, 3520) and sum them with some (diminishing) weights. Then add in the other notes of the chord (C# and E) rendered in the same way.

If this is sounding useful to you so far, I can expand if needed.

EDIT: By "some (diminishing) weights", I meant adding the overtones times some amplification, e.g.

F = 440;  // Hz
tone[t] = A * sin(t/F) + B * sin(t/(2*F)) + C * sin(t/(3*F)); // + etc, perhaps

where, perhaps,

A = 1.0;
B = 1.0/2.0;
C = 1.0/3.0;

or some such thing.

For an ADSR filter (look that up), you'll multiply the generated waveform by an amplification that increases from 0 to 1 during the "attack" period you choose, then drops during the "decay" period to some number you choose (perhaps 0.7), then drops to 0 linearly when you "release" the sustained note.

For echo/reverb, you can add the waveform back into itself with some delay, e.g.

D = 4410;  // 10 msec at 44.1 kHz., as an example value
tone[t] += 0.5 * tone[t-D];
你是我的挚爱i 2024-09-19 06:23:16

我无法通过具体的代码示例来帮助您,但我想说类似于您的声音样本的东西可以通过FM(频率调制)合成来完成。

在编写任何代码之前,您可能需要从互联网上下载任何软件 FM 合成器(有很多免费可用的,有些作为独立应用程序,有些作为 VST 插件)并进行一些实验,如果您可以产生声音,想要,就写相应的代码。 (到那时,您很可能就会知道您需要什么样的振荡器、频率等组合。)

I can't help you out with concrete code examples, but I'd say something akin to this sound sample of yours could be done with FM (Frequency Modulation) synthesis.

Before you write any code, you might want to download any software FM synthesizer from the internet (there are many freely available, some as standalone applications, some as VST plug-ins) and experiment a little, and if you can produce the sound you want, write the corresponding code. (By that time, chances are that you will know what combination of oscillators, frequencies etc. you need.)

落在眉间の轻吻 2024-09-19 06:23:16

如果您没有声音编程经验,恕我直言,您应该看看 java sound,因为它非常容易学习和使用。我知道你已经标记了 C* 但我不知道是否有这么简单的 API 之类的。

创造声音基本上就是 grumdrig 所说的,你“只是”必须以你喜欢的声音的方式组合不同的波。 ;-)

If you are not expereianced in sound programming, you should imho take a look at java sound, since its really easy to learn and use. I know you have tagged C* but i don't know if there is such a easy API or so.

Creating a sound is basiclly what grumdrig said, you "Just" have to combine differnt waves in such a manner that you like the sound. ;-)

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