ksmps

ksmps — Sets the number of samples in a control period.

Description

These statements are global value assignments, made at the beginning of an orchestra, before any instrument block is defined. Their function is to set certain reserved symbol variables that are required for performance. Once set, these reserved symbols can be used in expressions anywhere in the orchestra.

Syntax

ksmps = iarg

Initialization

ksmps = (optional) -- set the number of samples in a control period. This value must equal sr/kr. The default value is 10.

In addition, any global variable can be initialized by an init-time assignment anywhere before the first instr statement All of the above assignments are run as instrument 0 (i-pass only) at the start of real performance.

Beginning with Csound version 3.46, either ksmps may be omitted. Csound will attempt to calculate the omitted value from the specified sr and krvalues, but it should evaluate to an integer.

[Warning] Warning

ksmps must be an integer value.

Examples

sr = 10000
kr = 500
ksmps = 20
gi1 = sr/2.
ga init 0
itranspose = octpch(.0l)

See Also

kr, nchnls, nchnls_i, sr

Credits

Thanks to a note from Gabriel Maldonado, added a warning about integer values.