[.uhm] FM Synthesis in Hive

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

Post

I guess this should do the trick:

Spectrum "x * ( index % 2 )" [edit: fixed...]

Odd harmonics are 1 (fundamental), 3, 5, ... -> "index % 2" should be 1 for 1, 3, 5... and 0 for 2, 4, 6..., hence all odd harmonics are left untouched while all even harmonics are set to 0.

Post

(x * ((index % 2)==1))*table

does the trick.

Post

ZaBong69 wrote: Mon Feb 18, 2019 4:27 pm (x * ((index % 2)==1))*table

does the trick.
%2 of course :dog:

what do you need the *table for?

Post

Sorry, that was part of the full code.. the idea was to morph from any kind of wave to a "squarified" one, and the table was part of this. Something like:

(x)*(table-1)+(squarified(x))*table

increasing the "squarified" part of the wave over time. Does not sound spectacular so far, needs more work...

Post

I'd be interested in a function that creates "bells" consisting of equally-spaced harmonics (e.g. 1, 4, 7, 10... or 3, 8, 13, 18...). Of course you could add or subtract multiple waves for more complex bells. Any takers?

Post

Howard wrote: Tue Feb 19, 2019 8:05 am I'd be interested in a function that creates "bells" consisting of equally-spaced harmonics (e.g. 1, 4, 7, 10... or 3, 8, 13, 18...). Of course you could add or subtract multiple waves for more complex bells. Any takers?
The modulo division should give you that: (x % 3) == 1 delivers 1, 3, 4, 7... How about:

(1/index)*((index % 3)==1)

in a Spectrum line? (Sorry can't check right now)

Post

I have no idea what is happening here, but with spectral morph it looks awesome:

>>
Info "Happy Accident - Generating Bells (?)"
NumFrames = 2

Spectrum "(1/index)*((index % 3)==1)+(1/index)*table"
Spectrum "(1/index)*((index % 3)==2)"


Spectrum lowest=0 highest=0 "0" // DC-removal trick
Normalize start=0 end=2
>>

The idea was to generate some bells, but something went wrong... can somebody explain what I did here?

Post

ZaBong69 wrote: Tue Feb 19, 2019 2:44 pm I have no idea what is happening here, but with spectral morph it looks awesome:

>>
Info "Happy Accident - Generating Bells (?)"
NumFrames = 2

Spectrum "(1/index)*((index % 3)==1)+(1/index)*table"
Spectrum "(1/index)*((index % 3)==2)"


Spectrum lowest=0 highest=0 "0" // DC-removal trick
Normalize start=0 end=2
>>

The idea was to generate some bells, but something went wrong... can somebody explain what I did here?
Interesting :)

First off, each (1/index) part should've give you an error, because index goes from 0 to 2047, so the very first iteration would be a division by zero. Which is a no-no. But I guess UHM is forgiving for that kind of error and just returns 0.

Your first line Spectrum "(1/index)*((index % 3)==1)+(1/index)*table" uses a table variable. You have 2 frames in total. By introducing a table variable you get different results for each frame, because for frame #0 the table will be 0.0, and for frame #1 it will be 1.0.

In your second line Spectrum "(1/index)*((index % 3)==2)" you don't use table variable, therefore both frames should be equal, and since you didn't specify a Blend mode, that line should overwrite the result of the previous line, because default Blend mode for Spectrum command is Replace. But that's not what we see :) So I'd guess you found a bug. Or it's a known quirk. Or I missed something :oops:

Post

I love reading this stuff... even when I don't know what you are talking about :hihi:

True synth porn!

Post

drzhnn wrote: Tue Feb 19, 2019 5:41 pmFirst off, each (1/index) part should've give you an error, because index goes from 0 to 2047, so the very first iteration would be a division by zero. Which is a no-no. But I guess UHM is forgiving for that kind of error and just returns 0.
In Spectrum, "Lowest" defaults to 1, for the very reason that 1/index would give us an unforgivable error.

:clown:

Post

Urs wrote: Tue Feb 19, 2019 6:13 pm
drzhnn wrote: Tue Feb 19, 2019 5:41 pmFirst off, each (1/index) part should've give you an error, because index goes from 0 to 2047, so the very first iteration would be a division by zero. Which is a no-no. But I guess UHM is forgiving for that kind of error and just returns 0.
In Spectrum, "Lowest" defaults to 1, for the very reason that 1/index would give us an unforgivable error.

:clown:
Aha! Good to know! And also I think I was wrong about the index range. For Spectrum it is 0-1023? Or is it 1-1024?

Post

I think I can explain it.

The spectrum is identical in both frames, but the first frame has mangled random phases for each harmonic.

The first line sets the first table to 0.0 all over, because >> *table <<, as drzhnn pointed out. That is, because everything is 0, there is no defined phase for any harmonic in the first frame, but it's all good and tidy in the second frame.

The second pass >> Spectrum "(1/index)*((index % 3)==2)" << overwrites the magnitudes of each harmonic again. The phases of the first frame are pretty much random, while the second frame looks like it does.

Post

drzhnn wrote: Tue Feb 19, 2019 6:22 pmFor Spectrum it is 0-1023? Or is it 1-1024?
I would need to look it up... I think Spectrum 0-1024, Phase 1-1023

However, these values are clipped internally IIRC, so you can go wild without causing any damage.

Post

Howard wrote: Tue Feb 19, 2019 8:05 am I'd be interested in a function that creates "bells" consisting of equally-spaced harmonics (e.g. 1, 4, 7, 10... or 3, 8, 13, 18...). Of course you could add or subtract multiple waves for more complex bells. Any takers?
Maybe this?

Code: Select all

NumFrames = 1

Spectrum lowest=2 highest=20 "(index % 5) * (1/index)"
//       ___________________   _________    _________
//                |                |            |
//        Working only with    Selecting    This adjusts the magnitude of the target harmonic.
//         harmonics 2-20      each 5th     By default, if "(index % 5)" is true, it is set to 1.0.
//                             harmonic,    To get a more natural sound, especially if we have
//                             and giving   a lot of harmonics, it's useful to reduce the magnitude
//                             it a value   of higher ones. So the higher the harmonic, the 
//                             of 1.0       more quiet it gets. Therefore we divide 1 by the index of
//                             (default)    the harmonic.

Spectrum lowest=1 highest=1 "1" // Adding fundamental
But I found this one more useful and versatile for creating bell sounds. Just change the Seed:

Code: Select all

NumFrames = 1

Seed = 1234
//       |
//     Change me, completely!

Spectrum lowest=2 highest=200 "(index % (rand * 7)) * rand"
//                ___________                  ___    _____
//                     |                        |       |
//                If set too high, it can       |     Random magnitude
//                add a lot of ultra high       |
//                frequencies, ecpecially      Harmonic
//                when working in higher       gap
//                samplerates like 96k.

Normalize base=all db=-12 // Reducing loudness of all overtones
Spectrum lowest=1 highest=1 "1" // Adding fundamental

Post

>>
The first line sets the first table to 0.0 all over, because >> *table <<, as drzhnn pointed out. That is, because everything is 0, there is no defined phase for any harmonic in the first frame, but it's all good and tidy in the second frame.
>>

Not unless UHM ignores the rules of algebra. That only sets the second term to 0, not the first one as I add these, and *table should only work on the first or should it?

Anyway, the resulting curve looks a lot like a random walk, which is pure magic as it was not intended at all. I suspect that a lot of these happy accidents are prone to happen when people like me - not really knowing what they are doing - are using this technology in earnest.

Urs, you are basically handing a bunch of 4-year olds the synth equivalent of a box of handgranades to play with. I am very grateful for this ;)

Post Reply

Return to “u-he”