private function getRealVelocity(MidiSequenceHelper $sHelper, Note $note, Track $track, Channel $channel, $mIndex, $bIndex) { $velocity = $note->getVelocity(); //Check for Hammer effect if (!$channel->isPercussionChannel()) { $previousNote = $this->getPreviousNote($sHelper, $note, $track, $mIndex, $bIndex, false); if ($previousNote !== null && $previousNote->getNote()->getEffect()->isHammer()) { $velocity = max(Velocities::MIN_VELOCITY, $velocity - 25); } } //Check for GhostNote effect if ($note->getEffect()->isGhostNote()) { $velocity = max(Velocities::MIN_VELOCITY, $velocity - Velocities::VELOCITY_INCREMENT); } else { if ($note->getEffect()->isAccentuatedNote()) { $velocity = max(Velocities::MIN_VELOCITY, $velocity + Velocities::VELOCITY_INCREMENT); } else { if ($note->getEffect()->isHeavyAccentuatedNote()) { $velocity = max(Velocities::MIN_VELOCITY, $velocity + Velocities::VELOCITY_INCREMENT * 2); } } } return $velocity > 127 ? 127 : $velocity; }