public function toNoteNumber() {
        $chromas = array('C' => 0, 'D' => 2, 'E' => 4, 'F' => 5, 'G' => 7, 'A' => 9, 'B' => 11);
        $num = $chromas[$this->step];
        $num += $this->alter; // adds a sharp or flat, e.g. 1 = sharp, -1 = flat, -2 = double-flat...

        if ($num < 0) {
            $num += ($this->octave - 3) * 12;
        } elseif ($num > 11) {
            $num += ($this->octave - 5) * 12;
        } else {
            $num += ($this->octave - 4) * 12;            
        }

        return $num;
    }