Skip to Content

layer velocities

3 replies [Last post]
Joined: 04/17/2010

hey folks. i'm building a hydrogen drumkit to make use of the drumkit from hell sounds i bought a few years ago.

how do i set up the layer velocities?

example: there are only two samples for the spock cymbal. neither is quiet so i want spock1 to be velocity 0~90 and spock2 to be velocity 91~127. then for the snare there are lots (actually too many -- hydrogen only lets me use 16 layers but i have 20+ sounds) of layers and they need to be spread out according to how they sound.

there doesn't seem to be anywhere in the GUI to set this (unless the order of layers in the instrument setup does something about this). i have been playing with the drumkit.xml file and think perhaps it has to do with the min and max tags for each layer (these are all set to 0 and 1 respectively). am i right?

i am

Joined: 04/17/2010

the method of changing the velocities for the layers in the GUI is not obvious in the least. i had no idea you drag the edges of the blue bars on the layers dialog whatsoever.

i figured out that they're saved in the xml as min and max, each of which is a float between 0 and 1.

only then, upon loading up the kit, did i see how the dialog works.

i can't find anything about this in the documentation

what happens when two layers overlap? this should be configurable globally for the drum kit or for each instrument -- the options could be
- randomly choose between matching layers
- choose higher layer
- choose lower layer

also, here is a much needed feature. it's hard to explain.

at the moment, each layer has a gain control which boosts or cuts each layer. a layer is chosen according to the velocity of the hit and then according to the velocity of the hit it's scaled by another gain. i assume this is linear over the velocity range. i think this is a bad thing.

if i've recorded sixteen samples from tapping a snare drum through to bashing it and then i spread them over the velocity range, the gain range for the lightest hit is currently locked at 0 to some low number -- 0.1 or so. this is no good -- it will never be heard. of course, a big gain could be added to counteract the cut made by the low velocity, but this is hardly ideal.

the overall gain for velocity is good for certain things (such as instruments with only one layer) but it's a nightmare for samples of the real thing at real volumes.

here's my proposed solution.

the overall gain thing is scrapped completely -- it's covered by what i'm about to suggest.

instead of one gain setting per layer, there should be two per layer. one for gain at the lowest velocity for that layer and one for the highest velocity for that layer. in the case of instruments with just one layer, setting the minimum to 0 and the maximum to whatever the gain was set to before would give the same result as in the current version of hydrogen.

but what about a multi-layered instrument? say the second layer's velocities are min=0.1 and max=0.2. since this layer was recorded in the same session as all the other (including louder) hits, it's a quiet sample anyway. so when setting up this instrument, we set the maximum gain to 1. we compare the adjacent, quieter layer at its maximum gain to this drum at various gains and conclude that they sound the same when this layer is at gain 0.8. so we set its minimum gain to 0.8.

to break layer 2 down:

velocity 0.1~0.2 -- range 0.1
gain 0.8~1 -- range 0.2

the drum is then hit at velocity 0.11. this is 10% through the layer's velocity range.
gain is calculated to be its minimum + 10% of gain range = 0.82

what do you think?

Joined: 04/17/2010

i've just edited the code to ignore velocities when gains are figured out (so velocities are only used to choose layer) as a compromise to suit my needs for now.

if anyone's interested, i simply commented out three lines of the audioEngine_renderNote function in src/lib/Hydrogen.cpp, around line 1286:
cost_L = cost_L * pNote->m_fVelocity; // note velocity
cost_R = cost_R * pNote->m_fVelocity; // note velocity

and, after the close brace:
cost_track = cost_track * pNote->m_fVelocity;

and then recompiled.

Joined: 12/28/2013

Instead of somewhat permanent changes to your installation, you can use gain control on every layer to compensate for diminished volume due to velocity. I created a script at to do this automatically.