简体   繁体   English

跨平台库以规范音频?

[英]Crossplatform library to normalize audio?

您知道我可以用来标准化采样音频的任何跨平台音频库吗?

normalization is an easy process. 标准化是一个简单的过程。 this is a simple implementation for float s: 这是float的简单实现:

float peakAmplitude(0.0f);

/* find the peak */
for (size_t idx(0); idx < bufferLength; ++idx) {
    peakAmplitude = std::max(peakAmplitude, std::fabs(buffer[idx]));
}

if (0.0f >= peakAmplitude) {
    std::cout << "signal is silent\n";
    return;
}

/* apply normalization */
const float mul(1.0f / peakAmplitude);
for (size_t idx(0); idx < bufferLength; ++idx) {
    buffer[idx] *= mul;
}

other signal formats can be easily converted. 其他信号格式可以轻松转换。

Google is your friend: Google是您的朋友:

http://normalize.nongnu.org/ http://normalize.nongnu.org/

https://neon1.net/prog/normalizer.html https://neon1.net/prog/normalizer.html

If you can't use GPL code in your project, then just read the description of the algorithm on the second website and implement your own. 如果您不能在项目中使用GPL代码,则只需阅读第二个网站上的算法说明并自行实现即可。 It's pretty simple. 很简单

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

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