Closed elanhickler closed 2 years ago
oh - are you already using it? it's actually not yet ready for use. i was just experimenting a bit with the algorithm, the parametrization, etc.
I'm not using it actually, I'm using this for now since I have a phase parameter. Both are the same thing essentially.
// multiply angle by half pi for normalized range
double xoxos(double phase, double offset = 1, double angle_sin = 1, double angle_cos = 0, double scale = 1)
{
double s0, s1;
sinCos(phase*TAU, &s0, &s1);
double x = s0 * scale;
double t = s1 * offset;
double out = (t * angle_sin + scale * angle_cos) / sqrt(t * t + x * x);
return out;
}
// multiply B by TAU (before sin/cos calculation) for normalized range
double xoxos(double phase, double A = 0, double B_sin = 0, double B_cos = 1, double C = 1)
{
double sin_x, cos_x;
sinCos(phase*TAU, &sin_x, &cos_x);
double sqrt_val = sqrt(pow(A + cos_x, 2) + pow(C*sin_x, 2));
double out = ((A + cos_x)*B_cos + (C*sin_x)*B_sin) / sqrt_val;
return out;
}
So, my Nobunaga filter, to go from screaming square wave resonance to sinusoidal resonance/no resonance, I need a sine to square oscillator.
omg it's so beautiful.
notice how the waveform goes to silence once it's not square enough.
I'm going to be a fukin' expert on analog-style digital filter design. It's amazing how I'm getting analog filter behaviors using these brain-dead methods. Want a screamy filter? Oh, just use a square oscillator! And it behaves exactly like an analog filter. As you turn the sine into square, it is EXACTLY like turning up resonance. Once the square goes past a certain point (more sine-wave, less squary) it stops self-resonating. WTF? It works so well. I'm going to continue to discover tricks like this.
what is a nobunaga filter? the image is not shown. if you need a smooth transition from sine to square, isn't the algorithm above a bit overkill? wouldn't (soft)clipping a sine also work (maybe even more naturally)? btw.: calling pow(x, 2)
is very wasteful. pow is one of the more expensive math functions and you are using it there for the effect of a simple multiplication
It's amazing how I'm getting analog filter behaviors using these brain-dead methods
that's cool. using straightforward methods is probably cheaper and easier to control and tweak than actual circuit models. how do you drive the oscillator? where does it get it's phase from? is it free-running? i think, it should somehow be driven by the input signal
.
(fixed the missing image)
yeah, Robin, if you want to make a sine to square oscillator that would be helpful, although the full expression of the ellipse oscillator is going to allow for some new filter behaviors and timbres.
nobunaga filter is one of my creations: audio: http://www.elanhickler.com/_/FMD/FMD%20-%20Japan%20-%20Nobunaga.mp3
soft clipping would not work because it is amplitude-dependent. I need sine to square without a change in amplitude, I just need a sine to square oscillator. It's just an easier paradigm. I'm removing the complication of amplitude, I'm decoupling variables, getting more precise control. I will continue to find better ways to do things.
how do you drive the oscillator?
FM and PM, sometimes self-modulation, sometimes cross modulation, and of course the input will modulate FM and PM as well
where does it get it's phase from?
see first question
is it free-running?
sometimes, depends on the filter model. usually the oscillator is set to 0hz.
I need to explore more methods of modulation as well to get more precise control of behavior and timbre.
see my kvr post for more FMD demos: https://www.kvraudio.com/forum/viewtopic.php?p=7145803&sid=43bb28d674f8f130a9d115f8a332d26f#p7145803
I need sine to square without a change in amplitude, I just need a sine to square oscillator.
i have an idea. TriSaw -> Boost (>= 1) -> HardClip (at -1..+1) -> times 0.25 -> Sin (as waveshaper). i'll try to throw it together in liberty. ..to make it more convenient, i'll first need a scaler module (to replace a multiplier and a constant). without boost (i.e. = 1) and a triangle input, it should give you a sine. boosting should gradually turn it into a square. asymmetry can be additionally used
see my kvr post for more FMD demos: https://www.kvraudio.com/forum/viewtopic.php?p=7145803&sid=43bb28d674f8f130a9d115f8a332d26f#p7145803
cool! :-)
nice, dood, robin, the next step for my filter design may be crazy morphable oscillators. It's like... everything I do creates new and interesting results. So yes, I can definitely use an asymmetry parameter, that will lead to new and unexpected timbres/tones/behaviors/waveshapes.
I also REALLY need to explore frequency-scaled frequency clipping! Yes! It's weird idea right? But I find that, if I limit frequency via a hard clipper on the frequency variable it results in drastic grungy sound and waveforms. I could also explore a quantizer on the frequency as well as soft clipping the frequency. Actually it has another benefit, it's an easy way to prevent harsh frequencies when designing a filter that relies on high amounts of internal modulation and feedback.
This rabbit hole is never going to end. I could see myself producing a weird circuit bent synthesizer that makes all sorts of crazy sounds. That's why I need an auto-tuner for this synth idea. I need to tune these crazy oscillations. I want to take the idea of FMD and make a dedicated synth.
edit: hmmm... actually I dunno about the idea of doing an FMD-based synth. Using straight self-oscillation out of most of these filters are not very interesting. Definitely though I can come up with something interesting in terms a synth based on crazy internal modulations.
TriSaw -> Boost (>= 1) -> HardClip (at -1..+1) -> times 0.25 -> Sin (as waveshaper). i'll try to throw it together in liberty
done. there's a new ToolChain patch TriSawToSine. tweak "Boost" to morph from sine to square, "Asymmetry" is some sort of pulse-width control when the waveform is squarish (if it's sineish, it makes a sort of skewed-sine). for the time being, i resorted to do it without the scaler module. there are some issues to sort out for such a module...
...sooo...maybe i should make a rapt class for that? maybe as subclass of the existing TriSaw class. maybe i could also use a clipper with adjustable hardness instead of the plain hardclipper. and/or make the sinusoidal waveshaper use a selectable function
maybe the (raw) boost parameter, which currently goes from 1..inf (i capped it arbitrarily at 20 in the patch), could be related to a user parameter in the range 0..1 by y = 1/(1-x). if x=0, y=1 and if x=1, y=inf
sounds good! After I design a filter then I can see what features I'm using. If I happen to need a simple sine to square it might be good to have plain sine to square oscillator without any other features (for efficiency?) Other times I might want to experiment with additional timbres and waveshapes so then the additional features will come in handy.
solved
please add a phase parameter to rosic::ellipseOscillator