MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / perceptualToAmplitude

Function perceptualToAmplitude

source/core/StarAudio.cpp:22–28  ·  view source on GitHub ↗

https://github.com/discord/perceptual

Source from the content-addressed store, hash-verified

20float const DefaultPerceptualBoostRangeDb = 6.f;
21// https://github.com/discord/perceptual
22float perceptualToAmplitude(float perceptual, float normalizedMax, float range, float boostRange) {
23 if (perceptual == 0.f) return 0.f;
24 float dB = perceptual > normalizedMax
25 ? ((perceptual - normalizedMax) / normalizedMax) * boostRange
26 : (perceptual / normalizedMax) * range - range;
27 return normalizedMax * pow(10.f, dB / 20.f);
28}
29
30float amplitudeToPerceptual(float amp, float normalizedMax, float range, float boostRange) {
31 if (amp == 0.f) return 0.f;

Callers 2

updateMethod · 0.85
loadJsonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected