Speaker coverage measurements with Python

NOTE: visit https://www.github.com/kreivalabs for current code versions.

Calculate the coverage pattern area of a point-source loudspeaker based on its dispersion angle and the measured distance from source to listener (or some other point).

This method uses Future functionality from http://www.python-future.org:


#!/usr/bin/env python 
# @version 1.1 02-November-2017
# @language: python3 
# @requirements: Future additions (http://www.python-future.org) 
# @description: Calculate speaker coverage based on driver dispersion angle and measured distance from source. 

# Import Future functions 
from __future__ import absolute_import, division, print_function, unicode_literals 
from builtins import input 
import math 

title="Loudspeaker Coverage Calculator" print(title) print("=" * 80) 

# Prompt for user input 
cone_degrees = int(input("Enter speaker dispersion angle in degrees: ")) measured_distance = float(input("Enter measured distance from speaker in feet: ")) 
# Convert angles to radians 
angle_radians = math.radians(cone_degrees) 
radians_div = angle_radians / 2 

# Calculate coverage pattern 
coverage_pattern = ((math.tan(radians_div)) * measured_distance)* 2 

# Round results to two decimal places 
coverage_pattern_round = str(round(coverage_pattern, 2))

# Return results, prompt for user input to quit 
print("Approximate speaker coverage pattern is: ", coverage_pattern_round, "ft.")

# Return results, prompt for user input to quit. 
print("=" * 80) 
print("Speaker coverage pattern is: ", coverage_pattern_round, "ft.") 
print("Press the <Enter> key to exit.")