prepiano
Prev | Orchestra Opcodes and Operators | Next

## prepiano

prepiano — Creates a tone similar to a piano string prepared in a Cageian fashion.

## Description

Audio output is a tone similar to a piano string, prepared with a number of rubbers and rattles. he methos uses a physical model developed from solving the partial differential equation.

## Syntax

    ares prepiano ifreq, iNS, iD, iK, \
        iT30,iB, kbcl, kbcr, imass, ifreq, iinit, ipos, ivel, isfreq, \
        isspread[, irattles, irubbers]

    al,ar prepiano ifreq, iNS, iD, iK, \
        iT30,iB, kbcl, kbcr, imass, ifreq, iinit, ipos, ivel, isfreq, \
        isspread[, irattles, irubbers]

## Initialization

ifreq -- The base frequency of the string.

iNS -- the number of strings involved. In a real piano 1, 2 or 3 strings are found it different frequency regions.

iD -- the amount each string other that the first is detuned from the main frequency, measured in cents.

iK -- dimensionless siffness parameter.

iT30 -- 30 db decay time in seconds.

ib -- high-frequency loss parameter (keep this small).

imass -- the mass of the pianio hammer.

ifreq -- the frequency of the natural vibrations of the hammer.

iinit -- the ibitial position of the hammer.

ipos -- position along the string that the strike occurs.

ivel -- normalized strike velocity.

isfreq -- scanning frequncy of the reading place.

isspread -- scanning frequncy spread.

irattles -- table number giving locations of any rattle(s).

irubbers -- table number giving locations of any rubbers(s).

The rattles and rubbers tables are collections of four values, preceeded by a count. In the case of a rattle the four are position, mass density ratio of rattle/string, frequency of rattle and vertical length of the rattle. For the rubber the fours are position, mass density ratio of rubber/string, frequency of rubber and the loss parameter.

## Performance

A note is played on a piano string, with the arguments as below.

kbcL -- Boundary condition at left end of string (1 is clamped, 2 pivoting and 3 free).

kbcR -- Boundary condition at right end of string (1 is clamped, 2 pivoting and 3 free).

Note that changing the boundary conditions during playing may lead to glitches and is made available as an experiment.

## Examples

Here is an example of the prepiano opcode. It uses the file prepiano.csd.

Example 342. Example of the prepiano opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o prepiano.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 2;

    ; Instrument #1.
    instr 1
    ;;          fund NS detune stiffness decay loss (bndry) (hammer) scan prep
    aa,ab prepiano 60, 3, 10, p4, 3, 0.002, 2, 2, 1, 5000, -0.01, p5, p6, 0, 0.1, 1, 2
          outs aa*.75, ab*.75
    endin
    </CsInstruments>
    <CsScore>
    f1 0 8 2 1 0.6 10 100 0.001 ;; 1 rattle
    f2 0 8 2 1 0.7 50 500 1000  ;; 1 rubber
    i1 0.0 0.5 1 0.09 20
    i1 0.5 .  -1 0.09 40        ;; 1 -> skip initialisation
    i1 1.0 .  -1 0.09 60
    i1 1.5 .  -1 0.09 80
    i1 2.0 1.8  -1 0.09 100
    e
    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Stefan Bilbao
University of Edinburgh, UK
Author: John ffitch
University of Bath, Codemist Ltd.
Bath, UK

New in Csound version 5.05

Prev | Up | Next
prealloc | Home | print