rodio
rodio copied to clipboard
Quadratic and Sawtooth waves
Hello! Tell me, please, is it possible to create quadratic and sawtooth waves? I found only a sine wave in the documentation
Not part of the official library, but if you'd like an example to work from (or copy verbatim π) I have a sawtooth wave for a toy project I'm working on.
https://github.com/smangelsdorf/rtttlsynth/blob/fcd7be5908599553b528eaf401731bcf42c02914/src/synth/oscillator.rs
If there's any interest from the project maintainers I'd be happy to tidy this up and PR it as a library feature.
I was curious, so I looked, but I couldn't find a standard definition for a quadratic wave. What do you have in mind for that?
I imagine it being something like this, but I could be way off π
I was curious, so I looked, but I couldn't find a standard definition for a quadratic wave. What do you have in mind for that?
I imagine it being something like this, but I could be way off π
I mostly asked the AI π
Ah, that's interesting. I asked GPT too, but I confused it by asking the wrong question. I was expecting another fundamental wave.
Adjusting the pitch over time based on a quadratic function is trickier. Both the inbuilt SineWave
and my SawWave
implementation have a fixed frequency, so won't work properly for that. As far as I know, the oscillators would need to support being modulated by some function, or else accept a pitch envelope describing the pitch over time.
As a random internet guy, I can't say whether that's something Rodio wants to support or whether it should be in a separate library, but it sounds like it would be fun to build. π
Hi! I know a little about Quadratic Waves. They are related BΓ©zier curves.
- Take two non-Parallel lines AB and BC (i.e they share a point B).
- Trace a point on starting at A to B (called V). At the same time, a second point from B to C (called W).
- Lerp between the line created by WV.
- The midpoint of WV traces a quadratic curve.
I'm not sure if this is what @anti7447 meant. It does come up in computer music, usually used as envelopes. Rodio is open source, so If people want to throw it in, awesome. I would consider quadratic enveloping outside the scope of Rodio.
I really liked this animation.
If @anti7447 would like to implement a sawtooth wave with rodio in it's current form, he could consider this formula. Rust is totally fast enough to handle this.
Hello! Tell me, please, is it possible to create quadratic and sawtooth waves? I found only a sine wave in the documentation
@anti7447 Did you figure it out? If not let me know! And if you did ill close this issue.
Rodio is open source, so If people want to throw it in, awesome. I would consider quadratic enveloping outside the scope of Rodio.
It would be a great fit for a third party crate extending Rodio by providing more Source
's. If something like that grows and becomes popular it could even be taken over by the RustAudio group. Feel free to begin something like that and add all the waves you need :) It think we would happily link to it from the Readme.