Recherche Google
OMChroma User ManualPredefined Classes > Wave Shaping Synthesis > Wave Shaping Synthesis with WSHP-1
page précédentepage suivante

Wave Shaping Synthesis with WSHP-1

Tutorial WSHP-1

Specific Slots

Name

Description

Default value

amp

Maximum Amplitude. Linear from >0.0 to 1000 or in dB from 0 to -∞ (see Tutorial Getting Started 02 - Amplitude and Internal Editor for more details)

500.0

freq

(Minimum) current frequency [Hz]

220.0

atk

Attack time of the amplitude envelope [sec]

0.085

dec

Decay time of the amplitude envelope [sec]

0.64

Class description

The WSHP-1 Class realizes a Wave Shaping Synthesis with the following controls:

  • The main amplitude,
  • The fundamental frequency,
  • The attack and the decay of the amplitude envelope (linear).
Patch description

The example A deals with the fundamental frequency.

The example B focuses on the attack time of the amplitude envelope.

The example C focuses on the decay time of the amplitude envelope.

Common Red Patches

For the red patch C#ed and Synt see Appendix A

Inside the Class

Csound Orchestra of the WSHP-1 Class.

instr 1

idur = p3

iamp = (p4 > 0.0 ? (p4*0.001*0dbfs) : (ampdbfs (p4)))

ifq = p5

iaudiofun = 1

itbloffset = 0.5 ; must be the half of the table size

ixmode = 1 ; index data mode normalized 0-1

ixferfun = 10

iatk = p6

idec = p7

if idur > (iatk+idec) igoto start ; correct atk and dec if too long

iatk = (((idur-iatk) > 0.01) ? iatk : (idur / 2.0))

idec = (((idur-iatk) > 0.01) ? (idur-iatk) : (idur / 2.0))

start:

aenv linen itbloffset-1, iatk, idur, idec ; envelope

a1 poscil aenv, ifq, iaudiofun ; sinus

a1 tablei a1 + itbloffset, ixferfun, ixmode ; transfer function

asound = a1 * iamp ; scale to amplitude

out asound

endin

page précédentepage suivante
A propos...Réalisé avec Scenari