Recherche Google
OMChroma User ManualCreating a new Class > Initialize GEN slots
page précédentepage suivante

Initialize GEN slots

Tutorial MyClass_02 Initialize GEN slots

Csound orchestra

instr 1

Starts an instrument block.

idur = p3

The duration is set to p3

idurosc = 1/idur

The duration of the amplitude envelope is set to 1/idur

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

The variable p4 sets the amplitude. Linear values from 0 to 1000 or in dB from 0 to negative values

iaenv = p5

Function table number of the wave form of the amplitude envelope (GEN routine)

aenv poscil iamp, idurosc, iaenv

Amplitude envelope

asig rand aenv

The opcode "rand" generates a controlled random number at audio rate with aenv as amplitude envelope, then writes the output to the audio variable "asig"

out asig

The opcode "out" writes the audio data to an external device or stream.

endin

Ends the current instrument block

Csound Orchestra description

This simple orchestra is a white noise generator with the amplitude envelope control.

Make your OMChroma class

Copy the complete following instructions in a text file and save it as"myclass2.orc".

sr = 96000

kr = 96000

ksmps = 1

nchnls = 1

0dbfs = 8388607

instr 1

idur = p3

idurosc = 1/idur

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

iaenv = p5

aenv poscil iamp, idurosc, iaenv

asig rand aenv

out asig

endin

  • Make a new class following the steps of the Tutorial MyClass_01 Three lines class until "Double click on "myclass" to show the OM Class window,
  • Substitute the name of the slot "p4" with amp (or with what you wish),
  • Substitute the name of the slot "p5" with aenv (or with what you wish).
  • Open the Library window,
  • Open the "omchroma/csound" folder,
  • Select the "csound tables" folder and type "return",

The "Classes in package Csound Tables" will appear.

  • Click on the gen-07 icon and drag it on the aenv icon

The icon of aenv must change into a BPF icon (look at the picture), and this slot will have a GEN7 subroutine as default value.

Warning

Initialise always with a Csound table the slots witch stand for a BPF or a Csound GEN function number.

To more details about the slots of the OMChroma classes see Class Input Slots.

The example A checks the default values of the new class.

The example B uses a BPF as amplitude envelope.

The example C uses use a GEN subroutine as amplitude envelope.

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