[.uhm] FM Synthesis in Hive

Official support for: u-he.com
Post Reply New Topic
RELATED
PRODUCTS

Post

Thanks a lot for the C example Urs!

Code: Select all

phase = index/2048;
While I perfectly understand what "phase" is when working with synths, for some weird reason when writing this word down in formulas, I was imagining it as a vertical position :dog: :dog: :dog: No wonder everything else wasn't quite lining up... :oops:

Post

hakey wrote:
drzhnn wrote: I was exhausted by switching between Hive, text editor
Same here. Any chance of a standalone .uhm/wavetable editor?
Check out Notepad2-mod. It's great and easy to use. Also free and open source. Basically it's like standard windows Notepad but with code highlighting and some other nice features, like word auto completion and highlighting of paired brackets.

Also, in any editor, you'll need to change code highlighting scheme to C, C++, C#, Java or Javascript - they tend to work best with .uhm syntax.

Post

Sublime Text (paid), Notepad++ (free)...

Post

Yep, Sublime Text! There's no comparison to the others except perhaps that they're free.
Creator of Bitwiggers, the place to share Bitwig Presets.
Advocate for Bitwish, the place to vote on Feature Requests and discuss Bitwig.

Post

I really enjoy exploring sounds via uhm :) Whatever I do the result is either something very interesting or an inverted sine wave :hihi:

If I understand everything right, in this script a hyper-triangle-like waveform is modulating a simple sine operator. I used envelope to add "fades" to the edges of each frame, so that wave starts and ends at the same level - this makes the "sync" effect in the modulator sound smoother.

Code: Select all

Envelope L0=0 T1=0.5 L1=1 T2=0.5 L2=0

// HYPER MODULATOR
Wave "frac(abs(1-2*phase) * 2 * (1 + 10.0 * (1-table)))"
Wave "abs(1-2*x)"
Wave "x * env(phase)^0.5"

// OPERATOR
Wave "sin(2*pi*phase + x * 2)"

Normalize base=each
I have a couple of questions:

1) Is this FM or PM?

I think it's PM because in the (sin(2*pi*phase + x * 2)) line I really hope I'm modulating the "phase" in small range, since after "+" I'm adding changes to the phase. And in order to turn this into FM structure, I have to change that line to something like this: (sin(2*pi*phase * 2 * x)), to modulate the frequency multiplier, so to speak.

2) What are the operating ranges for values in x and y variables?
3) Are there better ways to fix the misaligned phases between frames?
4) In general, what are anti-patterns when writing .uhm scripts?

Post

Lasers!!! :borg:

Code: Select all

Envelope L0=1 T1=1 L1=0

Wave "sin(2*pi*phase*30*env(table)^4)"
Wave "sin(2*pi*phase - x*2)"

Interpolate start=0 end=255 type=morph2

Post

drzhnn wrote: Wed Sep 26, 2018 10:07 pm1) Is this FM or PM?

I think it's PM
I think so too. But of course, DX-style FM is PM, technically.
2) What are the operating ranges for values in x and y variables?
3) Are there better ways to fix the misaligned phases between frames?
4) In general, what are anti-patterns when writing .uhm scripts?
I think the Wave values are clipped at +/-10. This helps preventing some confusing situations where only 1 out of 256 frames has any audio after normalization.

Misaligned phases are not necessarily a bad thing. One can always recommend to use "Spectral Fade" in the Info blurb. Phase movement can make wavetables sound alive, as it's technically similar to slightly detuned harmonics.

I do not know of any anti-patterns yet. Certainly, keeping lines which don't do anything is a no-no. Division by zero will yield an error message. Over-complicating things would be an anti-pattern, but I have yet to see examples. I hope that no-one will ever generate scripts which contain thousands of lines of harmonic-by-harmonic additive synthesis.

Post

drzhnn wrote: Fri Sep 28, 2018 4:29 am Lasers!!! :borg:

Code: Select all

Envelope L0=1 T1=1 L1=0

Wave "sin(2*pi*phase*30*env(table)^4)"
Wave "sin(2*pi*phase - x*2)"

Interpolate start=0 end=255 type=morph2
Lasers, hehehe, yes.

Post

This one... The portion in the middle of the wavetable, when played in lower notes, sounds like a stuttering kick drum :love:

Code: Select all

NumFrames = 101

Wave start=0 end=33 "sin(2*pi*20*phase^4 + y)"
Wave start=34 end=66 "sin(2*pi*15*phase^0.5 + y)"
Wave start=67 end=100 "sin(2*pi*5*phase + y)"

Wave "sin(2*pi*phase^(80/(frame+2)) + x*table*1.5)"

Normalize base=each

Post

:tu:

Post

I was trying to make something much simpler but was sidetracked by possibilities :)
Here I divided the frame into 4 "subframes" and filled them with saw waves at different phases. After that I applied lowpass filter to remove phase clicks between subframes. Then I used that waveform as a frequency modulator for a sine wave. And finally - saturation! By changing parameters of the lowpass filter you can get all kinds of growling FM basses.

Code: Select all

Wave "phase * (phase<0.25) * table * 2.9"
Wave "x + (phase+0.5) * (phase>=0.25) * (phase<0.5) * (1-table) * 1.2"
Wave "x + (phase-0.7) * (phase>=0.5) * (phase<0.75) * table * 0.5"
Wave "x + (phase-1.5) * (phase>=0.75) * (1-table) * 0.9"
Wave "1-2*x"

Wave "lowpass(x, 0.3, 0.1)"

Wave "sin(2*pi*phase*8 + x*16)"

Wave "tanh(x*2)"

Post

With "Auto" at about -4.0 this one sounds like a digital powerchord. Really cool.

Code: Select all

Info "Percussive FM noise with resonance. Granular powerchord at slower speeds."
Envelope L0=1 T1=1 L1=0
Wave "1-2*rand"
Wave "lowpass(x, 0.8, 0.7)"
Wave "lowpass(x, 0.7*env(table)^8, 0.2)"
Wave "sin(x*env(table)^2 + y)"
I noticed that scripts that use filter functions (lowpass() etc) degrade in sound at lower octaves, loosing high frequencies. Like samples do. And scripts without these functions don't degrade in sound at all, like they are resynthesized for each note. Interesting :)

BTW, for those of you who use Sublime Text. I made a simple .uhm syntax highlighter with some auto-completion and basic code snippets. The main difference from built-in ST highlighters is that this one will color-code tokens within formula string. I submitted it to Package Control repository but it's not there yet, so for now if you're interested you'll have to install it manually.

Post

Soft mallet guitar :love:

Code: Select all

Info "FM mallet and KS guitar layers mixed together. `Auto` controls stiffness (-2.0 is a good starting point)."

Envelope L0=0.95 T1=0.1 L1=0.4 T2=0.9 L2=0.2

// FM mallet
Wave "1-2*rand"
Wave "bandpass(x, env(0.15), 0.5)"
Wave "sin(2*pi*phase*8 + x*5*env(table)^6)"
Wave "(x + x*5*env(table)^9)"
Wave "x*env(table)^4"
Wave target=aux1 "main"

// Additional tone shaping
Wave "sin(2*pi*phase*16 + x*0.5*env(table))"

// KS
Wave start=1 "y + 0.09 * (main_fi(frame-1, index) - y)"

// Mix FM and KS layers
Wave blend=add "aux1*0.5"
Phase "rands * 2 * pi - pi"

Normalize base=each

Post

drzhnn wrote: Mon Oct 01, 2018 9:17 am I was trying to make something much simpler but was sidetracked by possibilities :)
Here I divided the frame into 4 "subframes" and filled them with saw waves at different phases. After that I applied lowpass filter to remove phase clicks between subframes. Then I used that waveform as a frequency modulator for a sine wave. And finally - saturation! By changing parameters of the lowpass filter you can get all kinds of growling FM basses.

Code: Select all

Wave "phase * (phase<0.25) * table * 2.9"
Wave "x + (phase+0.5) * (phase>=0.25) * (phase<0.5) * (1-table) * 1.2"
Wave "x + (phase-0.7) * (phase>=0.5) * (phase<0.75) * table * 0.5"
Wave "x + (phase-1.5) * (phase>=0.75) * (1-table) * 0.9"
Wave "1-2*x"

Wave "lowpass(x, 0.3, 0.1)"

Wave "sin(2*pi*phase*8 + x*16)"

Wave "tanh(x*2)"
Could you post some audio examples please?

Post

surreal wrote: Fri Oct 05, 2018 8:44 am
drzhnn wrote: Mon Oct 01, 2018 9:17 am I was trying to make something much simpler but was sidetracked by possibilities :)
Here I divided the frame into 4 "subframes" and filled them with saw waves at different phases. After that I applied lowpass filter to remove phase clicks between subframes. Then I used that waveform as a frequency modulator for a sine wave. And finally - saturation! By changing parameters of the lowpass filter you can get all kinds of growling FM basses.

Code: Select all

Wave "phase * (phase<0.25) * table * 2.9"
Wave "x + (phase+0.5) * (phase>=0.25) * (phase<0.5) * (1-table) * 1.2"
Wave "x + (phase-0.7) * (phase>=0.5) * (phase<0.75) * table * 0.5"
Wave "x + (phase-1.5) * (phase>=0.75) * (1-table) * 0.9"
Wave "1-2*x"

Wave "lowpass(x, 0.3, 0.1)"

Wave "sin(2*pi*phase*8 + x*16)"

Wave "tanh(x*2)"
Could you post some audio examples please?
Good point :)

OK. Here's an audio example of the script you quoted:

https://soundcloud.com/drzhnn/uhm-singl ... or-fm-bass

Post Reply

Return to “u-he”