Use Non-Frames Version Previous Page Next Page
Pitch Convertors: Tuning Opcodes

cpstun, cpstuni

  kcps    cpstun     ktrig, kindex, kfn
  icps    cpstuni    index, ifn

Description

Create fully customized micro-tuning scales. These opcodes are similar to cpstmid, but work without MIDI.

Initialization

icps – return value in Hz (cps)

index – integer number denoting an index of the scale

ifn – function table containing the parameters (numgrades, interval, basefreq, basekeymidi) and the tuning ratios

Performance

kcps – return value in Hz (cps)

ktrig – trigger signal used to trigger the evaluation. Evaluation is performed when ktrig <> 0.

kindex – integer number denoting an index of the scale

kfn – function table containing the parameters (numgrades, interval, basefreq, basekeymidi) and the tuning ratios.

cpstun works at k-rate, while cpstuni at init-rate. A function table number (ifn or kfn) containing the tuning ratios, and other parameters is required in the score.

kindex and index arguments should be filled with integer values expressing the grade of the scale to be converted to Hz (cps). In cpstun, a new value is evaluated only when ktrig contains a non-zero value. The function table, ifn or kfn, should be generated by GEN2. The first four values stored in this function are:

  1. numgrades – number of grades of the micro-tuning scale
  2. interval – frequency range covered before repeating the grade ratios. 2 = one octave, 1.5 = fifth, etc.
  3. basefreq – base frequency of the scale, in Hz
  4. basekey – integer index of the scale to which to assign basefreq unmodified

After these four values, the user can insert the tuning ratios.

Examples

An example sowing the f-statement for a standard 12-grade scale with a base frequency of 261 Hz assigned to key number 60.

;           numgrades  interval  basefreq  basekey   tuning-ratios (equal temprament) 

f1 0 64 -2  12         2         261       60        1   1.059463 1.12246 1.18920 (etc.)

A 24-grade scale with a base frequency of 440 Hz assigned to key number 48, and a repetition interval of 1.5.

;                 numgrades  interval  basefreq  basekey  tuning-ratios .......  
                                      
f1 0 64 -2         24        1.5       440       48       1   1.01  1.02  1.03   (etc.)

Author

Gabriel Maldonado
Italy
2001
New in Csound 4.15


Use Non-Frames Version Previous Page Next Page
Pitch Convertors: Tuning Opcodes