Esempio n. 1
0
 public function __construct($name, $type)
 {
     $this->name = $name;
     $this->type = $type;
     $this->scale = new Scale();
     $this->scale = $this->scale->getByName($name, $type);
     if (isset($this->scale) && count($this->scale)) {
         foreach ($this->scale as $note) {
             $chord = new Chord();
             $chord->getByName($note, $this->config[$type][count($this->chords)]);
             array_push($this->chords, $chord);
         }
     }
 }
Esempio n. 2
0
 public function getByChords($chords)
 {
     $_chord = new Chord();
     $notes = array();
     foreach ($chords as $chord) {
         $name = Strings::ucfirst($chord["name"]);
         $type = Strings::sanitize_u($chord["type"]);
         $_chord->getByName($name, $type);
         $notes = array_merge($notes, $_chord->notes);
     }
     $notes = array_unique($notes);
     $this->possible = array();
     $scales = $this->getTypes();
     for ($i = 0; $i < 12; $i++) {
         foreach ($scales as $scale) {
             $this->scale = null;
             $this->getByName("C", $scale, $i);
             if ($this->containsNotes($notes, $this->scale)) {
                 array_push($this->possible, array("name" => current($this->scale), "type" => $scale));
             }
         }
     }
     return $this->possible;
 }