linearscale: Create a linear parameter scaling with given minimum and...

Description Usage Arguments Details Value See Also Examples

Description

linear.scale() linearly transforms its input vector x so that its minimum value is min and its maximum value is max. This is for use as a scaling function in sonscaling. It is unlikely to be directly called by the user.

Usage

1

Arguments

x

A numeric vector or matrix

min

The desired minimum value, a numeric of length 1

max

The desired maximum value, a numeric of length 1

Details

This simple function does the important work of actually rescaling the given data of a sonify object into the range of the given sonic parameter, which is why it's included in playitbyr. But it can be used on any vector or matrix.

Value

A numeric vector or matrix of the same type as x, linearly rescaled in the desired way.

See Also

sonscaling, scaleShortcuts

Examples

1
2
3
4
5
x <- 1:10
linear.scale(x, min=-2, max=-1.5)

## If max<min, it's rescaled in reverse:
linear.scale(x, min=10, max=1)

playitbyr documentation built on May 2, 2019, 6:08 p.m.