Csound::Instrument

SYNOPSIS

use Csound::Instrument;

...

METHODS

new

my $composition = Csound::Composition->new(…);

my $instr = Csound::Instrument->new(
  {
    composition => $composition,
    parameters  => ['amplitude', 'foo_1', 'foo_2']
  }
);

If the parameter composition is passed with a reference to a Csound::Composition, the instrument's "play" method is shorthand for $composition->play($instr, …).

Most instrument play notes. However, to indicate that an instrument doesn't play a note (such as a high hat or a noise etc.), the flag no_note can be given.

my $instr = Csound::Instrument->new(
  $composition,   
  {
    parameters => ['amplitude', 'foo_1', 'foo_2'],
    no_note => 1
  }
);

definition

new

$instr->play($t_start, $duration, 'f♯5', …);

When the instrument was constructed with the composition parameter, this is a shorthand for

$composition->play($instr, $t_start, $duration, 'f♯5', …);

new

my $yes_no = $instr->plays_note();

In most cases, an instrument will play a note. When the flag/parameter no_note was given in "new", the instrument also doesn't play a note.

i

$instr -> i($t_start, $t_len, …);

Creates an i statement. It should not be called by the end user. Rather, the user should call "play" in Csound::Score.

orchestra_text

my $score = Csound::Score->new(…);
my $txt = $instr->orchestra_text($score);

Returns the text to be written into the score.

Sometimes, the instrument needs to have access to the score (notably for the f statements required in the oscil opcode family). Therefore, the method needs the $score parameter.

Copyright

Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0

1 POD Error

The following errors were encountered while parsing the POD:

Around line 31:

Unknown directive: =head