-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Hello all!
This is a question for anyone who may have some suggestions. I have a decent understanding of DSP, but I'm very new to Rust. I'm probably getting ahead of myself trying to learn it with digital audio, but its what is inspiring me to learn Rust so here i am.
I'd like to build an example additive synth, with as many Sine oscillators as I can handle. Ideally, I'd like to have a function to call where I could have a base frequency and N partials as some multiple of the base.
So far I can do this in a naive way by hard coding in each sine wave and then using add_amp to sum them all together like so:
sine_0.add_amp(sine_1).add_amp(sine_2). ... .add_amp(sine_N)but this isn't very nice and it isn't flexible. I'm looking for a way to do something like
sines.reduce(|acc, sine| acc.add_amp(sine))but I can't seem to figure out how to manage the types.
Perhaps I'm going about this the wrong way?
Any input would be welcome, and if there's a better forum than an issue on this repo I'm happy to move the discussion elsewhere.
Thank you!