public function toLilypond() {
        $out = strtolower($this->step);
        if ($this->alter == 2) {
            $out .= 'isis';
        }
        if ($this->alter == 1) {
            $out .= 'is';
        }
        if ($this->alter == -1) {
            $out .= 'es';
        }
        if ($this->alter == -2) {
            $out .= 'eses';
        }

        // contrary to the standards in this class, lilypond thinks that B sharp belongs in the same
        // octave as the neighbouring B natural. So we have to adjust those specifically
        $octave = $this->octave;
        if ($this->step == 'B' && $this->alter > 0) {
            $octave--;
        }
        // the same must be done for C flats
        if ($this->step == 'C' && $this->alter < 0) {
            $octave++;
        }

        if ($octave > 3) {
            $out .= str_repeat("'", $octave - 3);
        } else {
            $out .= str_repeat(",", 3 - $octave);
        }
        return $out;
    }