The Alternative Csound Reference Manual
Previous |  | Next

# marimba

marimba -- Physical model related to the striking of a wooden block.

## Description

Audio output is a tone related to the striking of a wooden block as found in a marimba. The method is a physical model developed from Perry Cook but re-coded for Csound.

## Syntax

ar marimba kamp, kfreq, ihrd, ipos, imp, kvibf, kvamp, ivibfn, idec [, idoubles] [, itriples]

## Initialization

ihrd -- the hardness of the stick used in the strike. A range of 0 to 1 is used. 0.5 is a suitable value.

ipos -- where the block is hit, in the range 0 to 1.

imp -- a table of the strike impulses. The file marmstk1.wav is a suitable function from measurements and can be loaded with a GEN01 table. It is also available at ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/.

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

idec -- time before end of note when damping is introduced

idoubles (optional) -- percentage of double strikes. Default is 40%.

itriples (optional) -- percentage of triple strikes. Default is 20%.

## Performance

kamp -- Amplitude of note.

kfreq -- Frequency of note played.

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

kvamp -- amplitude of the vibrato

## Examples

Here is an example of the marimba opcode. It uses the files marimba.orc, marimba.sco, and marmstk1.wav.

Example 1. Example of the marimba opcode.

    /* marimba.orc */
    ; Initialize the global variables.
    sr = 22050
    kr = 2205
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; kamp = 31129.60
      ; kfreq = 440
      ; ihrd = 0.5
      ; ipos = 0.561
      ; imp = 1
      ; kvibf = 6.0
      ; kvamp = 0.05
      ; ivibfn = 2
      ; idec = 0.1

      a1 marimba 31129.60, 440, 0.5, 0.561, 1, 6.0, 0.05, 2, 0.1

      out a1
    endin
    /* marimba.orc */

    /* marimba.sco */
    ; Table #1, the "marmstk1.wav" audio file.
    f 1 0 256 1 "marmstk1.wav" 0 0 0
    ; Table #2, a sine wave for the vibrato.
    f 2 0 128 10 1

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

## See Also

vibes

## Credits

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

New in Csound version 3.47

Previous | Home | Next
mandol | Up | massign