MCPcopy Create free account
hub / github.com/PyTTaMaster/PyTTa / rms2dB

Function rms2dB

pytta/utils/maths.py:49–64  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

47
48@nb.njit
49def 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

Callers 1

arr2dBFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected