use ianring\PHPMusicXML; error_reporting(E_ALL); ini_set('display_errors', 1); //require_once SITE_ROOT . '/current/vendor/autoload.php'; require_once '../PHPMusicXML.php'; $score = new Score(); $measure = new Measure(array('divisions' => 24, 'direction' => array('placement' => 'below', 'direction-type' => array('words' => array('default-x' => 0, 'default-y' => 15, 'font-size' => 10, 'font-weight' => 'bold', 'font-style' => 'italic', 'text' => 'Andantino')), 'staff' => 1, 'sound-dynamics' => 40), 'barline' => array(array('location' => 'left', 'bar-style' => 'light-heavy', 'repeat' => 'forward', 'ending' => array('type' => 'stop', 'number' => 1)), array('location' => 'right', 'bar-style' => 'heavy-light', 'repeat' => 'backward', 'ending' => array('type' => 'stop', 'number' => 1))), 'implicit' => true, 'number' => 1, 'width' => 180)); // pitch can be any of the following // C4, c+4, C+4, C#4, c#4, c-4, C-4, Cb4, // array('step'=>'C','alter'=>-1,'octave'=>4) $note = new Note(array('pitch' => 'C4', 'duration' => 4, 'type' => 'whole')); $note = new Note(array('rest' => true, 'dot' => true, 'staccato' => true, 'chord' => false, 'voice' => 1, 'staff' => 1, 'pitch' => 'C4', 'duration' => 4, 'type' => 'quarter', 'tied' => 'stop', 'tuplet' => array('bracket' => 'no', 'number' => 1, 'placement' => 'above', 'type' => 'start'), 'stem' => array('default-y' => 3, 'direction' => 'up'), 'beam' => array(array('number' => 1, 'type' => 'begin'), array('number' => 1, 'type' => 'begin')), 'accidental' => array('courtesy' => true, 'editorial' => null, 'bracket' => false, 'parentheses' => true, 'size' => false, 'type' => 'natural'))); // a quarter-note triplet $note = new Note(array('chord' => false, 'dot' => false, 'pitch' => 'E4', 'duration' => 8, 'type' => 'quarter', 'time-modification' => array('actual-notes' => 3, 'normal-notes' => 2, 'normal-type' => 'eighth'))); $measure->addNote($note); $note->transpose(2); // transposes the note down 4 semitones $measure->addNote($note); $note->transpose(2); // transposes the note down 4 semitones $measure->addNote($note); $note = new Note(array('rest' => array('measure' => true), 'duration' => 8, 'voice' => 1)); $note = new Note(array('chord' => true, 'pitch' => 'C4', 'duration' => 4, 'type' => 'whole')); $direction = new Direction(array('placement' => 'above', 'direction-type' => array('wedge' => array('default-y' => 20, 'spread' => 0, 'type' => 'crescendo')), 'offset' => -8)); $direction = new Direction(array('placement' => 'above', 'direction-type' => array('words' => array('default-x' => 15, 'default-y' => 15, 'font-size' => 9, 'font-style' => 'italic', 'words' => 'dolce')), 'offset' => -8)); // many direction-types can go together into one direction $direction = new Direction(array('placement' => 'above', 'direction-type' => array(array('words' => array('default-x' => 15, 'default-y' => 15, 'font-size' => 9, 'font-style' => 'italic', 'words' => 'dolce')), array('wedge' => array())), 'offset' => -8)); $measure->addNote($note); $note = new Note(array('pitch' => array('step' => 'C', 'alter' => -1, 'octave' => 4), 'duration' => 4, 'tie' => 'start', 'type' => 'whole', 'lyric' => array('syllabic' => 'end', 'text' => 'meil', 'extend' => true))); $note->transpose(4);
//require_once SITE_ROOT . '/current/vendor/autoload.php'; require_once '../PHPMusicXML.php'; $score = new Score(); $part = new Part('Viola'); $scale = new Scale(array('root' => new Pitch('D4'), 'mode' => 'lydian augmented')); $pitches = $scale->getPitches(); $measure = new Measure(); foreach ($pitches as $pitch) { $measure->addNote(new Note(array('pitch' => $pitch, 'duration' => 4))); } $part->addMeasure($measure); $scale->setProperty('mode', 'bebop dominant'); $pitches = $scale->getPitches(); $measure = new Measure(); foreach ($pitches as $pitch) { $measure->addNote(new Note(array('pitch' => $pitch, 'duration' => 4))); } $part->addMeasure($measure); $score->addPart($part); $part->addMeasure($measure); $xml2 = $score->toXML('partwise'); ?> <html> <head> <meta name="viewport" content="initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"> <script src="vexflow/jquery.js"></script> <script src="vexflow/vexflow-debug.js"></script> <script> $(document).ready(function() {