NAME

MIDI::XML::PitchBend - MIDI Pitch Bend messages.

SYNOPSIS

use MIDI::XML::PitchBend;
use MIDI::Track;

$Pitch_Bend = MIDI::XML::PitchBend->new();
$Pitch_Bend->delta(384);
$Pitch_Bend->channel(0);
$Pitch_Bend->note(8192);
@event = $Pitch_Bend->as_event();
$midi_track = MIDI::Track->new();
push( @{$midi_track->events_r},\@event;
@xml = $Pitch_Bend->as_MidiXML();
print join("\n",@xml);

DESCRIPTION

MIDI::XML::PitchBend is a class encapsulating MIDI Pitch Bend messages. A Pitch Bend message includes either a delta time or absolute time as implemented by MIDI::XML::Message and the MIDI Note Off event encoded in 3 bytes as follows:

1110cccc 0xxxxxxx 0yyyyyyy

cccc = channel;

xxxxxxx = least significant bits

yyyyyyy = most significant bits

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

EXPORT

None by default.

METHODS AND ATTRIBUTES

$Pitch_Bend = MIDI::XML::PitchBend->new()

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

$Pitch_Bend = MIDI::XML::ChannelAftertouch->new($event);

Creates a new PitchBend object initialized with the values of a MIDI::Event pitch_wheel_change array.

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

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

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

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

$bend = $Pitch_Bend->bend() or $Pitch_Bend->bend($bend);

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

$ordinal = $Pitch_Bend->ordinal();

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

@event = $Pitch_Bend->as_event();

Returns a MIDI::Event pitch_wheel_change array initialized with the values of the PitchBend 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 = $Pitch_Bend->as_MusicXML();

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.