(dynamicValue: DynamicValue, adjustment: number = 0)
| 64 | } |
| 65 | |
| 66 | public static dynamicToVelocity(dynamicValue: DynamicValue, adjustment: number = 0): number { |
| 67 | let velocity: number = 1; |
| 68 | switch (dynamicValue) { |
| 69 | case DynamicValue.PPP: |
| 70 | velocity = MidiUtils._minVelocity + 0 * MidiUtils.VelocityIncrement; |
| 71 | break; |
| 72 | case DynamicValue.PP: |
| 73 | velocity = MidiUtils._minVelocity + 1 * MidiUtils.VelocityIncrement; |
| 74 | break; |
| 75 | case DynamicValue.P: |
| 76 | velocity = MidiUtils._minVelocity + 2 * MidiUtils.VelocityIncrement; |
| 77 | break; |
| 78 | case DynamicValue.MP: |
| 79 | velocity = MidiUtils._minVelocity + 3 * MidiUtils.VelocityIncrement; |
| 80 | break; |
| 81 | case DynamicValue.MF: |
| 82 | velocity = MidiUtils._minVelocity + 4 * MidiUtils.VelocityIncrement; |
| 83 | break; |
| 84 | case DynamicValue.F: |
| 85 | velocity = MidiUtils._minVelocity + 5 * MidiUtils.VelocityIncrement; |
| 86 | break; |
| 87 | case DynamicValue.FF: |
| 88 | velocity = MidiUtils._minVelocity + 6 * MidiUtils.VelocityIncrement; |
| 89 | break; |
| 90 | case DynamicValue.FFF: |
| 91 | velocity = MidiUtils._minVelocity + 7 * MidiUtils.VelocityIncrement; |
| 92 | break; |
| 93 | |
| 94 | // special |
| 95 | case DynamicValue.PPPP: |
| 96 | velocity = 10; |
| 97 | break; |
| 98 | |
| 99 | case DynamicValue.PPPPP: |
| 100 | velocity = 5; |
| 101 | break; |
| 102 | |
| 103 | case DynamicValue.PPPPPP: |
| 104 | velocity = 3; |
| 105 | break; |
| 106 | |
| 107 | case DynamicValue.FFFF: |
| 108 | velocity = MidiUtils._minVelocity + 8 * MidiUtils.VelocityIncrement; |
| 109 | break; |
| 110 | |
| 111 | case DynamicValue.FFFFF: |
| 112 | velocity = MidiUtils._minVelocity + 9 * MidiUtils.VelocityIncrement; |
| 113 | break; |
| 114 | |
| 115 | case DynamicValue.FFFFFF: |
| 116 | velocity = MidiUtils._minVelocity + 10 * MidiUtils.VelocityIncrement; |
| 117 | break; |
| 118 | |
| 119 | // "forced" variants -> a bit louder than normal, same as FF for us |
| 120 | case DynamicValue.SF: |
| 121 | case DynamicValue.SFP: |
| 122 | case DynamicValue.SFZP: |
| 123 | case DynamicValue.SFPP: |
no test coverage detected