简体   繁体   English

使用C#进行声音合成

[英]Sound synthesis with C#

Is there some possibility to generate sounds in C#? 是否有可能在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.) 我的意思是使用不同种类的波(正弦波,锯齿等)及其选项(频率,幅度等)构建信号

Check out NAudio on codeplex. 在codeplex上查看NAudio

NAudio is an open source .NET audio and MIDI library, containing dozens of useful audio related classes intended to speed development of audio related utilities in .NET. NAudio是一个开放源代码.NET音频和MIDI库,其中包含数十个有用的音频相关类,旨在加快.NET中音频相关实用程序的开发。 It has been in development since 2001 and has grown to include a wide variety of features. 自2001年以来,它一直在开发中,并且已成长为包括多种功能。 While some parts of the library are relatively new and incomplete, the more mature features have undergone extensive testing and can be quickly used to add audio capabilities to an existing .NET application. 尽管该库的某些部分相对较新且不完整,但更成熟的功能已经过广泛的测试,可以快速用于为现有.NET应用程序添加音频功能。

You could either use the library directly, or check out its source code to find out how it works at a low level. 您可以直接使用该库,也可以查看其源代码以了解其底层工作原理。

Here's a blog post I wrote about how to create a sine wave with NAudio . 这是我写的有关如何使用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. 显然,这只是制作完整的合成器的第一步,因为您还希望创建其他波形,ADSR包络,滤波器等,但这至少应该使您入门。

I highly recommend that you look at the platform VST .Net. 我强烈建议您查看平台VST .Net。 This would allow you to create your own VSTs in .Net. 这将允许您在.Net中创建自己的VST。 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. 如果要进行综合,则可能会发现创建VST并将其托管在您选择的DAW中比创建一次性应用更容易。 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/ 这是因为,如果您创建VST,则不必担心处理音频接口驱动程序或ASIO等。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. 标准的Windows窗体或WPF控件可能可以解决问题,但合成器爱好者通常喜欢看到外观精美的控件。 I recently released these controls which behave like normal WPF controls, but are designed for synthesis: https://bitbucket.org/MelbourneDeveloper/vst-controls-.net/ 我最近发布了这些控件,它们的行为类似于普通的WPF控件,但它们是为综合而设计的: https : //bitbucket.org/MelbourneDeveloper/vst-controls-.net/

You can use FLooping . 您可以使用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. 它是一个用F#语言编写的库,提供了用于音频合成的通用构件,如振荡器,包络线,滤波器等。它目前处于实验状态。

Disclosure: I am the developer of FLooping. 披露:我是FLooping的开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM