Skip to content
This repository was archived by the owner on Mar 2, 2025. It is now read-only.
This repository was archived by the owner on Mar 2, 2025. It is now read-only.

Practical use of decibel (dBW, dBV) #279

Open
@fxkr

Description

@fxkr

Thanks for writing insect; I like it a lot!

Feature request

insect claims to support bel and decibel (as per the README and #67). However it doesn't seem to be able to do actually do much useful with them.

Would it be possible to add support for the following use cases?

1. Converting between decibel values and ratios

> 6 dB -> scalar

Challenge: should it return 4 (power ratio) or 2 (amplitude ratio)? Maybe it would need to be made explicit:

> 6 dB power -> scalar

Expected output: 4.

If there is a default, it needs to be power.

And back:

> 10 -> decibel power

Ideally it will automatically infer power/amplitude where possible. Probably complicated due to the fact that we probably lose the information whether we're dealing with power quantities or root power quantities before we even get to the scalar to decibel conversion.

> 100 mW / 1 mW -> decibel

Expected answer: 20 dB

2. Applying decibel values to quantities

> 20 decibel mV -> V

> 10dB * 1mW -> W

> 10 dBmW -> W

Expected answers: 0.01V and 0.01W and 0.01W

Note again that power and root-power quantities need to be treated differently.

Reverse direction:

> 10mW -> dBmW
> 10mV -> dBV

3. Converting between decibels of power and decibels of amplitude

> 10 decibel power -> decibel amplitude

Expected answer: 20 dB amplitute

Technical context (for anyone not familiar with decibels)

Decibel (and bel, which is rarely used) are usually used as a way of expressing ratios between power quantities (e.g. watts) or root power quantities (e.g. volts). For example, 10dB means a factor 10 increase in power; 20dB means a factor of 10 (!) in increase in e.g. voltage.

This notation is pervasive in many fields, such as RF engineering (both because it turns multiplications into additions (e.g. for loss calculations), and because it allows easier representation of extremely wide ranges of values (femtowatts ... megawatts).

As a special case, decibel is also often used to express power quantities and root power quantities, by specifying a decibel value (e.g. 15dB) with reference to a convenient base value (such as 1mW).

15dBmV usually means "15 dB relative to 1 mV" = (10^(15 / 20)) * 1mV = 5.6mV (note divisor 20 because its an amplitude / root power quantity)

15dBmW usually means "15 dB relative to 1 mW" = (10^(15 / 10)) * 1mW = 31.62mW (note divisor 10 because it's a power quantity)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions