expscale: Create a exponential parameter scaling with given minimum and...

exp_scaleR Documentation

Create a exponential parameter scaling with given minimum and maximum

Description

exp_scale() exponentially 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

  exp_scale(x, limits = NULL, soundlimits, by = NULL)

Arguments

x

A numeric vector or matrix

limits

The limits of the data to train, a numeric vector of length 2. All data values outside these limits are returned as NA. If NULL, the default, the function takes the minimum and maximum of the data

soundlimits

The limits of the sound parameter.

by

The unit to round the sound parameter to. See examples.

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, exponentially rescaled in the desired way.

See Also

linear_scale for more details on how scaling functions work

Examples

x <- 1:10
exp_scale(x, soundlimits = c(-2, -1.5))

## If max<min, it's rescaled in reverse:
exp_scale(x, soundlimits = c(10, 1))

statisfactions/playitbyr documentation built on Jan. 27, 2024, 1:33 p.m.