Merge pull request #719 from jpcima/aria-randoms

Match behavior of random opcodes to ARIA
This commit is contained in:
JP Cimalando 2021-03-19 13:16:14 +01:00 committed by GitHub
commit c8677c26eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -84,7 +84,7 @@ FloatSpec crossfadeOutNorm { 1.0f, {0.0f, 1.0f}, 0 };
FloatSpec ampKeytrack { 0.0f, {-96.0f, 12.0f}, 0 };
FloatSpec ampVeltrack { 100.0f, {-100.0f, 100.0f}, kNormalizePercent };
FloatSpec ampVelcurve { 0.0f, {0.0f, 1.0f}, 0 };
FloatSpec ampRandom { 0.0f, {0.0f, 24.0f}, 0 };
FloatSpec ampRandom { 0.0f, {-24.0f, 24.0f}, 0 };
BoolSpec rtDead { false, {false, true}, 0 };
FloatSpec rtDecay { 0.0f, {0.0f, 200.0f}, 0 };
FloatSpec filterCutoff { 0.0f, {0.0f, 20000.0f}, kEnforceUpperBound };
@ -93,7 +93,7 @@ FloatSpec filterResonance { 0.0f, {0.0f, 96.0f}, 0 };
FloatSpec filterResonanceMod { 0.0f, {0.0f, 96.0f}, 0 };
FloatSpec filterGain { 0.0f, {-96.0f, 96.0f}, 0 };
FloatSpec filterGainMod { 0.0f, {-96.0f, 96.0f}, 0 };
FloatSpec filterRandom { 0.0f, {0.0f, 12000.0f}, 0 };
FloatSpec filterRandom { 0.0f, {-12000.0f, 12000.0f}, 0 };
Int32Spec filterKeytrack { 0, {0, 1200}, 0 };
Int32Spec filterVeltrack { 0, {-12000, 12000}, 0 };
FloatSpec eqBandwidth { 1.0f, {0.001f, 4.0f}, 0 };
@ -105,7 +105,7 @@ FloatSpec eqGainMod { 0.0f, {-96.0f, 96.0f}, 0 };
FloatSpec eqVel2Frequency { 0.0f, {-30000.0f, 30000.0f}, 0 };
FloatSpec eqVel2Gain { 0.0f, {-96.0f, 96.0f}, 0 };
Int32Spec pitchKeytrack { 100, {-1200, 1200}, 0 };
FloatSpec pitchRandom { 0.0f, {0.0f, 12000.0f}, 0 };
FloatSpec pitchRandom { 0.0f, {-12000.0f, 12000.0f}, 0 };
Int32Spec pitchVeltrack { 0, {-12000, 12000}, 0 };
Int32Spec transpose { 0, {-127, 127}, 0 };
FloatSpec pitch { 0.0f, {-2400.0f, 2400.0f}, 0 };

View file

@ -30,7 +30,7 @@ void sfz::FilterHolder::setup(const Region& region, unsigned filterId, int noteN
// Setup the base values
baseCutoff = description->cutoff;
if (description->random != 0) {
fast_real_distribution<float> dist { -description->random, description->random };
fast_real_distribution<float> dist { 0.0f, description->random };
baseCutoff *= centsFactor(dist(Random::randomGenerator));
}
const auto keytrack = description->keytrack * (noteNumber - description->keycenter);

View file

@ -1586,7 +1586,7 @@ float sfz::Region::getBasePitchVariation(float noteNumber, float velocity) const
{
ASSERT(velocity >= 0.0f && velocity <= 1.0f);
fast_real_distribution<float> pitchDistribution { -pitchRandom, pitchRandom };
fast_real_distribution<float> pitchDistribution { 0.0f, pitchRandom };
auto pitchVariationInCents = pitchKeytrack * (noteNumber - pitchKeycenter); // note difference with pitch center
pitchVariationInCents += pitch; // sample tuning
pitchVariationInCents += config::centPerSemitone * transpose; // sample transpose
@ -1597,7 +1597,7 @@ float sfz::Region::getBasePitchVariation(float noteNumber, float velocity) const
float sfz::Region::getBaseVolumedB(int noteNumber) const noexcept
{
fast_real_distribution<float> volumeDistribution { -ampRandom, ampRandom };
fast_real_distribution<float> volumeDistribution { 0.0f, ampRandom };
auto baseVolumedB = volume + volumeDistribution(Random::randomGenerator);
baseVolumedB += globalVolume;
baseVolumedB += masterVolume;

View file

@ -1949,7 +1949,7 @@ TEST_CASE("[Values] Pitch Random")
std::vector<std::string> expected {
"/region0/pitch_random,f : { 0 }",
"/region1/pitch_random,f : { 10 }",
"/region2/pitch_random,f : { 0 }",
"/region2/pitch_random,f : { -4 }",
};
REQUIRE(messageList == expected);
}