NAME

MIDI::XML::PolyKeyPressure - MIDI Poly Key Pressure messages.

SYNOPSIS

use MIDI::XML::PolyKeyPressure;
use MIDI::Track;

$Poly_key = MIDI::XML::PolyKeyPressure->new();
$Poly_key->delta(384);
$Poly_key->channel(0);
$Poly_key->note('F',1,4);
$Poly_key->pressure(64);
@event = $Poly_key->as_event();
$midi_track = MIDI::Track->new();
push( @{$midi_track->events_r},\@event;
@xml = $Poly_key->as_MidiXML();
print join("\n",@xml);

DESCRIPTION

MIDI::XML::PolyKeyPressure is a class encapsulating MIDI Poly Key Pressure messages. A Poly Key Pressure message includes either a delta time or absolute time as implemented by MIDI::XML::Message and the MIDI Poly Key Pressure event encoded in 3 bytes as follows:

1010cccc 0nnnnnnn 0ppppppp

cccc = channel;

nnnnnnn = note number

ppppppp = pressure

The classes for MIDI Poly Key Pressure messages and the other six channel messages are derived from MIDI::XML::Channel.

EXPORT

None.

METHODS AND ATTRIBUTES

$Poly_key = MIDI::XML::PolyKeyPressure->new();

This creates a new MIDI::XML::PolyKeyPressure object.

$Poly_key = MIDI::XML::PolyKeyPressure->new($event);

Creates a new PolyKeyPressure object initialized with the values of a MIDI::Event key_after_touch array.

$delta_time = $Poly_key->delta() or $Poly_key->delta($delta_time);

Returns the message time as a delta time or undef if it is an absolute time. Optionally sets the message time to the specified delta time. To avoid contradictory times, the absolute time is set to undef when a delta time is set.

This functionality is provided by the MIDI::XML::Message base class.

$absolute_time = $Poly_key->absolute() or $Poly_key->absolute($absolute_time);

Returns the message time as an absolute time or undef if it is a delta time. Optionally sets the message time to the specified absolute time. To avoid contradictory times, the delta time is set to undef when an absolute time is set.

This functionality is provided by the MIDI::XML::Message base class.

$time = $Poly_key->time();

Returns the message time, absolute or delta, whichever was last set.

This functionality is provided by the MIDI::XML::Message base class.

$channel = $Poly_key->channel() or $Poly_key->channel($channel);

Returns and optionally sets the channel number. Channel numbers are limited to the range 0-15.

This functionality is provided by the MIDI::XML::Channel base class.

$note_no = $Poly_key->note();

Returns the MIDI note number. Note numbers are limited to the range 0-127.

$note_no = $$Poly_key->note($note_no);

Sets and returns the MIDI note number to the specified number. Note numbers are limited to the range 0-127.

$note_no = $Poly_key->note($step, $alter, $octave);

Sets the MIDI note number to the specified step, alter and octave values. Step is a letter designation of the note, /A|B|C|D|E|F|G/, alter is -1 for flat, 0 for natural, and 1 for sharp, and octave is the octave, -1 to 9. Valid values range from ('C',0,-1) to ('G',0,9). Returns the MIDI note number.

$note_no = $Note_Off->note($step, $octave);

Sets and returns the MIDI note number to the specified step and octave values assuming a 0 alter value.

This functionality is provided by the MIDI::XML::NoteOff class.

$pressure = $Poly_key->pressure() or $Poly_key->pressure($pressure);

Returns and optionally sets the pressure. Values are limited to the range 0-127.

$ordinal = $Poly_key->ordinal();

Returns a value to be used to order events that occur at the same time.

@event = $Poly_key->as_event();

Returns a MIDI::Event key_after_touch array initialized with the values of the PolyKeyPressure object. MIDI::Event does not expect absolute times and will interpret them as delta times. Calling this method when the time is absolute will not generate a warning or error but it is unlikely that the results will be satisfactory.

@xml = $Poly_key->as_MidiXML();

Returns an array of elements formatted according to the MidiXML DTD. These elements may be assembled by track into entire documents with the following suggested DOCTYPE declaration:

<!DOCTYPE MIDI PUBLIC
	"-//Recordare//DTD MusicXML 0.7 MIDI//EN"
	"http://www.musicxml.org/dtds/midixml.dtd">

AUTHOR

Brian M. Ames, <bmames@apk.net>

SEE ALSO

MIDI::Event.

COPYRIGHT and LICENSE

Copyright 2002 Brian M. Ames. This software may be used under the terms of the GPL and Artistic licenses, the same as Perl itself.