exp

exp — Retourne e élevé à la puissance x.

Description

Retourne e élevé à la puissance x.

Syntaxe

exp(x) (pas de restriction de taux)

où l'argument entre parenthèses peut être une expression. Les convertisseurs de valeur effectuent une transformation arithmétique d'unités d'une sorte en unités d'une autre sorte. Le résultat peut devenir ensuite un terme dans une autre expression.

Exemples

Voici un exemple de l'opcode exp. Il utilise le fichier exp.csd.

Exemple 221. Exemple de l'opcode exp.

Voir les sections Audio en Temps Réel et Options de la Ligne de Commande pour plus d'information sur l'utilisation des options de la ligne de commande.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o exp.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs =1

gisine    ftgen     0, 0, 2^10, 10, 1 ;table for a sine wave

instr 1 ;master instrument
koct      linseg    6, p3, 12 ; octave register straight rising from 6 to 12
kexp      linseg    0, p3/3, 5, p3/3, 5, p3/3, 0 ;exponent goes from 0 to 5 and back
kdens     =         exp(kexp) ;density is e to the power of kexp
          printks   "Generated events per second: %d\n", 1, kdens
ktrig     metro     kdens ;trigger single notes in kdens frequency
 if ktrig == 1 then
;call instr 10 for 1/kdens duration, .5 amplitude and koct register
          event     "i", 10, 0, 1/kdens, .5, koct
 endif
endin

instr 10 ;performs one tone
ioct      rnd31     1, 0 ;random deviation maximum one octave plus/minus
aenv      transeg   p4, p3, -6, 0 ;fast decaying envelope for p4 amplitude
asin      poscil    aenv, cpsoct(p5+ioct), gisine ;sine for p5 octave register plus random deviation
          outs      asin, asin
endin

</CsInstruments>
<CsScore>
i 1 0 30
e
</CsScore>
</CsoundSynthesizer>


Sa sortie contiendra des lignes comme celles-ci :

Generated events per second: 1
  rtevent:	   T  0.000 TT  0.000 M:  0.00000  0.00000
new alloc for instr 10:
  rtevent:	   T  0.811 TT  0.811 M:  0.48906  0.48906
new alloc for instr 10:
Generated events per second: 2
  rtevent:	   T  1.387 TT  1.387 M:  0.48611  0.48611
  rtevent:	   T  1.833 TT  1.833 M:  0.48421  0.48421
Generated events per second: 3
  rtevent:	   T  2.198 TT  2.198 M:  0.47536  0.47536
  rtevent:	   T  2.506 TT  2.506 M:  0.46530  0.46530
  rtevent:	   T  2.773 TT  2.773 M:  0.44986  0.44986
Generated events per second: 4
  rtevent:	   T  3.009 TT  3.009 M:  0.48096  0.48096
  .........

Voir aussi

abs, frac, int, log, log10, i, sqrt

Nouveau dans la version 4.21