Chapter 15, Musical sound & acoustic of buildings

Example 1, page 518

In [1]:
from __future__ import division
from math import log10
# decibles
#given data :
i1=4 #assume
i2=4*i1 #
dl=10*log10(i2/i1) #db
print "Decibles by which intensity level will decrease = %0.2f db " %dl
Decibles by which intensity level will decrease = 6.02 db 

Example 2, page 519

In [1]:
import sympy
# ratio of amlitudes
#given data :
l1=10 #db
l2=40 #db
dl=l2-l1 #db
x=(10**(dl/10)) #
x1=sympy.sqrt(x) #
print "Ratio of amplitudes =", x1
Ratio of amplitudes = 10*sqrt(10)

Example 3, page 521

In [3]:
# frequency
#given data :
x=264 #key note
g=x*(3.0/2) #
print "Frequency of note G = %0.f " %g
cd1=x*2 #
print "Frequency of note C = %0.f "%cd1
Frequency of note G = 396 
Frequency of note C = 528