SFS Toolbox
Theory Matlab Python
  • Installation
    • Requirements
    • Installation
  • Examples
    • Modal Room Acoustics
      • Sound Field for One Frequency
      • Frequency Response at One Point
  • Secondary Sources
    • Loudspeaker Arrays
    • Tapering
  • Frequency Domain
    • Monochromatic Sources
    • Monochromatic Driving Functions
    • Monochromatic Sound Fields
  • Time Domain
    • Time Domain Sources
    • Time Domain Driving Functions
    • Time Domain Sound Fields
  • Plotting
  • Utilities
  • References
  • Contributing
    • Development Installation
    • Building the Documentation
    • Running the Tests
    • Creating a New Release
  • Version History
SFS Toolbox
  • Docs »
  • Examples »
  • Modal Room Acoustics
  • Edit on GitHub

Modal Room Acoustics¶

In [1]:
import numpy as np
import matplotlib.pyplot as plt
import sfs
/home/docs/checkouts/readthedocs.org/user_builds/sfs-python/conda/0.4.0/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  return f(*args, **kwds)
In [2]:
%matplotlib inline
In [3]:
x0 = 1, 3, 1.80  # source position
L = 6, 6, 3  # dimensions of room
deltan = 0.01  # absorption factor of walls
n0 = 1, 0, 0  # normal vector of source (only for compatibility)
N = 20  # maximum order of modes

You can experiment with different combinations of modes:

In [4]:
#N = [[1], 0, 0]

Sound Field for One Frequency¶

In [5]:
f = 500  # frequency
omega = 2 * np.pi * f  # angular frequency
In [6]:
grid = sfs.util.xyz_grid([0, L[0]], [0, L[1]], L[2] / 2, spacing=.1)
In [7]:
p = sfs.mono.source.point_modal(omega, x0, n0, grid, L, N=N, deltan=deltan)

For now, we apply an arbitrary scaling factor to make the plot look good

TODO: proper normalization

In [8]:
p *= 0.05
In [9]:
sfs.plot.soundfield(p, grid);
../_images/examples_modal-room-acoustics_12_0.png

Frequency Response at One Point¶

In [10]:
f = np.linspace(20, 200, 180)  # frequency
omega = 2 * np.pi * f  # angular frequency

receiver = 1, 1, 1.8

p = [sfs.mono.source.point_modal(om, x0, n0, receiver, L, N=N, deltan=deltan)
     for om in omega]

plt.plot(f, sfs.util.db(p))
plt.xlabel('frequency / Hz')
plt.ylabel('level / dB')
plt.grid()
../_images/examples_modal-room-acoustics_14_0.png
Next Previous

© Copyright 2017, SFS Toolbox Developers Revision ac86493b.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: 0.4.0
Versions
latest
0.4.0
0.3.1
0.3.0
0.2.0
0.1.1
0.1.0
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.