使用 C# 进行声音合成
C# 是否有可能生成声音?我的意思不仅仅是发出蜂鸣声或打开并播放波形文件。我的意思是使用不同类型的波(正弦波、锯齿波等)及其选项(频率、幅度等)构建信号
Is there some possibility to generate sounds in C#? I mean not just beep or open and play wave-file. I mean build the signal using different kinds of waves (sin, saw, etc.) and their options (frequencies, amplitudes, etc.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看 GitHub 上的 NAudio。
您可以直接使用该库,也可以查看其源代码以了解它在低级别上的工作原理。
Check out NAudio on GitHub.
You could either use the library directly, or check out its source code to find out how it works at a low level.
这是我写的关于 的博客文章如何使用 NAudio 创建正弦波。显然,这只是制作完整合成器的第一步,因为您还需要创建其他波形、ADSR 包络、滤波器等,但它至少应该让您入门。
Here's a blog post I wrote about how to create a sine wave with NAudio. Obviously that's just a first step to making a full blown synthesizer as you will also want to create other waveforms, ADSR envelopes, filters etc, but it should at least get you started.
我强烈建议您查看 VST .Net 平台。这将允许您在 .Net 中创建自己的 VST。如果您想要进行合成,您可能会发现创建 VST 并将其托管在您选择的 DAW 中比创建一次性应用程序更容易。这是因为如果您创建 VST,则不必担心处理音频接口驱动程序或 ASIO 等。
https://vstnet.codeplex.com/
此外,您还需要一组用户控件界面。标准的 Windows 窗体或 WPF 控件可能可以达到目的,但合成器爱好者通常喜欢看到漂亮的皮肤控件。我最近发布了这些控件,它们的行为类似于普通的 WPF 控件,但专为综合而设计:
https://bitbucket.org/MelbourneDeveloper/vst-controls-.net/
I highly recommend that you look at the platform VST .Net. This would allow you to create your own VSTs in .Net. If you want to do synthesis, you will probably find that is easier to create a VST and host it in your DAW of choice rather than create a once off app. This is because if you create a VST, you don't have to worry about dealing with the audio interface drivers or ASIO etc.
https://vstnet.codeplex.com/
Also, you'll also need a set of controls for the user interface. The standard Windows Forms, or WPF controls might do the trick, but synth enthusiasts usually like to see nicely skinned controls. I recently released these controls which behave like normal WPF controls, but are designed for synthesis:
https://bitbucket.org/MelbourneDeveloper/vst-controls-.net/
您可以使用FLooping。它是一个用 F# 编写的库,为音频合成提供常见的构建块,如振荡器、包络、滤波器等。目前处于实验状态。
披露:我是 FLooping 的开发者。
You can use FLooping. It is a library written in F#, providing common building blocks for audio synthesis like oscillators, envelopes, filters, etc. It is currently in an experimental state.
Disclosure: I am the developer of FLooping.