Exemple #1
0
 function addNote($note)
 {
     $chord = new Chord();
     $chord->addNote($note);
     $this->addChord($chord);
 }
Exemple #2
0
        // this essentially adds a chord with only one note in it.
    }
}
$measure->addLayer($layer);
$part->addMeasure($measure);
// 2nd measure
$measure = new Measure($measureOptions);
$layer = new Layer();
foreach ($pitches as $pitch) {
    if (is_array($pitch)) {
        $chord = new Chord();
        foreach ($pitch as $p) {
            $pitch = new Pitch($p);
            $pitch->transpose(-12);
            $note = new Note(array('pitch' => $p, 'duration' => 4, 'type' => 'quarter'));
            $chord->addNote($note);
        }
        $layer->addChord($chord);
    } else {
        $pitch = new Pitch($pitch);
        $pitch->transpose(-12);
        $note = new Note(array('pitch' => $pitch, 'duration' => 4, 'type' => 'quarter'));
        $layer->addNote($note);
    }
}
$measure->addLayer($layer);
$part->addMeasure($measure);
// 3nd measure
$measure = new Measure($measureOptions);
$layer = new Layer();
$note = new Note(array('pitch' => new Pitch('F2'), 'duration' => 8, 'type' => 'half'));