1 | <?php |
||
7 | class Harmonic |
||
8 | { |
||
9 | private $halfStop; |
||
10 | private $baseStop; |
||
11 | |||
12 | /** |
||
13 | * Harmonic constructor. |
||
14 | * |
||
15 | * @param float $halfStop The string length of the harmonic-pressure stop. |
||
16 | * @param float $baseStop The string length of the base stop (defaults to |
||
17 | * 1.0, the open string). |
||
18 | */ |
||
19 | public function __construct(float $halfStop, float $baseStop = 1.0) |
||
28 | |||
29 | /** |
||
30 | * Returns the sounding frequency of the harmonic, on a given string. |
||
31 | * |
||
32 | * @param \ExtendedStrings\Strings\VibratingString $string |
||
33 | * |
||
34 | * @return float |
||
35 | */ |
||
36 | public function getSoundingFrequency(VibratingString $string): float |
||
45 | |||
46 | /** |
||
47 | * Returns the string lengths that produce the given harmonic number. |
||
48 | * |
||
49 | * @param int $number The harmonic number. |
||
50 | * @param bool $exclusive When enabled, equivalent lengths will only be |
||
51 | * returned for the lowest harmonic number, e.g. the |
||
52 | * string length 0.5 will only be returned for |
||
53 | * harmonic 2 (not for harmonics 4, 6, 8, etc.). |
||
54 | * |
||
55 | * @return float[] |
||
56 | */ |
||
57 | public static function getStringLengthsFromNumber(int $number, bool $exclusive = false): array |
||
68 | |||
69 | /** |
||
70 | * Returns the harmonic series. |
||
71 | * |
||
72 | * @param int $limit |
||
73 | * |
||
74 | * @return float[] |
||
75 | */ |
||
76 | public static function getSeries(int $limit): array |
||
86 | } |
||
87 |