<?php require_once '../PHPMusicXML.php'; $scale = new Scale(array('root' => new Pitch('C4'), 'mode' => 'prometheus')); $measureOptions = array('divisions' => 4, 'key' => new Key('C major'), 'time' => array('beats' => 6, 'beat-type' => 8), 'clef' => array(new Clef('treble'), new Clef('bass')), 'barline' => array(new Barline(array('location' => 'left', 'bar-style' => 'light-heavy', 'repeat' => array('direction' => 'forward', 'winged' => 'none'), 'ending' => array('type' => 'stop', 'number' => 1))), new Barline(array('location' => 'right', 'bar-style' => 'heavy-light', 'repeat' => array('direction' => 'backward'), 'ending' => array('type' => 'stop', 'number' => 2)))), 'implicit' => false, 'non-controlling' => false, 'number' => 1, 'width' => 180); $pitches = $scale->getPitches(); //var_dump($pitches); $score = new Score(); $part = new Part('Piano'); $measure = new Measure($measureOptions); $layer = new Layer(); foreach ($pitches as $pitch) { $note = new Note(array('pitch' => $pitch, 'duration' => 4, 'type' => 'quarter')); $layer->addNote($note); // this essentially adds a chord with only one note in it. } $measure->addLayer($layer); $newlayer = clone $layer; $newlayer->transpose(-12); $measure->addLayer($newlayer); // puts this layer in staff two $newlayer->setStaff(2); for ($i = 0; $i < 12; $i++) { $newmeasure = clone $measure; $newmeasure->transpose($i, -1); $part->addMeasure($newmeasure); } $score->addPart($part); $xml2 = $score->toXML(); ?> <script src="vexflow/jquery.js"></script> <script src="vexflow/vexflow-debug.js"></script>