Harmonic Generating Oscillator
  • It's quite a coincidence, but at the same time @biminiroad was working on generating harmonics using the Chebyshev polynomial equation, I was working on an entirely different approach. This oscillator uses a phasor node to generate sine waves at the fundamental and the first eleven harmonics. Each harmonic has an amplitude and phase adjustment. The oscillator is anti-aliased by turning off harmonics over the Nyquist frequency. I thought I would make a uModule version using a knob to select from 16 pre-programmed patterns. Suggestions are welcome. It would be easy to extend this to a fundamental and 15 harmonics, but I didn't want to overdo it. The oscillator is internally gain-compensated so that the output stays within the -1 to 1 range

    10-28 - bug fix see below
    Screen Shot 2017-10-27 at 6.05.30 PM.png
    3456 x 2530 - 639K
  • Created a version with a built-in waveform display so you could see the waveform and listen at the same time.

    10-28 - bug fix see below
    Screen Shot 2017-10-27 at 4.55.40 PM.png
    2890 x 1916 - 530K
  • @stschoen - this is SUCH a badass design! With only one phasor node too! So CPU light! wowowow
  • Can a brother get a little harmonic tilt up in this?
  • @RobertSyrett - I need to revisit that module and make it better/more flexible.
  • Thanks for the compliments! I'm working on a uModule version that will morph between 16 different sets of harmonic levels/phases. I had originally planned to just have a selector, but then I thought that morphing might be much more interesting. I'm thinking that a knob would be the best interface, but I envision mostly modulating it externally. Kind of a poor man's wavetable. I could use some help in figuring out some good waveforms to add, and if additional harmonics would be of any use. I did the triangle in the demo to see how close it came with 12 and the 11th harmonic was at 0.00826 with the fundamental at 1. The 13th would be at 0.00592. Sixteen might be the optimum number (fundamental and 15 harmonics). The 16th would drop out at 1281 Hz since above that you would get aliasing. @RobertSyrett, I haven't had a chance to watch the video you posted but it's on the list.
  • @RobertSyrett. I had a look at the harmonic tilt and thought both it and the harmonic sweep were pretty neat. Also liked your tilter module, Clever use of spline nodes. If I were to apply it to the oscillator, it would have to be subtractive only since the gain is essentially already at max when any knob is all the way up. Initially I just had everything added, but soon realized that I could potentially end up with a +/- 12 signal, so I added an expression that reduces the gain so that the sum is limited to +/-1. If the sum is lees than 1 it is unaltered. That way the relative balance of the various harmonics is maintained without generating an out of range signal. Still, it shouldn't be too difficult to alter the balance. Might even be able to add the sweep.
  • Oops! found a bug. I didn't change the harmonic number after doing the copy and paste, so the 9th through the 12th harmonic were actually the 8th. I thought that triangle looked a bit wonky!
    STS harmonic osc V1.1.audulus
    78K
    STS harmonic osc V2.1.audulus
    104K
  • Here's the uHarmonic version. It was becoming a bit heavier on CPU than I liked, so I stayed with 12 harmonics and decided to reduce it to 8 patterns. I changed the morphing as well. There are now two knobs to select the starting and ending pattern and a separate morph knob. I've only populated the first 5 patterns. The pattern 1 is just the fundamental. Pattern 2 is the fundamental and second harmonic both at 0 phase. Pattern 3 is the same as pattern two except the phase of the second harmonic is 180. Pattern 4 is a triangle and pattern 5 is a square wave (approximately). The patterns are stored in 12 muxes, one for each harmonic. Each entry is a 16 bit number which contains the amplitude and phase of the harmonic. There is a calculator inside the module. Demo has an improved uTuring that shifts on the leading edge of the clock.

    10-29-17 bug fix see below
    Screen Shot 2017-10-28 at 3.42.27 PM.png
    3928 x 2356 - 737K
  • After playing with the uHarmonic version I decided that it would also be nice to have one that morphed across all 8 patterns. This morphs from 1 to 2 then 2 to 3 etc. I figured this would be a good way to modulate a set of related waveforms.

    10-29 bug fix see below
    Screen Shot 2017-10-28 at 7.17.19 PM.png
    2978 x 2004 - 403K
  • Wow, very nice work today! I should state for the record, @bimini road thought up that value distribution module, I was just using it to describe the behavior that I am looking for. I think there should be a simpler way to do it but each time I start to think about it I get a headache. I really liked to uMorph with the additive version of the waveforms with their sinusoids peeking through. There doesn't seem to be much on the dial past 1 o'clock though. Is this intended behavior?
  • @RobettSyrett, There are currently only 5 sets of harmonics in the module. They’re the same ones as the two knob version.
    1. Fundamental
    2. Fundamental + second harmonic at full amplitude and 0 phase
    3. Fundamental + second harmonic at full amplitude and 180 phase
    4. Triangle
    5. Square (at least the first 11 harmonics)
    I didn’t actually intend these to be the final sets, they were really more for testing. If you select past set 5 there will be no output. I’m open to suggestions as to what makes sense. You can also use the converter inside the module to add your own sets. With the ability to morph between arbitrary sets of harmonics we should be able to come up with some interesting sounds.
  • Gotchya, there are only 5 presets right now. So I was messing around with trying to use the decimal to binary technique for making presets using one mux node and thought I would share this with you.
    Preset Smooth Prototype..audulus
    424K
  • Very nice! I’m thinking it could be fun to connect the Turing Machine Volts to the overtones for a continuously morphing timbre.
  • Turing machine always improves things!
  • Using the quad nodes is a great idea. I wonder how much it adds to the CPU vs wiring the individual nodes. I compared the uMorph to your design and, at least on my Mac, yours is running at 6% and the uMorph is at 3%. Don't know if that's the quad nodes or the slew modules. I suspect it's the slew modules since they each contain a low pass filter. It's interesting to see how different people approach the same problem. It would never have occurred to me to use a slew node to smoothly vary the parameters. My approach was to interpolate between each pair as the knob was moved.Your approach has the advantage of a smooth morph when the preset is switched abruptly from one preset to another, but the slew nodes will limit the speed at which you can modulate the morph. Of course you do have the ability to turn them off. Your approach would be more appropriate if you were selecting using something like a Turing machine, whereas my design really needs to be modulated with some kind of smoothly varying waveform. I certainly think there's room for both.
  • I was a bit disappointed in the square wave, so I decided to increase the base module to 16 harmonics. Here's the modified version. While I was at it I also grouped all the core elements to make it simpler to incorporate in other's designs (This means you RHS!) There is a 0 to 1 input for the level and phase for each harmonic (the fundamental being harmonic 1). I'll post one with a display and the two uModule versions as soon as I get them modified.

    11:20 - added individual outputs to the generator for each harmonic in case someone needed them
    Screen Shot 2017-10-29 at 9.45.58 AM.png
    2684 x 1978 - 524K
    STS harmonic osc model 1 V1.3.audulus
    111K
    Screen Shot 2017-10-29 at 11.24.57 AM.png
    1520 x 1670 - 248K
    STS harmonic generator.audulus
    46K
  • Here's the display model.
    Screen Shot 2017-10-29 at 10.43.11 AM.png
    2766 x 2174 - 626K
    STS harmonic osc model 2 V2.2.audulus
    160K
  • Awesome stuff! Thanks for making the knobless version, that's a pretty great place to start for modifying the design for other crazy stuff like verbos style spectral tilt and that preset mumbo jumbo that was keeping me up late last night :)

    I like the way that your uMorph interpolates the intermediate stages of the presets but if I may offer a critique, how would I create and add my own presets to the list? Is there a way to highlight where the address for each preset is stored? Also in the other thread you mentioned that my encoder could be more efficient since I wasn't really using the individual bits. How might you go about that?

    The slew filters were almost an afterthought, but once I rigged it up I had to include it since it comes very close to replicating the way that wavetable morphing sounds. Honestly this harmonic generator is coming very close to being a universal waveform generator.
  • Found a wiring error in the uModules.
    STS uMorph V1 copy.audulus
    210K
    STS uMorph V1 demo.audulus
    486K
    STS uHarmonic osc V1.audulus
    271K
    STS uHarmonic osc V1 demo.audulus
    457K
  • @RobertSyrett, The generator only generates the harmonics, it has no storage capabilities. It takes a zero to one value for the level and phase of each harmonic. The gain control will output the required overall gain to keep the summed output below -1 to 1, if you feed the level for each harmonic into the inputs. I kept it separate for instances where you might want to adjust the levels differently such as the harmonic tilt. The values for the harmonics in the uModules are stored in 12 (or 16) muxes. Each mux stores the values for one harmonic. The phase and amplitude for each harmonic are converted to 8 bit numbers and combined to give a 16 bit value. There is a calculator inside the uModules that will generate the number for each harmonic for each set. There are 8 sets, one for each slot in the muxes. I hope that's clear. I should have a 16 harmonic version of both uModule versions today, so you might want to wait a bit. I'll use the generator version with the individual outputs in case you want to strip the guts out. (love that copy and paste!)
  • Tap "NEW" to create random waveforms!
    You might have to tap "NEW" to get the sequencer started as well.

    edit 12:25 - I adjusted the seeds inside the rng osc so they are all different, should give better randomness and variation in tones generated.
    rng osc.audulus
    795K
  • Here's the 16 harmonic versions of both uModules. No difference in operation, just more harmonics and a cleaner design.

    4:50 PM bug fix see below
  • @RobertSyrett, I liked the rng oscillator. A lot of fun to hit the DPC button and see what it comes up with. Hope you find the new designs useful.
  • Cool, I definitely have some Ideas I'd like to try out with the harmonic generator.
  • A couple of notes. The gain control is actually pretty crude. It doesn't take into account destructive interference so some combinations will have a reduced output. The square wave is a good case in point. Except for using an envelope follower, I see no easy way to keep the output constant. Also the gain control does not boost values. If the total of all the harmonics is less than one, it sets the overall gain to one. The morph morphs both phase and amplitude so if you morph from a harmonic that is 0 level and 0 phase to one that's 1 amplitude and 0.5 phase (180 degrees) you will sweep both phase and amplitude. You could set the from harmonic to 0 level and 0.5 phase if you wish to prevent the phase shift. The 8 bit numbers used to store the sets have a range of 0 - 255 and no decimal part, so there is necessarily some loss of precision compared to the knob versions or the raw generator. The calculator currently rounds down only, although I believe that with a bit of work I can fix this.
  • Oops again! Another wiring error (no phase for harmonic fourteen.) Also added saw to position 3 on the uHarmonic (that's how I discovered the bug)
    STS uHarmonic osc V2.1.audulus
    346K
    STS uMorph V2.1.audulus
    260K
  • This could be the perfect tool for exploring some oscilloscope music. All that’s needed is a doubled cosine out. https://youtu.be/dJQCMw_Qb8A
  • I think it's fine to have variable amplitude, but I would love to see your take on a compressor.
  • I haven’t played with the envelope follower, but that would seem to be a good place to start, although if the goal is to keep the peak to peak level the same, a peak detector might be more useful. It might be an interesting area to explore. I had assumed that summing the amplitudes of the individual harmonics would give me the total but I forgot that as often as not they interfere with each other.
  • @Rudiger, interesting video! I’m pretty sure no one will be building a 128 harmonic generator in Audulus, but the principle the same in any case. You can get a cosine by simply shifting a sine output by 90 degrees so that’s not a big problem.
  • @stschoen one doesn’t need to go all the way up to 128 harmonics. 16 are plenty to have some fun with :-) Here’s a version of the Harmonium with a cosine output for creating oscilloscope music.
    20912890-8708-4C7A-BEF2-CAFEAA101AD4.png
    2224 x 1668 - 2M
    STS harmonic osc model 2 V2.2 osc.audulus
    200K
  • @Rudiger - what app is that?
  • Here’s a version with the UI set up for use in slide-over view on an iPad:
    9ECA238B-04A5-4222-A028-83F22BCBC992.png
    2224 x 1668 - 2M
    STS harmonic osc model 2 V2.2 iOsc.audulus
    627K
  • And a little video of it in action:

    Sound Shapes from Rudiger Meyer on Vimeo.

  • @Rudiger, that's pretty cool. I took the liberty of re-connecting the audio lights and changing the model number to 3 to keep it separate from the units without the cos output, since it may not be needed in some cases. I also added your initials to the signature. I'm using oscilloppoi on the Mac for the display.

    04:55 PM replaced file - SVG icons swapped
    05:30 fixed @Rudiger's initials - see below
    Screen Shot 2017-10-30 at 11.42.33 AM.png
    4640 x 2126 - 2M
    Screen Shot 2017-10-30 at 11.51.04 AM.png
    3592 x 2196 - 1M
  • @stschoen Great! Thanks. BTW the reason I used the speaker node instead of the output node is to avoid distortion of the shapes. The DC blocker and other internals of the output alter the curves. Compare for example these two screenshots of the same settings, the first with output module and the second with the speaker node. The output module gives the shapes a particular character, and that could of course be something to embrace – with the drive setting pushing them even more into comic book space :-)
    A20E1CA1-448C-4BB4-AE6B-E176D246853D.png
    2224 x 1668 - 2M
    139632D7-6B67-4BBE-AFCC-AD2D28BC29F9.png
    2224 x 1668 - 2M
  • The stuff is really fun looking. With this be generalizable to any oscillator if you create the "cosine" output by delaying the oscillator output by "3/4/hz" (3/4 the period of the fundamental)?
  • @Rudiger, Thanks for pointing out the DC blocker in the output module. I had completely forgot about it being there. The "drive" expression will have some additional effect as well. @jjthrash, you will get some kind of display any time you have a significant difference between the left and right channels (assuming you're driving the vertical with one and the horizontal with the other)
  • @zenji, here's the Instagram patch
    05:30 PM fixed @Rudiger's initials see below
  • @stschoen Thanks for the nice SVG initials – just noticed though that they are RH – which I take to be Rob Hordijk :-)
  • Oops! I can't read. I'll fix that in a jiffy. It could be worse than being mistaken for Rob Hordijk :)
    My apologies! How about this
    STS-RM harmonic osc model 3 V1.0 osc.audulus
    213K
    STS-RM harmonic osc model 3 V1.1 osc.audulus
    202K
    STS-RM harmonic osc model 3 V1.1 osc demo.audulus
    1002K
  • No apologies necessary! As you say, there are worse things in life than being mixed up with Rob Hordijk :-)


  • I took the volts section out of the uMod version primarily to save space. If you're looking at the demo patch, the module next to the Turing is just 8 flip-flops (useful to stretch the gates). I brought all 8 bits out to the front however, so that it would be pretty simple to make an add-on volts module. Multiple each bit by a knob, add them together and divide by 8 (to keep the signal between 1 and 0) On the full size unit I also added a scale and offset control for 1 per octave use over 8 octaves.
  • I found a very specific method of making the output of the harmonic generator a more consistent amplitude, but it's still very weird.
    EnvFollow Mystery.audulus
    79K
  • @stschoen That was my tired brain short-circuiting last night. At first glance I somehow confused your funky flip-flop svg with the volts svg you had on the full version. On taking a closer I realised what was going on. Even though the knobs take up a bit of space I think it could be a nice extension to have and as you point out since the bits have been brought out it should be easy to do. I’ll take a look at it as soon as I get the chance.
  • @RobertSyrett that's a lot of envelope followers you've got stacked. I was reading the article that @biminiroad posted on envelope followers last night. Much of it wasn't directly applicable to audio signals since it assumed a constant carrier frequency, but the full wave rectified model looked like it might have some promise, although aliasing will introduce some noise into the signal as a result of doubling the frequencies. I don't think that will be an issue in this case since for this application the attack and release times will be pretty long so the low pass filter will have a pretty low cutoff. I still want to do a bit more research on compressors in general.
  • @stschoen Agreed, I would also like to better understand what the EnvFollow node actually does.
  • @robertsyrett - the envelope node is basically abs(x) with a little bit of filtering after it.
  • image

    I finally got my head around smoothstep, and thought it would be fun to use to scan the harmonics!

    edit: Added a humorous amount of reverb for good measure.
    Screen Shot 2017-11-12 at 4.53.47 AM.png
    977 x 715 - 175K
    harmonic scanning.audulus
    317K