FM Waveshape VCO
  • image

    FM Waveshape VCO

    o - Octave signal (pitch)
    e - Envelope (built-in VCA)
    m - FM modulation input
    g - Pitch decay envelope gate

    a - Audio

    wave - Morphs between sine-triangle-square-saw
    PWM - shape control for square and saw waves
    FM - DC attenuverter for modulation input - linear FM covering 3 octaves. The knob is exponentially scaled. The FM input is normalized so when you don't have a modulation source plugged in, after half a second it will ignore the FM knob (otherwise, the FM knob would have to be returned to exactly center to avoid unwanted detuning).
    D - Pitch envelope decay - 1ms-4s. The knob is exponentially scaled.
    -/+ - attenuverter for pitch decay envelope - left is pitch up, right is pitch down.
    shape - linear to exponential

    Decay display:
    Red = pitch down (start high, go low)
    Blue = pitch up (start low, go high)
    Green = envelope finished (no detune).
    FM Waveshape VCO.audulus
    Screen Shot 2017-05-29 at 10.40.01 PM.png
    998 x 714 - 122K
    Waveshape VCO Example.audulus
  • [double post]
  • Hi @biminiroad

    I had a little play with this, and I have a couple questions.

    First, could you explain the way you've designed the FM "circuit"? All the DC inversion, chains of multipliers etc. are leaving me baffled. My own experiments have been far simpler (patch attached), and I am wondering what the benefits are.

    Secondly, why does your linear FM result in a pitch change? I suspect the answers may be related, but should linear FM not avoid a shift in frequency centre?

    I'm still learning synthesis, and Audulus, so I beg your patience!
    Basic Oscillator II.audulus
  • @Audioneiromancer

    The "m" input on the side is for frequency modulation. It's linear and if the knob is turned all the way to the left or right, it will cover 3 octaves. If the knob's in the middle (0.5), there won't be any modulation. Turning right will be the modulation signal as it's coming in, turning left will invert that modulation.

    "Secondly, why does your linear FM result in a pitch change?" Does it? You need to attach a 0-1 modulation signal to the m input - if you attach an alternating signal -1 to 1 range, then it will drift the pitch. Maybe I made it wrong, but I remember running into that problem and thought I fixed it.

    Also, your linear FM in your patch doesn't really look linear - you're inserting it after you take the linearized VPO signal is turned into an exponential pitch signal.

    And no worries! I'm here to answer any and all questions :)
  • Ok, so I may be misunderstanding basic principles here.

    My assumption previously was that audio rate FM would use audio output from an oscillator (and hence alternating signal). I appreciate that it's the rate that is audio, and it doesn't have to be an alternating signal. But I thought that the ability of the modulator to reduce the frequency (with negative signal) is what necessitates through-zero FM in some modules. I've seen people patching modular that way in videos, I believe...

    And regarding my setup, my understanding was: by varying the *frequency* by a linear amount either side of its starting point, it avoids any pitch drift, as the average frequency is the original carrier signal. Whereas with exponential FM, you modulate the *note*, the frequency changes exponentially relative to the modulation. I've certainly achieved results that matched my expectations using my approach, and I believe others here steered me on that course, but it may not match up to conventional FM techniques, as I've been teaching myself.
  • >Also, your linear FM in your patch doesn't really look linear - you're inserting it after you take the linearized VPO signal is turned into an exponential pitch signal.

    @biminiroad, I think there may be some confusion here. VPO is the exponential signal, as an increase of one volt doubles the frequency. Linear, by definition, is arranged in or extending along a straight or nearly straight line. So when you take the input signal and multiply it by itself several times it really isn't linear in the normal sense of the word. Although it sounds good, so why quibble over particulars.

    @Audioneiromancer My critique would be that there is no response when you feed a bipolar waveform into the linear response of the BOSC II. In a through zero liner FM design, typically the waveform will invert. Here it stays at 0Hz. (see attached image)

    Attached is what I think would be linear through zero FM where the waveform is inverted when the value of the hz is negative and an absolute value expression is added to the chain so there continues to be a frequency response for both halves of a bipolar input. I may be wrong about this as well, I'm just going off of youtube videos.

    This is OS describing the disting linear FM VCO, the video preview doesn't seem to be working for some reason.

    Screen Shot 2017-07-02 at 9.19.50 AM.png
    837 x 686 - 81K
  • Hi Robert,

    Yep, I agree that my implementation is rudimentary (The B of BOSC is for basic, and was only ever meant for my experiments really - posted here for demonstration of my question). I'll take a look at your patch, though, thanks! Thru zero would be a nice addition!
  • Although there is a response with a bipolar signal, for as long as the amplitude of the modulator, and the frequency of the carrier, allow for the sidebands to remain above 0hz!
  • Although this is probably my through-zero ignorance shining through...
  • I'm getting a really stark change in sidebands, presumably when the carrier dips below zero. Is this to be expected?
  • I think I get the basic idea of a linear FM oscillator, linear frequency shift with an inverted output waveform if the modulation input is negative. What is the expected output if the modulation input is exactly zero? Some references seem to suggest it would be zero.
  • If the -modulation- is zero, the unmodulated waveform would be passed. If the carrier signal is modulated to 0hz, I believe it would be a signal fixed at whatever amplitude the oscillator was at the point it stopped oscillating (i.e. reached zero hz), which would be inaudible.
  • Well I would definitely defer to @stschoen on this one, the error is likely in my execution. Looks like a learning experience all around.
  • Ultimately I doubt it much matters if the output from the oscillator is zero at zero modulation or whatever fixed value the carrier happens to be at when the modulation reaches zero. If I understand things correctly, as the modulation input falls below zero, the output of the carrier is inverted causing the waveform to abruptly cross zero as well. In the ideal case the output would be zero at zero modulation since the waveform is changing polarity. Of course a real analog oscillator will be limited to the maximum slew rate that the electronics are capable of, and I would assume that the anti-aliasing in Audulus would also prevent an abrupt transition. In any case because of this abrupt polarity change, I would expect a very different output waveform when the carrier is modulated by a signal that crosses zero compared to the same modulation frequency that remains positive.
  • Here's my effort at a linear FM zero-crossing oscillator. Like @biminiroad's it will morph between waveforms although it doesn't have the pitch decay function. I finally figured out the smoothstep() function and used it to drive the morphing. It still needs some work because I believe the abrupt switch of polarities as the modulator crosses zero is introducing some significant aliasing. Any suggestions?
    FM Osc.audulus
    FM Osc.png
    375 x 298 - 32K
    FM Osc Demo.audulus
  • I've just concluded that aliasing is just part of the Audulus sound until variable sample rate comes along so I go with the flow. Fortunately aliased sounds are great harmonic content for filters, but I can understand if they are annoying when unwanted.

    This issue what actually constitutes thru zero FM has really piqued my interest. Allow me to make inquiries with my friends at the Modular Meetup. There are a couple of guys who have built their own FM VCO's and might have something to contribute to the dialog.

    I would say that what is the correct thru zero FM definition not be as important as what you think sounds good. I often find in Audulus that I set out to do something in particular, go a ways and realize I am doing something incorrectly. But the result sounds interesting none the less so I'm not bothered by it. And I like the oscillator FM sounds of the patches posted on this thread. :)
  • I would be curious to hear what you find out. I did a bit more digging myself and I think my first attempt was faulty. I believe that rather than switching polarity (180 degree phase shift) the waveform actually reverses as the modulator crosses zero. At this point I'm not sure how to achieve this using Audulus but I'll give it some thought.
  • Robert - I totally agree: whatever sounds good is working right!

    I'm curious to hear too, so I'll keep a eye here. A very useful discussion with all of us, so thanks all!
  • So I wrote to Don Tillam, who posted his design for a thru-zero FM oscillator on his website

    Hello Don,

    I know it has been a while, but I hope all is going well over at Consolidated Fuzz.

    I was also hoping I might rely upon you an authority on thru-zero FM. Having skimmed through the Quad Trapezoid VCO article I understand that thru-zero means that a modulation source can push the frequency below what would be zero hz into negative frequencies. Are the negative frequencies effectively the same as using an absolute value function? Does the waveform invert when the frequencies are negative, turning a saw into a ramp wave? Finally, if I were using a bipolar audio rate signal as a modulation source, doesn't thru-zero FM with negative frequencies create more complex side-bands than the frequencies further away from 0hz?

    Anything you have to say on the topic is greatly appreciated.



    He replied:

    Hi Rob,

    No problem...

    Negative frequencies naturally occur in the regular world. For instance, a beat frequency between two neighboring pitches while you're trying to tune one to the other, a little sharp, a little flat.

    Or a turntable; you can spin it at 33-1/3, slow it down, bring it to halt, spin it backwards, whatever.

    Think of a thru-zero sine wave oscillator as a turntable, with a marker point on it so you can watch the marker spin. Lower your position and view it from the horizontal, and you can watch the marker go back and forth, left and right, in a sine pattern.

    Now, make like a wacky DJ and change the speed from positive to negative. If the marker was, say, at the extreme right when you changed polarity, you wouldn't be able to tell, forward or backward, positive or negative frequency, it's gonna go back toward the center, as it's already at the extreme end.

    But, if you change direction when the marker is crossing the center, it'll be really obvious, it'll completely change direction.

    So, thru-zero is not the same as an absolute value function, although sometimes it can appear that way.

    Yes, a thru-zero sawtooth will go from a ramp up to a ramp down as you cross zero Hz. (I'm not sure I like the terminology "ramp" vs. "saw".)

    I'm not sure I understand the last question. There has to be a lot of modulation to bring an oscillator through zero Hz, so there's going to be a lot of sidebands anyway.

    -- Don

    So there you have it. I will have to put some thought into how to make sense of that in Audulus, but I think it's a pretty good place to start.
  • Thanks for asking the question. Rob's response is similar to the information I found in the Electronotes newsletter. As I understand it, when the modulation crosses zero the oscillator behaves as if time runs backward. As @audioneiromancer mentioned, when the modulation reaches zero the oscillator outputs whatever value it was at in the waveform. As the modulation swings negative the oscillator moves in the opposite direction. For example if a ramp is at 75% and rising as the modulation crosses zero it switches to a saw (reverse ramp) at 75% and falling. The Audulus oscillator node however, goes to steady state as the Hz input goes to zero and remains there as the Hz goes negative, but I discovered earlier this evening that the phaser node behaves as zero crossing oscillator. With negative values applied to the Hz input the output is a saw, with a smooth switch at zero. I've built a linear, zero crossing oscillator using the phaser node and it seems to be working. It still needs some fine tuning, but I should be able to post it tomorrow.
  • wow, I had not noticed that before!

    Screen Shot 2017-07-04 at 12.31.55 AM.png
    897 x 707 - 96K
  • Here's my second attempt. I shamelessly stole some of biminiroad's ideas and included an exponentially scaled modulation control and a cross-faded mixed output. the mix fades between sine and triangle, then triangle and square, then square and ramp so there are at most two wave shapes mixed at any time. At 0, .25, .50 and 1 the mix out is a pure waveform. The modulation knob is 1 to 1 at 0.5. Because this a zero-crossing oscillator, a negative value on the m input will reverse the waveforms. Typical envelope, sync, and octave inputs are included. Because this is built from the phasor node, there is no built-in ant-aliasing. Additionally, this is a DC coupled unit and some of the output waveforms with some modulators have a significant DC component, so using a DC blocker when required is probably a good idea.
    Linear Zero-Crossing FM Oscillator.audulus
    Screen Shot 2017-07-04 at 12.20.45 PM.png
    240 x 204 - 24K
  • @biminiroad, I really liked your attenuverter design. Very elegant, particularly the use of the spline node. I admit I had to go look up "attenuverter" to see what it did. There's so much to learn about modular synthesis. Thanks for making the job a whole lot easier. I also thought your auto-normalizing FM was very clever. It would be great if at some point the input and output nodes had an additional output that switched based on whether there was a connection to the node. It would make normalized inputs much simpler (kind of like the way the knob touch is disabled when a modulation input is attached).
  • Can't wait to try this @stschoen! Thanks for your work, and thanks Robert for the research. The phasor is a great find.

    But a quick point of order to satisfy my inner pedant (although with synthesis, terminology is pretty crucial). It's not the modulator crossing zero that's significant (even a simple LFO vibrato effect crosses zero as it oscillates), but the carrier i.e. something producing audio (when the modulator is negative, and hence pulling down the carrier's frequency).

    It sounds as if we're all saying the same thing, and it seems we all understand the mechanics (or there abouts). I hope my pedantry isn't too irritating. If I thought it was irrelevant I'd try and repress the urge!

    Anyhow, thanks again all, I ruddy love this community.
  • @Audioneiromancer yes, the zero being crossed is the carrier's 0hz.

    @stschoen I think you have made a thru-zero linear FM across 16 octaves, please confirm.
  • You are correct. It's actually the frequency requested of the oscillator that becomes negative. I was thinking of the case where you are modulating the frequency of the oscillator directly (0 input = 0 frequency) instead of modulating some base value frequency. It's actually the behavior when the combined value of the base frequency input and the modulator becomes negative that is of interest.
  • @RobertSyrett, I think that's correct, although I admit when I was scaling the modulation input, I just picked some numbers that let me get low enough to use the waveform display. I wanted something with enough range to be useful.
  • @stschoen I made the following adjustments to my copies of your oscillators. I changed the -sin(x) to cos(x) so that it would be phase aligned with the triangle wave, added exponential scaling to the modulation index knob so that it only gets super extreme at when it's almost fully clockwise. Also, I appreciate that you reversed the diagram of the saw wave from the osc node so it is accurately displaying a ramp wave :)
  • Aha! Well, I understand now, and have learned something in the process. I didn't realise that was an option!
  • Hang on, where did those waveshape symbols comes from?!
  • He's using the SVG utility to make his own graphics. Pretty sweet, no?
  • @RobertSyrett, good catch on the -sin(), I've changed my copy as well. Not sure I understand regarding the modulation knob, it's already exponential. I did offset the value of the exponent so that I could drive the value way down, perhaps it would have been better to offset the value of the exponential function instead. My approach does lead to a pretty steep ramp at center. The inverted ramp graphic has always bugged me a little, although it does match the inverted waveform display.
  • I just meant I used a mult node ;P

    Yeah ramp/saw icon on the osc node matches the Audulus waveform display but when you use an actual oscillator or listen to it modulating something it's a different story.
    Screen Shot 2017-07-04 at 1.22.52 PM.png
    319 x 196 - 23K
  • @RobertSyrett, I changed the -sin() to a cos() and redid the scaling function. I used the smoothstep() which generates a sigmoid curve. The scaling is now steep at both ends and gradual in the middle. I also added a scale factor display. Thanks for all the help!
    Linear Zero-Crossing FM Oscillator.audulus
  • Third and final revision (I hope). I added a shape control similar to the one on the standard oscillator. It took me forever to figure out how to change the ramp shape in the same fashion as the standard oscillator. Too much math for an old brain.
    Linear Zero-Crossing FM Oscillator.audulus
    Screen Shot 2017-07-05 at 11.26.58 PM.png
    335 x 298 - 31K
  • Well I would have gone about that differently, but it's impressive that you got the saw shape modulation all done in a single expression. :)
  • I just realized I can finally have a phase shift control. Since l have to use the phasor node for the zero-crossing, l can easily shift the phase of the output. Works great, post tomorrow (working on iPad at the moment). I guess it's now the Mark IV
  • I have been meaning to ask if you have seen the PM operator module @plurgid made?

    Maybe check it out after you finish yours though. I wouldn't want to interfer with your inspiration.
    Plurgid FM Operator (PM).audulus
  • @plurigid's PM operator is very impressive. If I understand the patch internals he's basically using the same approach I chose to create the phase shift. Here's my last and final take on the FM oscillator. I added a variable phase shift knob that swings the phase by one cycle and a reference clock that outputs the unshifted phase for sync purposes.
    Linear Zero-Crossing FM Oscillator Mk IV.audulus
    Screen Shot 2017-07-07 at 10.51.30 AM.png
    1220 x 727 - 161K
  • Wow, very succinct! It's elegant enough that I had to include it in my mini osc. It responds pretty naturally to negative modulation so you might want to make it an input as well. You can even run a little bit of the signal back to the phase modulation for casio style phase distortion. More than just a little and it turns into noise, though.

    edit: added example patch

    edit2: @demcanulty Do you think this technique could be used for emulating a phase comparator and recreating a phase lock loop?
    Mini Osc.audulus
    Screen Shot 2017-07-07 at 9.08.04 AM.png
    471 x 325 - 37K
    phase feedback voice.audulus
  • I debated making it an input instead of a knob. I hadn't considered negative phase shifts. I'm a bit reluctant to abandon the 0-1 convention for modulation but in this case I think it makes sense. Currently, modulation values > 1 or < -1 currently cause the shift algorithm to fail. Guess l should clamp or cycle larger values.
    Edit: l checked my demo and negative doesn't seem to work properly. The output waveforms are significantly distorted. It could be made to work between-1 and 1 if you think it's worth the effort
  • I think clamping is probably fine, how would you even cycle the larger values? BTW, the algorithm has already come in handy in a couple of patches that had really awkward patching to create specific phase alignments. So many thanks again!
  • I think you could probably do it using the mod function but I decided that -1 to 1 was adequate for now so I removed the knob, clamped the input between -1 and 1 and added phase as an input.

    Edit 7:26 PM 7/7 - I realized the fract() function does what we want. It returns a value between 0 and 1 for any number and if the number is negative it returns 1 minus the value. Kind of a revolving clamp.
    Screen Shot 2017-07-07 at 6.16.53 PM.png
    1306 x 796 - 190K
    Linear Zero-Crossing FM Oscillator Mk V.audulus
  • Wow, TIL there was a fract(x) function. Looking good on the FM/PM modulation front. I think this should probably be a library module.
  • Thank you very much for the complement. I'm always torn between building the "kitchen sink" kind of module and something that is single purpose. Sometimes I think it's better to KISS and sometimes I think it's nice to have it all in one place. I really hope that we get a reliable way to implement a "normalized" input (if I'm using the terminology correctly). It would be nice to have a default connection internally if none were made from outside a module. Still, the fact that you can modulate a knob allows you to set a kind of default.
  • > I really hope that we get a reliable way to implement a "normalized" input (if I'm using the terminology correctly). It would be nice to have a default connection internally if none were made from outside a module.

    Totally. I have been working on my dual complex oscillator again and my reference, the DPO from Make N0ise has 8 internally normalized jacks on the front. I have been vacillating on whether to make switches next to each input, add the signals together and ignore normalling, or just use the internal connections by removing the inputs and simplify my life.
  • @RobertSyrett, here's a really down and dirty solution to the normalized input. Disconnect the modulation from the knob and watch the output value. Not entirely foolproof, but I thought you'd like it.
    Normalized input.audulus
  • Ahhhh, so you are using the knob's max and min to the highest possible 32 bit number so you can't even turn it. Then you set up a if then expression that only takes income from that knob if it's less than the max else take the normalized input. The way the knob works is such that any number attached to it overrides the min/max settings creating a switch. The only problem would be if you were using signals that got as high as 1e11+11. Very clever. I made a slight adjustment to the svg graphic so now it masks the knob making it clear that the knob is never to be used as a knob.
    Normalized Input grey edition.audulus
    Screen Shot 2017-07-08 at 3.31.35 PM.png
    961 x 587 - 87K
  • Exactly! I knew you'd like it. I thought about masking the knob myself. I tried stacking two knobs but the lower knob gets the focus so if you arrange it so the knob is adjustable, what shows is the completely grey knob (at least until you touch it) I have a knob arc graphic in the templates document but I thought it might be too confusing.
  • @stschoen Ok, so I popped in the normalization into my patch and got instant white cords, freezing everything. I set up a separate patch with just some phasors and got some interesting results. Even though the value node was reading the correct numbers, the phasor went nuts. I adjusted the knob's max/min to 3 from 1e11+11 and got better results, although it makes the value jitter on my computer. At anyrate I would love to hear your take on what's going on.
    normalization test.audulus
  • Hmm, I'll have to check that out. I assumed we could override the knob, but it sounds like it may cause some unintended consequences. I have to admit I didn't check anything but the value nodes. I guess it was too good to be true.