我希望在c#中使用大胆​​的矫直效果。

问题描述:

实际上我想在c#中使用大胆​​的矫直效果。

矫直器实际上是声音信号的动态范围压缩。

但是大胆没有API。

搜索后我得到了一个解决方案,大胆脚本解决了我的问题。但我无法理解这个脚本...

请帮我举几个例子。

Actually i want Leveler effect of audacity in c#.
leveler is actually a dynamic range compression of sound signals.
but audacity not have an API.
after search i got a solution that audacity scripting is solve my problem.but i can't understand this scripting...
please help me with simple examples.

下面是一些用C#读取/写入WAV文件的代码。



https://gist.github.com/yomakkkk/2290864 [ ^ ]



使用它作为基础,您需要在编写之前修改音频样本退出。



你需要......



1.代表收益的变量

2.计算最后N个样本峰值的代码。

3.跟踪最后一个峰值的发生时间(nu mber过去的音频样本。

4.根据当前的峰值和过去的峰值调整增益(少量)的功能。

5.峰值是绝对的最后N个样本幅度最大的样本值。

6.输出样本=增益*输入样本。
Here is some code to read/write a WAV file in C#.

https://gist.github.com/yomakkkk/2290864[^]

Using that as a basis, you will need to modify the audio samples before writing them back out.

You will need ...

1. a variable that represents gain
2. code to compute the peak of the last "N" samples.
3. keep track of when the last peak occurred (number of past audio samples).
4. function to adjust the gain (in small amounts) based on the current peak and past peak.
5. peak is the absolute value of the sample with the largest magnitude of the last "N" samples.
6. output sample = gain * input sample.