User-Defined Opcode Database

FreqByEqScale

frequency calculation for one step of an equal tempered scale

Download UDO File

Description

frequency calculation for one step of an equal tempered scale. the unit for the scale can be an octave, a duodecim, or whatever

Syntax

ifreq FreqByEqScale iref_freq, iumult, istepspu, istep

Initialization

iref_freq: reference frequency
iumult: unit multiplier (2 = octave, 3 = Bohlen-Pierce scale, 5 = stockhausen scale in Studie2)
istepspu: steps per unit (12 for semitones, 13 for complete Bohlen-Pierce scale, 25 for studie2 scale)
istep: selected step (0 = reference frequency, 1 = one step higher, -1 = one step lower)

Code

  opcode FreqByEqScale, i, iiii
iref_freq, iumult, istepspu, istep xin
ifreq		=		iref_freq * (iumult ^ (istep / istepspu))
		xout		ifreq
  endop

Examples

<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>
<CsInstruments>
 opcode FreqByEqScale, i, iiii
iref_freq, iumult, istepspu, istep xin
ifreq		=		iref_freq * (iumult ^ (istep / istepspu))
		xout		ifreq
  endop
instr 1
ifreq FreqByEqScale 440, 2, 12, p4
print ifreq
endin
</CsInstruments>
<CsScore>
i 1 0 0 0
i . . . 1
i . . . -1
e
</CsScore>
</CsoundSynthesizer>

Credits

joachim heintz 1/2010


Previous Home Next
  TableToSF