RMS to decibel. Arguments --------- rms (float): The value to be scaled. power (bool, optional): If array is a power signal. Defaults to False. ref (float, optional): Reference value for decibel scale. Defaults to 1.0. Returns ------- float: Dec
(rms: float, power: bool = False, ref: float = 1.0)
| 47 | |
| 48 | @nb.njit |
| 49 | def rms2dB(rms: float, power: bool = False, ref: float = 1.0) -> float: |
| 50 | """ |
| 51 | RMS to decibel. |
| 52 | |
| 53 | Arguments |
| 54 | --------- |
| 55 | rms (float): The value to be scaled. |
| 56 | power (bool, optional): If array is a power signal. Defaults to False. |
| 57 | ref (float, optional): Reference value for decibel scale. Defaults to 1.0. |
| 58 | |
| 59 | Returns |
| 60 | ------- |
| 61 | float: Decibel scaled value. |
| 62 | |
| 63 | """ |
| 64 | return (10 if power else 20) * np.log10(rms / ref) |
| 65 | |
| 66 | |
| 67 | @nb.njit |