The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MIDI::XML::ChannelKeyPressure - MIDI Channel Key Pressure messages.

SYNOPSIS

  use MIDI::XML::ChannelKeyPressure;
  use MIDI::Track;

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

DESCRIPTION

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

1101cccc 0ppppppp

cccc = channel;

ppppppp = pressure

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

EXPORT

None by default.

METHODS AND ATTRIBUTES

$Channel_Pressure = MIDI::XML::ChannelKeyPressure->new()

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

$Channel_Pressure = MIDI::XML::ChannelKeyPressure->new($event);

Creates a new ChannelKeyPressure object initialized with the values of a MIDI::Event channel_after_touch array.

$delta_time = $Channel_Pressure->delta() or $Channel_Pressure->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 = $Channel_Pressure->absolute() or $Channel_Pressure->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 = $Channel_Pressure->time();

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

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

$channel = $Channel_Pressure->channel() or $Channel_Pressure->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.

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

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

$ordinal = $Channel_Pressure->ordinal();

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

@event = $Channel_Pressure->as_event();

Returns a MIDI::Event channel_after_touch array initialized with the values of the ChannelKeyPressure 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 = $Channel_Pressure->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.