scale2 — Arbitrary signal scaling with optional smoothing.


Scales incoming value to user-definable range. Similar to scale object found in popular dataflow languages.


kscl scale2 kinput, kmin, kmax[, kimin, kimax][ihtime]


ihtime -- Optional; Half time value for internal port filter for smoothing. Default is no smoothing.


kin -- Input value. Can originate from any k-rate source and should be in the range kimin to kimax. If it is larger than kimax it is treated as kimax, and if less than kimin then it is treated as kimin.

kmin -- Minimum value of the resultant scale operation.

kmax -- Maximum value of the resultant scale operation.

kimin -- Optional; Minimum of the incoming value range, defaulting to zero.

kimax -- Optional; Maximum of the incoming value range, defaulting to one.

[Warning] Warning
The argument order is minimum before maximum, which differs from scale but it consistent with other opcodes that use a range.


Here is an example of the scale2 opcode. It uses the file scale2.csd.

Example 930. Example of the scale2 opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
; Audio out   Audio in    Silent
-odac           -iadc     -d    ;;;realtime output

sr	=	44100
ksmps	=	10
nchnls	=	2

/*--- ---*/

	instr	1	; scale test

kmod	ctrl7	1, 1, 0, 1
	printk2	kmod

kout	scale2	kmod, -127, 0
	printk2	kout


/*--- ---*/

i1	0	8888


See Also

gainslider, logcurve, expcurve scale


Author: John ffitch after David Akbari