SFS Toolbox
Theory Matlab Python
  • Installation
    • Requirements
    • Installation
  • Examples
    • Sound Field Synthesis
      • Circular loudspeaker arrays
        • Wave Field Synthesis (WFS)
        • Near-Field Compensated Higher Order Ambisonics (NFC-HOA)
      • Linear loudspeaker array
        • Wave Field Synthesis (WFS)
    • WFS Referencing Schemes
      • Circular loudspeaker arrays
        • Line as reference contour
        • Circle as reference contour
    • Modal Room Acoustics
      • Sound Field for One Frequency
      • Frequency Response at One Point
    • Mirror Image Sources and the Sound Field in a Rectangular Room
      • 2D Mirror Image Sources
      • Monochromatic Sound Field
      • Spatio-temporal Impulse Response
    • Animations of a Pulsating Sphere
      • Particle Displacement
      • Particle Velocity
      • Sound Pressure
    • Example Python Scripts
  • API Documentation
    • sfs.fd
      • sfs.fd.source
        • point()
        • point_velocity()
        • point_averaged_intensity()
        • point_dipole()
        • point_modal()
        • point_modal_velocity()
        • point_image_sources()
        • line()
        • line_velocity()
        • line_dipole()
        • line_bandlimited()
        • line_dirichlet_edge()
        • plane()
        • plane_velocity()
        • plane_averaged_intensity()
        • pulsating_sphere()
        • pulsating_sphere_velocity()
      • sfs.fd.wfs
        • line_2d()
        • point_2d()
        • point_25d()
        • point_3d()
        • point_25d_legacy()
        • plane_2d()
        • plane_25d()
        • plane_3d()
        • focused_2d()
        • focused_25d()
        • focused_3d()
        • preeq_25d()
        • plane_3d_delay()
        • soundfigure_3d()
      • sfs.fd.nfchoa
        • plane_2d()
        • point_25d()
        • plane_25d()
      • sfs.fd.sdm
        • line_2d()
        • plane_2d()
        • plane_25d()
        • point_25d()
      • sfs.fd.esa
        • plane_2d_edge()
        • plane_2d_edge_dipole_ssd()
        • line_2d_edge()
        • line_2d_edge_dipole_ssd()
        • point_25d_edge()
      • shiftphase()
      • displacement()
      • synthesize()
      • secondary_source_point()
      • secondary_source_line()
    • sfs.td
      • sfs.td.source
        • point()
        • point_image_sources()
      • sfs.td.wfs
        • plane_25d()
        • point_25d()
        • point_25d_legacy()
        • focused_25d()
        • driving_signals()
      • sfs.td.nfchoa
        • matchedz_zpk()
        • plane_25d()
        • point_25d()
        • plane_3d()
        • point_3d()
        • driving_signals_25d()
        • driving_signals_3d()
      • synthesize()
      • apply_delays()
      • secondary_source_point()
    • sfs.array
      • SecondarySourceDistribution
        • SecondarySourceDistribution.take()
      • as_secondary_source_distribution()
      • linear()
      • linear_diff()
      • linear_random()
      • circular()
      • rectangular()
      • rounded_edge()
      • edge()
      • planar()
      • cube()
      • sphere_load()
      • load()
      • weights_midpoint()
      • concatenate()
    • sfs.tapering
      • none()
      • tukey()
      • kaiser()
    • sfs.plot2d
      • virtualsource()
      • reference()
      • secondary_sources()
      • loudspeakers()
      • amplitude()
      • level()
      • particles()
      • vectors()
      • add_colorbar()
    • sfs.plot3d
      • secondary_sources()
    • sfs.util
      • rotation_matrix()
      • wavenumber()
      • direction_vector()
      • sph2cart()
      • cart2sph()
      • asarray_1d()
      • asarray_of_rows()
      • as_xyz_components()
      • as_delayed_signal()
      • strict_arange()
      • xyz_grid()
      • normalize()
      • probe()
      • broadcast_zip()
      • normalize_vector()
      • db()
      • XyzComponents
        • XyzComponents.x
        • XyzComponents.y
        • XyzComponents.z
        • XyzComponents.apply()
      • DelayedSignal
        • DelayedSignal.data
        • DelayedSignal.samplerate
        • DelayedSignal.time
      • image_sources_for_box()
      • spherical_hn2()
      • source_selection_plane()
      • source_selection_point()
      • source_selection_line()
      • source_selection_focused()
      • source_selection_all()
      • max_order_circular_harmonics()
      • max_order_spherical_harmonics()
    • default
      • default.c
      • default.rho0
      • default.selection_tolerance
      • default.reset()
  • References
  • Contributing
    • Development Installation
    • Building the Documentation
    • Running the Tests
    • Creating a New Release
  • Version History
SFS Toolbox
  • Examples
  • Modal Room Acoustics
  • View page source

This page was generated from /home/docs/checkouts/readthedocs.org/user_builds/sfs-python/checkouts/184/doc/examples/modal-room-acoustics.ipynb. Interactive online version: Binder badge

Modal Room Acoustics

[1]:
import numpy as np
import matplotlib.pyplot as plt
import sfs
[2]:
%matplotlib inline
[3]:
x0 = 1, 3, 1.80  # source position
L = 6, 6, 3  # dimensions of room
deltan = 0.01  # absorption factor of walls
N = 20  # maximum order of modes

You can experiment with different combinations of modes:

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

Sound Field for One Frequency

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

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

TODO: proper normalization

[8]:
p *= 0.05
[9]:
sfs.plot2d.amplitude(p, grid);
../_images/examples_modal-room-acoustics_12_0.svg

Frequency Response at One Point

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

receiver = 1, 1, 1.8

p = [sfs.fd.source.point_modal(om, x0, 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.svg
Previous Next

© Copyright 2019, SFS Toolbox Developers.

Built with Sphinx using a theme provided by Read the Docs.