| @@ 24-32 (lines=9) @@ | ||
| 21 | * |
|
| 22 | * @return float |
|
| 23 | */ |
|
| 24 | public function getStoppedFrequency(float $stringLength = 1.0): float |
|
| 25 | { |
|
| 26 | if (Math::isZero($stringLength)) { |
|
| 27 | return 0; |
|
| 28 | } |
|
| 29 | $centsOverString = Cent::frequenciesToCents($stringLength, 1); |
|
| 30 | ||
| 31 | return Cent::centsToFrequency($centsOverString, $this->frequency); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param float $stringLength |
|
| @@ 51-59 (lines=9) @@ | ||
| 48 | * |
|
| 49 | * @return float |
|
| 50 | */ |
|
| 51 | public function getStringLength(float $frequency): float |
|
| 52 | { |
|
| 53 | if (Math::isZero($frequency)) { |
|
| 54 | return 0; |
|
| 55 | } |
|
| 56 | $centsOverString = Cent::frequenciesToCents($this->frequency, $frequency); |
|
| 57 | ||
| 58 | return $this->centsToStringLength($centsOverString); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * @param float $cents |
|