NAME
Music::Gestalt - Compose music using gestalts.
VERSION
Version 0.06
SYNOPSIS
use Music::Gestalt;
# see below
DESCRIPTION
This module helps to compose music using musical gestalts (forms). A gestalt is similar to a list in MIDI::Score format, but so far it only supports note events, and all parameters are expressed as values between 0 and 1. This allows for more flexible transformations of the musical material.
CONSTRUCTOR
new
my $g = Music::Gestalt->new(score => $score);
Creates a new Music::Gestalt object. The optional score argument receives a score in MIDI::Score format.
PROPERTIES
PitchLowest
Sets (if you pass a value) and returns lowest pitch used in this gestalt.
PitchHighest
Sets (if you pass a value) and returns highest pitch used in this gestalt.
PitchMiddle
Sets (if you pass a value) and returns middle pitch of the range used in this gestalt.
PitchRange
Returns the pitch range used in this gestalt, ie. the pitches that occur will be between pitch middle +/- pitch range.
If you pass a value as parameter, the new pitch range will be calculated around the current pitch middle.
VelocityLowest
Sets (if you pass a value) and returns lowest velocity used in this gestalt.
VelocityHighest
Sets (if you pass a value) and returns highest velocity used in this gestalt.
VelocityMiddle
Sets (if you pass a value) and returns middle velocity of the range used in this gestalt.
VelocityRange
Returns the velocity range used in this gestalt, ie. the velocities that occur will be between velocity middle +/- velocity range.
If you pass a value as parameter, the new velocity range will be calculated around the current velocity middle.
Duration
Returns the duration of this gestalt.
If you pass a value as a parameter, it will be used as new duration.
NoteLength
Returns the note length property of this gestalt. "1" means that the original note lengths are retained, ".5" means that each note is half as long as it originally was.
If you pass a value as a parameter, it will be used as new note length.
Notes
Returns the note list of this gestalt.
Density
Sets and returns the density of this gestalt. The initial density is 1, meaning that all notes will be used. At density 0, a score created from this gestalt will have no events. At density 0.5, a score created from this gestalt will have half the original events, selected at random.
It is intentional that the density may not be greater than 1; there are too many possible ways to generate additional events.
Pitches
Returns or sets the pitches used in this gestalt. You should pass a reference to a list that contains the pitch numbers used. Returns a reference to a list of pitches that will be used. An empty list signifies that all pitches are used. Note that the set of pitches used is also influenced by the "PitchesMode" parameter.
PitchesMode
Returns or sets the pitch mode used in this gestalt.
METHODS
AsScore
Returns a structure representing the gestalt in MIDI::Score format.
Append
Appends other Music::Gestalt objects to this object.
Insert
Inserts other Music::Gestalt objects into this object.
MirrorTime
, MirrorPitch
, MirrorVelocity
Mirrors the start times, pitches and velocites found in the gestalt.
AUTOMATION METHODS
Using automation, you can vary a parameter over time (comparable to parameter automation in sequencers like Logic or Cubase). For each parameter that can be automated, there are three modes available:
- Absolute mode
-
In this mode, the currently set parameter values will be replaced with the values that you pass to the function. If you pass (0, 100), the parameter will range from 0 to 100 over the whole gestalt. If you pass (20, 50 20), the parameter will first rise from 20 to 50, then in the second half of the gestalt fall from 50 to 20. The parameter value is interpolated at the event's position.
- Relative mode
-
In this mode, the currently set parameter values will be multiplied with the values that you pass to the function. If you pass (0, 1), the parameter will fade in over the whole gestalt. If you pass (.2, .5 .2), the parameter will first fade in from 20% to 50%, then in the second half of the gestalt fade out from 50% to 20%. The parameter value is interpolated at the event's position.
- Off
-
Automation will not be applied.
Here are some examples how to call the automation functions:
$g->AutomateVelocityOff(); # default
$g->AutomateVelocityAbs(20, 50, 20);
$g->AutomateVelocityRel(0, 1);
The values passed to the automation methods will be applied evenly-spaced.
The following automation methods are available:
AutomateVelocityOff
,AutomateVelocityAbs
,AutomateVelocityRel
AutomatePitchMiddleOff
,AutomatePitchMiddleAbs
,AutomatePitchMiddleRel
AUTHOR
Christian Renz, <crenz @ web42.com>
BUGS
Please report any bugs or feature requests to bug-music-gestalt@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Music-Gestalt. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Please also consider adding a test case to your bug report (.t script).
COPYRIGHT & LICENSE
Copyright 2005 Christian Renz, <crenz @ web42.com>, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.