# Chapter 2: Acoustics of Buildings¶

## Example 2.1, Page 52¶

In [1]:
from math import log10

#Variable Declaration
#delta_L=L2-L1

#Calculation
#I proportional to square of amplitude so when amplitude is doubled intensity will becomes 4 times
#L1=10*l0g10(I1/I0)
#L2=10*log10(I2/I0)
#delta_L=L2-L1
#delta_L=10*log(I1/I0)-10*log(I2/I0)=10*log(I2/I1)
I21=4;#I2/I1=4 because intensity=amp^2
delta_L=10*log10(I21);#increase in intensity level

#Result
print 'Increase in intensity level =',round(delta_L,2),'dB'

Increase in intensity level = 6.02 dB


## Example 2.2, Page 52¶

In [4]:
from math import sqrt

#Variable Declaration
#L2-L1=10*log10(I2/I1)
#so , we can write that
L2=40  #i dB
L1=10 #in dB
#where L1 and L2 are intensity level of two waves of same frequency

#Calculation
L=L2-L1;
#let I2/I1=I
I=10**(L/10);
#let a2/a1=a
a=sqrt(I);#Ratio of their amplitudes

#Result
print 'Ratio of their amplitudes =',round(a,3)

Ratio of their amplitudes = 31.623


## Example 2.3, Page 53¶

In [5]:
from math import log10

#Variable Declaration
I1=25.2 #in Wm^-2
I2=0.90 #in Wm^-2

#Calculation
B=10*log10(I1/I2) #Relative loudness of sound in dB

#Result
print 'Relative loudness of sound = ',round(B,2),'dB'

Relative loudness of sound =  14.47 dB


## Example 2.4, Page 53¶

In [6]:
from math import log10

#Variable Declaration
I=1e4 #in W/(m*m)
I0=1e-12 #in W/(m*m)

#Calculation
B=10*log10(I/I0);#intensity level

#Result
print "intensity level = ",B,'dB'

intensity level =  160.0 dB


## Example 2.5, Page 54¶

In [7]:
#Variable Declaration
B=5 # in dB

#Calculation
#B=10*log(I2/I1)
#let I2/I1=x
#10*log(x)=5
x=10**(5./10);

#Result
print 'Amplified sound is',round(x,3),'times more intense than the unamplified sound'

Amplified sound is 3.162 times more intense than the unamplified sound


## Example 2.6, Page 57¶

In [16]:
#Variable Declaration
d=198; #in meter
t=1.2;#in second

#Calculation
#velocity=distance/time
v=2*d/t;#velocity

#Result
print 'velocity =',v,'m/s'

velocity = 330.0 m/s


## Example 2.7, Page 64¶

In [8]:
#Variable Declaration
V=5600  #in  m^3
T=2     #in second
s=700   #in m^2

#Calculation
a=0.16*V/(s*T)

#Result
print "absorption coefficient =",a

absorption coefficient = 0.64


## Example 2.8, Page 65¶

In [10]:
#Variable Declaration
absorp1=92.90; #in m^^2
absorp2=92.90;#in m^2
V=2265.6;#in m^3

#Calculations
T1=0.16*V/(absorp1);
T2=0.16*V/(absorp1+absorp2);
ans=T2/T1;#effect on Reverberation time

#Result
print "Reverberation time reduced to ",ans,"of original value"

Reverberation time reduced to  0.5 of original value


## Example 2.9, Page 65¶

In [11]:
#Variable Declaration
v=25.2*20.3*8.04 ;#in m^3
T=0.75; #in second

#Calculations
absorp1=500*0.3176 ;#in m^2
absorp2=(0.16*v)/T;
T1=(0.16*v)/(absorp1+absorp2);#reverbaration time

#Result
print "reverbaration time =",round(T1,3),'sec'

reverbaration time = 0.635 sec


## Example 2.10, Page 66¶

In [12]:
#Variable Declaration
v=45*100*17.78;#in m^3

#Calculations
absorp1=(700*0.03)+(600*0.06)+(400*0.025)+(600*0.3);
absorp_p=600*4.3;
T1=(0.16*v)/(absorp1);#Reverbaration time (empty hall)
T2=(0.16*v)/(absorp_p+absorp1);#Reverbaration time with full capacity

#Results
print 'Reverbaration time (empty hall) =',round(T1,2),'sec' #printing mistake at the end in the textbook
print 'Reverbaration time with full capacity =',round(T2,2),'sec'

Reverbaration time (empty hall) = 51.83 sec
Reverbaration time with full capacity = 4.53 sec