RobinSchmidt / RS-MET

Codebase for RS-MET products (Robin Schmidt's Music Engineering Tools)
Other
56 stars 6 forks source link

TriSaw Oscillator #209

Closed elanhickler closed 2 years ago

elanhickler commented 6 years ago

Dood. This is amazing. It provides easy access to Square/Saw/Tri/Sine/AntiSine (Spike) and everything inbetween including pulse width modulation. I should use this everywhere in place of Square/Saw/Tri/Sine. Hmm well the sine is not perfectly a single harmonic, but the spectrum is nice and clean.

image

RobinSchmidt commented 6 years ago

glad, you like it. yes, i'm quite happy with it, too. can be used to replace a switchable fixed-waveform oscillator. capability-wise, it reminds a bit of the xoxos osc, but the in-between shapes and parametrization are different.

i think, the asymmetry- and bending-parameters would benefit from a paremeter mapping curve, like the tanh or the rational s-curve (it needs finer resolution at the ends and less in the middle). i was already experimenting with that a bit. i wonder, how we could come up with a general and somewhat "scientific" method to figure out, what the best mapping curve for a given parameter is. i was trying to put a sine-LFO on the parameter to modulate it over the full range and trying to find a map for which the modulation sounds smoothest....or most "sinusoidal"...or something. things like that are the "art" part in designing instruments and make the difference between whether or not an algorithm responds "musically" to parameter changes

elanhickler commented 6 years ago

listen: https://hearthis.at/soundemote/toolchain-4xtrisaw/

<?xml version="1.0" encoding="UTF-8"?>

<ToolChain PatchFormat="1" ActiveSlot="5">
  <Slot Type="TriSawOscillator">
    <Slot1-TriSawOscillator PatchFormat="1" AttackSigmoid="1" DecaySigmoid="1"/>
  </Slot>
  <Slot Type="None">
    <Slot2-None PatchFormat="1"/>
  </Slot>
  <Slot Type="TriSawModulator">
    <Slot3-TriSawModulator PatchFormat="1" TimeScale="0.369982" Attack="316.228" Decay="2.43424"
                           Floor="-2" Ceiling="-2" AttackBending="-0.1875" DecayBending="0.528409"
                           AttackSigmoid="1" DecaySigmoid="0.676136"/>
  </Slot>
  <Slot Type="TriSawModulator">
    <Slot4-TriSawModulator PatchFormat="1" TimeScale="3.42051" Attack="26.3302" Decay="160.157"
                           Floor="0" AttackSigmoid="1" DecaySigmoid="1"/>
  </Slot>
  <Slot Type="TriSawModulator">
    <Slot5-TriSawModulator PatchFormat="1" TimeScale="21.9235" Attack="100" Floor="0" Ceiling="0.988636"
                           AttackBending="-0.772727" DecayBending="0.948864" AttackSigmoid="1"
                           DecaySigmoid="1"/>
  </Slot>
  <Slot Type="None">
    <Slot6-None PatchFormat="1"/>
  </Slot>
  <Modulations>
    <Connection Source="Slot3-TriSawModulator" Target="Slot1-TriSawOscillator.Asymmetry"
                Depth="0.5" DepthMin="-1" DepthMax="1" Mode="Absolute"/>
    <Connection Source="Slot4-TriSawModulator" Target="Slot3-TriSawModulator.Ceiling"
                Depth="1" DepthMin="-1" DepthMax="1" Mode="Absolute"/>
    <Connection Source="Slot5-TriSawModulator" Target="Slot1-TriSawOscillator.Asymmetry"
                Depth="1" DepthMin="-1" DepthMax="1" Mode="Absolute"/>
    <RangeLimits>
      <Slot1-TriSawOscillator.Asymmetry Min="-2" Max="inf"/>
      <Slot3-TriSawModulator.Ceiling Min="-inf" Max="inf"/>
    </RangeLimits>
  </Modulations>
</ToolChain>
RobinSchmidt commented 6 years ago

sounds cool. but i tried to use the patch myself and here, it just produces very quiet clicks

elanhickler commented 6 years ago

Yes, there might be a bug... hold on, let me get the details. In the mean time:

image

Here I am modulating the TriSaw Asymmetry and you'll notice there are edges because I'm modulating it so fast in one direction. This is the kind of thing I want to solve with a physically modelled type synth. Maybe all that is needed is a filter to limit the rate of change. Edit: But an up/dn slew limiter would be better than a filter because we don't want to lose amplitude! A Vactrol emulation would be even better.

elanhickler commented 6 years ago

Here's the bug:

image

Even if Slot4 TriSawModulator modulation amount is 0, you'll still get silence, until you REMOVE the modulation connection completely and wiggle the Ceiling slider.

RobinSchmidt commented 6 years ago

ok - this is weird. somwhere, an infinite value is produced and set for the ceiling. i added a couple of assertions. i also chnaged the ModulationSource interface a little. you now need to override getModulatorOutputSample() instead of updateModulationValue(). it's better design and i can check the modulation value in the framework

elanhickler commented 6 years ago

I just found a very good usecase for this oscillator for Chaosfly/FMD. I wanted to design a filter that is "lofi" that is noisy at the high frequencies and crunchy at the low frequencies. Some internal lowered samplerate would make it even more unique. But anyway, I discovered that using a square wave instead of sine wave (for one of the internal oscillators [yeah I use 0hz oscillators instead of filters usually]) makes it nicely noisy. But now I want to be able to dial in amount of noisiness. Easy, just use a TriSaw and morph from sine to square.

RobinSchmidt commented 6 years ago

ok - we have a TriSaw module in liberty. also drag an update of the support folder. there are two new patches creating a TriSaw osc (one mono, one poly - the mono doesn't work right - there seems to be a bug somewhere)

elanhickler commented 2 years ago

solved