The Alternative Csound Reference Manual
Previous |  | Next

# wgclar

wgclar -- Creates a tone similar to a clarinet.

## Description

Audio output is a tone similar to a clarinet, using a physical model developed from Perry Cook, but re-coded for Csound.

## Syntax

ar wgclar kamp, kfreq, kstiff, iatt, idetk, kngain, kvibf, kvamp, ifn [, iminfreq]

## Initialization

iatt -- time in seconds to reach full blowing pressure. 0.1 seems to correspond to reasonable playing. A longer time gives a definite initial wind sound.

idetk -- time in seconds taken to stop blowing. 0.1 is a smooth ending

ifn -- table of shape of vibrato, usually a sine table, created by a function

iminfreq (optional) -- lowest frequency at which the instrument will play. If it is omitted it is taken to be the same as the initial kfreq. If iminfreq is negative, initialization will be skipped.

## Performance

A note is played on a clarinet-like instrument, with the arguments as below.

kamp -- Amplitude of note.

kfreq -- Frequency of note played.

kstiff -- a stiffness parameter for the reed. Values should be negative, and about -0.3. The useful range is approximately -0.44 to -0.18.

kngain -- amplitude of the noise component, about 0 to 0.5

kvibf -- frequency of vibrato in Hertz. Suggested range is 0 to 12

kvamp -- amplitude of the vibrato

## Examples

Here is an example of the wgclar opcode. It uses the files wgclar.orc and wgclar.sco.

Example 1. Example of the wgclar opcode.

    /* wgclar.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      kamp init 31129.60
      kfreq = 440
      kstiff = -0.3
      iatt = 0.1
      idetk = 0.1
      kngain = 0.2
      kvibf = 5.735
      kvamp = 0.1
      ifn = 1

      a1 wgclar kamp, kfreq, kstiff, iatt, idetk, kngain, kvibf, kvamp, ifn

      out a1
    endin
    /* wgclar.orc */

    /* wgclar.sco */
    ; Table #1, a sine wave.
    f 1 0 16384 10 1

    ; Play Instrument #1 for one second.
    i 1 0 1
    e
    /* wgclar.sco */

## Credits

Author: John ffitch (after Perry Cook)
University of Bath, Codemist Ltd.
Bath, UK

New in Csound version 3.47

Previous | Home | Next
wgbrass | Up | wgflute