[.uhm] Karplus-Strong in Hive

Official support for: u-he.com
RELATED
PRODUCTS

Post

Chapter 3: Finding the Seed, and working it!


When using noise as exciter for a wavetable based timbre, it's often crucial to find the right seed. Here is a crude but efficent hack to find the right noise table, without tediously resaving the uhm script to test the seed.

Code: Select all

NumFrames=101
Seed = 73616
Spectrum "(index % 5) * rand / (1 + 10 * phase)"
Normalize base=each
So here we get 101 frames of noise. Set Hive's wavetable interpolator to "Switch" and now you can use the wavetable position knob to identify whatever timbre your after. In this case I was after a glassy tone.

Note that "index % 5" operator: It's a cheap trick to apply some comb filtering on the spectrum, i.e. some peaks and notches. When going through the harmonics, the expression becomes 1,2,3,4,0,1,2,3,4,0,1,2,3,4... essentially scaling the (still random) 4th/9th/14th.. harmonics louder than the others and so on. (The % operator is called "modulo"... it's an amazing tool in our little box)

When I said that modifications to Karplus-Strong can create "glassy" kinds of timbres, these are usually related to a "Stiffness" parameter. Stiffness of a medium (e.g. vibrating string) is often simulated by introducing an allpass-filter into the delay, which essentially spreads frequencies, thus introducing non-harmonic content. In our case, adding a few peaks and notches has a similar effect, but isn't non-harmonic.


Back to the example. Let's say I found my favourite glassy tone in wavetable frame #15

Now look what I just did here:

Code: Select all

Info "Karplus-Strong-like wavetable with glassy spectrum"
NumFrames = 101
Seed = 73616
Spectrum start=15 end=0 "(index % 5) * rand / (1 + 10 * phase)"
Phase start=0 end=0 "rands * 2 * pi - pi"
Wave start=1 "y + 0.15 * ( main_fi(frame-1, index) - y)"
Spectrum lowest=0 highest=0 "0" // remove DC offset
Phase "rands * 2 * pi - pi"
Wave "x + tanh( lowpass(x, 0.3, 0.5) * 0.4)"
Normalize base=all
I simply calculated the frames backwards from 15 to 0:

Code: Select all

Spectrum start=15 end=0 "(index % 5) * rand / (1 + 10 * phase)"
This way our 15th random wavetable ends up in frame 0 of our patch!

Awesome, innit?

Everything else is like the previous examples, except for this line:

Code: Select all

Wave "x + tanh( lowpass(x, 0.3, 0.5) * 0.4)"
I wanted to add a bit of solid low end, so I experimented a bit with adding a tad of lowpass filtering and distortion, which I mix in 50/50. The line is identical to

Code: Select all

Wave blend=add "tanh( lowpass(x, 0.3, 0.5) * 0.4)"
y=tanh(x) is a trigonometric function like tan, sin and cos, which serves as a classical distortion shape. It's always a good choice for any kind of waveshaping. The lowpass filter with quite a bit resonance gives it an edge, which adds some nice harmonics even when the KS-pluck is almost fully damped.

So there. Go experiment. Use whatever you like. It's a huge canvas with an even huger number of paints and brushes at you disposal!

Post

Urs, will we be able to import uhm files into Z3? This technology looks awesome and I'm hoping it's intended for more than Hive.
Feel free to call me Brian.

Post

bmrzycki wrote:Urs, will we be able to import uhm files into Z3? This technology looks awesome and I'm hoping it's intended for more than Hive.
Not sure yet. Zebra3 will get an editor, which means the wavetable has to be saved with preset. I'm thinking about that, but it would probably have to be so that by default a .uhm file results in a wavetable which isn't editable. But then maybe it can be converted into a editable one.

Post

That would be amazing. Even if .uhm wavetables must be immutable in Zebra, I think the vast potential of this scripting approach ought to be available in your flagship synth alongside all the other powerful tools for wavetable creation.

Post

Thanks for this tutorial/example Urs!

I have followed through and experimented a bit and had alot of fun exploring and experimenting.

I love how powerful the morphing is, I took the parabola example and did a simple morph and you get a result that I wouldn't be able to animate myself (yet) with any of the formulas.

Code: Select all

NumFrames = 101

Wave start=0 end=0 "(2*phase-1)^2" // parabola shape

Wave start=100 end=100 "phase^2" // curved saw
 
Interpolate start=0 end=100 type=morph1
 
Spectrum lowest=0 highest=0 "0" // remove DC offset
I experimented some more with the morphing and took some of the basic wave shapes from the tutorial uhm scripts and morphed them, and the results are quite unexpectedly beautiful and complex. You might glance over such a simple example but it's worth trying it to see the power of the morphing to let anyone with a basic grasp of scripting to experiment and get interesting results.

Code: Select all

Wave start=0 end=0 "-abs(1-2*phase)" // Triangle

Wave start=255 end=255 "phase<0.5" // Square pulse

Interpolate Start=0 End=255 Type=morph1

Spectrum lowest=0 highest=0 "0" // remove DC offset
I'm very excited about learning more uhm, I have been anticipating this preview. Now I think I need to spend some time learning maths formulas! My experiments prior to this tutorial didn't end up much better than noise :lol:

Post

Urs wrote:
bmrzycki wrote:Urs, will we be able to import uhm files into Z3? This technology looks awesome and I'm hoping it's intended for more than Hive.
Not sure yet. Zebra3 will get an editor, which means the wavetable has to be saved with preset. I'm thinking about that, but it would probably have to be so that by default a .uhm file results in a wavetable which isn't editable. But then maybe it can be converted into a editable one.
Right, because wavetable is a plot and uhm is a model. An arbitrary plot can't necessarily be reduced to an algorithmic model. Correct?

Post

lunardigs wrote:An arbitrary plot can't necessarily be reduced to an algorithmic model. Correct?
https://youtu.be/QVuU2YCwHjw

Post

Howard wrote:
lunardigs wrote:An arbitrary plot can't necessarily be reduced to an algorithmic model. Correct?
Very interesting! Is this at all practical for Hive/Zebra to actually do?

Post

If the .uhm script has the type=morph1, does that override the interpolator parameter in the GUI?

Post

Nope. The interpolator in the scripts is used to generate new frames. Like, if you have only two frames, but you want to fill 256 frames, you have to use some kind of interpolation to fill the frames between your two original frames. That's what the "Interpolate" command does.

The setting on the GUI only affects the interpolation between frames that are already there.

I hope that makes any kind of sense :hihi:
I'm sure someone will explain it better.

Post

Delta Sign wrote:Nope. The interpolator in the scripts is used to generate new frames. Like, if you have only two frames, but you want to fill 256 frames, you have to use some kind of interpolation to fill the frames between your two original frames. That's what the "Interpolate" command does.

The setting on the GUI only affects the interpolation between frames that are already there.

I hope that makes any kind of sense :hihi:
I'm sure someone will explain it better.
That's clear... thanks!!

Post

 
Great stuff, Urs! Thanks! :tu: :cool:

Since these [.uhm] threads are major Tutorial stuff, could you please make them sticky?

Post

 
:oops:

Post

My masterpiece

Code: Select all

Info "Karplus-Strong-like wavetable with bouncing-ball-like articulation"
NumFrames=200

Wave start=0 end=20 "sin(pi * 2 * phase)"
Wave start=0 end=20 blend=add "sin(pi * 2 * phase * 4) * 0.123 * frame"
Wave start=0 end=20 blend=add "sin(pi * 2 * phase * 6) * 0.5 * frame"
Wave start=0 end=12 blend=add "sin(pi * 2 * phase * 9) * 0.05"
Wave start=0 end=10 blend=add "sin(pi * 2 * phase * 11) * 0.05"

Wave start=0 "tanh(bandpass(x, 0.8, 0.3)^2)"
Wave start=20 "y + 0.20 * (main_fi(frame % (20 - frame/20), index) - y)"
Wave start=40 "tanh(lowpass(x, 0.30, 0.1) * 0.3)"

Spectrum lowest=0 highest=0 "0"
Phase "rands * 2 + pi - pi"

Normalize base=each

Post

ZeePok wrote: 
Great stuff, Urs! Thanks! :tu: :cool:

Since these [.uhm] threads are major Tutorial stuff, could you please make them sticky?
I will post a few more tutorials and then make a general Sticky with links to each.

Might start the FM-Turorial today :-)

Post Reply

Return to “u-he”