Created
March 29, 2024 17:57
-
-
Save rtgnx/64c963b0e9a32497e4995d70f5632cb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import math | |
def amp_power_required(lreq, spl, hr, d2, dref): | |
dBW = lreq - spl + (20 * math.log10(d2 / dref)) + hr | |
return math.pow(10, dBW / 10) | |
# Speaker sensitivity measured at 1 W at 1 meter distance | |
spls = [82, 84, 86, 88, 91, 92, 94, 96, 98] | |
head_room = 6 # dB | |
distance = 3 # meters | |
desired_loudness = 85 # dB | |
print(f"Loudness: {desired_loudness} dB @ {distance} meters") | |
print(f"Head room: {head_room} dB") | |
for spl in spls: | |
W = amp_power_required(desired_loudness, spl, head_room, distance, 1) | |
print(f"W: {W // 1}\tSPL: {spl} ") | |
""" | |
Example: | |
Loudness: 85 dB @ 3 meters | |
Head room: 6 dB | |
W: 71.0 SPL: 82 | |
W: 45.0 SPL: 84 | |
W: 28.0 SPL: 86 | |
W: 17.0 SPL: 88 | |
W: 9.0 SPL: 91 | |
W: 7.0 SPL: 92 | |
W: 4.0 SPL: 94 | |
W: 2.0 SPL: 96 | |
W: 1.0 SPL: 98 | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment