public function closestDown($step = 'C', $alter = 0, $allowEqual = true) {
        if (count(func_get_args()) == 1 && $step instanceof Pitch && $step->isHeightless()) {
            $alter = $step->alter;
            $step = $step->step;
        }
        $base = new Pitch($step, $alter, 20);
        for ($i=0; $i<25; $i++) {
            $base->transpose(-12, $alter);
            if ($this->isHigherThan($base)) {
                return $base;
            }
            if ($allowEqual && $base->isEnharmonic($this)) {
                return $base;
            }
        }
        // this may happen if the pitch is really high or low
        return null;
    }
public function closestDown($step = 'C', $alter = 0, $allowEqual = true) {
        if (count(func_get_args()) == 1 && $step instanceof Pitch && $step->isHeightless()) {
            $alter = $step->alter;
            $step = $step->step;
        }
        $base = new Pitch($step, $alter, 20);
        for ($i=0; $i<25; $i++) {
            $base->transpose(-12, $alter);
            if ($this->isHigherThan($base)) {
                return $base;
            }
            if ($allowEqual && $base->isEnharmonic($this)) {
                return $base;
            }
        }
        // this may happen if the pitch is really high or low
        return null;
    }
public function closestDown ( $ step = 'C' , $ alter = 0 , $ allowEqual = true ) { if ( count ( func_get_args ( ) ) == 1 && $ step instanceof Pitch && $ step -> isHeightless ( ) ) { $ alter = $ step -> alter ; $ step = $ step -> step ; } $ base = new Pitch ( $ step , $ alter , 20 ) ; for ( $ i = 0 ; $ i < 25 ; $ i ++ ) { $ base -> transpose ( - 12 , $ alter ) ; if ( $ this -> isHigherThan ( $ base ) ) { return $ base ; } if ( $ allowEqual && $ base -> isEnharmonic ( $ this ) ) { return $ base ; } } // this may happen if the pitch is really high or low return null ; }
finds the nearest pitch that is lower than or equal, with a step and alter.
May be called with only one argument which is a heightless pitch.

@param  string $step       The step we are moving to
@param  int    $alter      the alteration we are moving to
@param  bool   $allowEqual when the pitch matches the step and alter, (if true) return the same pitch or (if false) go down one octave
@return [type] [description]
finds the nearest pitch that is lower than or equal with a step and alter . May be called with only one argument which is a heightless pitch .