Skip to content

Commit

Permalink
Better makeup gain
Browse files Browse the repository at this point in the history
  • Loading branch information
p42ul committed Mar 2, 2024
1 parent dc8956a commit b44d4b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "resotool"
version = "0.3.0"
version = "0.3.1"
edition = "2021"
authors = ["Paul Buser <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down
27 changes: 13 additions & 14 deletions src/voicer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,21 @@ impl Voicer {
let voices: [Voice; NUM_VOICES] = std::array::from_fn(|_| Voice::default());
let voices_sounding: Shared<f32> = Shared::new(0.0);
let wetdry = Shared::new(1.0);
let filterbank = stack::<VoiceSize, _, _>(|i| {
let filterbank = sum::<VoiceSize, _, _>(|i| {
let voice = &voices[i as usize];
(
pass() *
(
var(&voice.trigger) >>
(adsr::adsr_shared(voice.adsr.attack.clone(),
voice.adsr.decay.clone(),
voice.adsr.sustain.clone(),
voice.adsr.release.clone())))
| var(&voice.cutoff) | var(&voice.bandwidth
)
)
>> resonator() * var_fn(&voices_sounding, |vs| NUM_VOICES as f32 / vs)
(pass()
* (var(&voice.trigger)
>> (adsr::adsr_shared(
voice.adsr.attack.clone(),
voice.adsr.decay.clone(),
voice.adsr.sustain.clone(),
voice.adsr.release.clone(),
)))
| var(&voice.cutoff)
| var(&voice.bandwidth))
>> resonator()
});
let wet = (split() >> filterbank >> join()) * var(&wetdry);
let wet = (split() >> filterbank) * var(&wetdry);
let dry = pass() * var_fn(&wetdry, |wd| 1.0 - wd);
let audio = Box::new(wet & dry);
Self {
Expand Down

0 comments on commit b44d4b1

Please sign in to comment.