diff options
author | Volker Fischer <corrados@users.noreply.github.com> | 2021-07-18 12:52:44 +0200 |
---|---|---|
committer | Volker Fischer <corrados@users.noreply.github.com> | 2021-07-18 12:52:44 +0200 |
commit | 78c4c6abba8b02e3181c09ce9671cf454553c730 (patch) | |
tree | bff641670779dc4b956ab7919e79e5ae686a6a2c /src | |
parent | 0711d0f5aef38ee60653d52ca2f04c8d7051b1e6 (diff) |
added dynamic expander test code, needed for Edrumulus (do not merge to develop)
Diffstat (limited to 'src')
-rw-r--r-- | src/inputprocessor.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index a883286..2283ab7 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -290,6 +290,26 @@ bool InputProcessor::processOnset(event_t& event, std::size_t pos, { event_sample.scale *= event.velocity; } + +// TEST dynamic expander +//printf("event_sample.scale: %f, event.velocity: %f, sample->getPower(): %f, instr->getMinPower(): %f, instr->getMaxPower(): %f\n", event_sample.scale, event.velocity, sample->getPower(), instr->getMinPower(), instr->getMaxPower()); + +auto instr_dynamic = 10 * log10(instr->getMaxPower()) - 10 * log10(instr->getMinPower()); +auto sel_power = 10 * log10(sample->getPower()); + +auto target_dynamic = 35.0; // dB +auto target_max_power = 10 * log10(instr->getMaxPower()); +auto target_min_power = target_max_power - target_dynamic; + +auto target_power = event.velocity * target_dynamic - target_dynamic + target_max_power; + +auto diff_power = target_power - sel_power; + +event_sample.scale = pow(10.0, diff_power / 20); + +//printf("event_sample.scale: %f, diff_power: %f, target_power: %f, sel_power: %f\n", event_sample.scale, diff_power, target_power, sel_power); + + } } |