Skip to main content

Scale and Offset Signals

The scale hook modifies sample signals by a gain factor and optionally ads an offset. First the original signal value is multiplied by the gain, then the offset is added.

Implementation​

The source code of the hook is available here: https://github.com/VILLASframework/node/blob/master/lib/hooks/scale.cpp

Configuration​

offset
number
Default: 0

The offset which is added to the signal after gain.

gain
number
Default: 1

The gain which is multiplied to the signal before the offset is added.

signals
Array of strings

A list of signal names to which this hook should be applied

enabled
boolean
Default: true

An optional field which can be used to disable a hook.

priority
integer
Default: 99

The priority of this hook which determines the order in which hooks are executed. Hooks with a lwoer priority are executed before ones with a higher priority.

If no priority is configured, hooks are executed in the order they are configured in the configuration file.

{
  • "offset": 100.5,
  • "gain": 1000,
  • "signals": [
    ],
  • "enabled": true,
  • "priority": 99
}

Example​

node/etc/examples/hooks/scale.conf
@include "hook-nodes.conf"

paths = (
{
in = "signal_node"
out = "file_node"

hooks = (
{
type = "scale"

signal = "sine"

offset = 100.0
scale = 55.0
}
)
}
)