function AmpltToDb(const Data: TDenseMtxVec; Base: Double; Span: Double; aMax: Double; Normalized: Boolean): Double;
Convert amplitude to decibels in place.
| # | Name | Description |
|---|---|---|
| 1 | Data | Amplitude data |
| 2 | converted to dB in place. | |
| 3 | Base | Logarithm base |
| 4 | use 10 for decibels. | |
| 5 | Span | Dynamic range in dB |
| 6 | output is clipped at -Span. | |
| 7 | aMax | Reference amplitude X_(max). |
| 8 | Normalized | When True, peak maps to 0 dB and floor to -Span. |
Returns: Double - The clipping floor -Span.
Remarks:
Converts the amplitude data in Data to a decibel scale in place, using X_(dB) = 20 log_(Base)(X/X_(max)), clipped from below at -Span. Use Base =10 for true decibels; the scale factor is fixed at 20 (so this is the amplitude, not the power, convention). Span is the dynamic range in dB: any value mapping below -Span is set to -Span. When Normalized is False the reference X_(max) = aMax is used as given; when Normalized is True the data is normalized so its maximum becomes 0 dB and its floor -Span. If aMax is not positive every output is set to -Span. The function returns -Span.