# Modelling Acoustics With Open-Source Software

One of the backbones of the scientific paradigms is the repeatability of results. Ideally, all software used for scientific research should be open-source, so to allow complete repeatability of data analysis and models. And in fact, a lot of scientific software is indeed open-source, and a lot of this software can be used to model acoustic phenomena.

What follows below is a panoramic overview of the scientific open-source software ecosystem. This overview is far from comprehensive. Neither it reports software that pertains acoustic simulation only, even though a greater emphasis is given on this. However, it should represent a decent picture of how many tools are available for modelling complex physics, as well as creating all sorts of technical computing projects.

# Technical Computing Languages

There are many technical computing languages, or languages that can be useful for technical/scientific computing. The most commonly used are:

- GNU Octave. This is very useful also for having compatible syntax to that of Matlab, however it tends to be on the slower side (see the benchmarks released by the Julia developers).
- Python. Python is very nice to code with, and there are tons of scientific packages for it. Moreover, certain numerical software programs and frameworks allow Python scripting (ParaView, as an example, see below) or have Python interfaces. So, it is a language that it is worth having a grasp of.
- Julia Julia is a new exciting language that feels like what would happen if Octave and Python had a baby. One of its main features is that it can reach C-like speed while being a very high level language. Also worth to mention the plethora of packages already existing for the language, making it a very powerful platform already.
- Maxima is a very useful computer algebra system that can be used for symbolic computation. The GUI front-end wxMaxima is one of the most convenient ways to use it.
- Modelica is a language for multiphysics modelling. An entire open-source modelling environment, OpenModelica is based on it. Publications exist in which Modelica was used to model acoustics (such as this).

Note that this list is not exhaustive and many more examples are to be found, such as (but not limited to) R, Scilab, SageMath as well as a plethora of open-source scientific frameworks for other languages such as, for example, ROOT.

# Physical Modelling DSP

The FAUST programming language is a very powerful language to program real-time DSP algorithms. In its library there are numerous functions for physical modelling of music instruments. Moreover, it has an entire Physical Modelling Toolkit. Very good information on FAUST physical modelling is provided in this workshop.

Again, FAUST is not the only open-source domain specific language for DSP. There is also ARRP, for example. However, it does appear to be one of the most developed and widespread ones.

# Numerical Simulation and Analysis Packages

## Numerical Modelling and Solvers

These packages are suites for numerical modelling, using various methods.

- Elmer is a multiphysical FEM solver which is very powerful, although not very user friendly. It has very good solvers for various acoustic governing equations. Being a multiphysics solver, it allows coupling of different solvers.
- AcouSTO is an interesting BEM solver for acoustics.
- OpenPSTD is an acoustics simulation program that uses the Pseudo Spectral Time Domain Method. It integrates with Blender.
- I-Simpa is open-source software designed to simulate 3D acoustic propagation.
- EVERTims is an open-source framework for real-time auralization in architectural acoustics and virtual reality. It works with Blender, even in realtime, and it has a Python API.
- Mesh2HRTF is a very interesting package for the numerical simulation of Head Related Transfer Functions (HRTF). Whilst open-source itself, it depends on Matlab which is not open-source.
- Qucs is a nice, quite easy to use, circuit simulator. It can be used to simulate, of course, electronic circuits to use for audio applications, but it can also be used to build lumped acoustic models through electrical analogies (see here to read about electro-mechanical analogies).
- The DREAM Toolbox and Field II are two interesting open-source Matlab/Octave toolboxes for the simulation of ultrasonic transducers arrays, with focus on medical imaging applications (especially Field II).
- k-Wave is a Matlab open-source acoustics toolbox designed for time domain acoustic and ultrasound simulations in complex and tissue-realistic media. Whilst it is made for Matlab, it is reported to work with Octave as well. A list of open-source acoustic solvers, similar to the one in this page, is reported by k-Wave developers here.
- EOF-Library is an open-source coupling library for Elmer and OpenFOAM simulation packages. OpenFOAM is a Compudational Fluid Dinamics (CDF) solver. The EOF-Library acoustics capabilities are not fully clear, but it is possible this software might be useful to simulate the intercoupling between flow and sound generation.
- FOCUS is a free cross-platform ultrasound simulation tool that quickly and accurately calculates pressure fields generated by single transducers and phased arrays. Whilst this software appears very capable, like few other examples in this list it depends on Matlab, which is not itself open-source.
- FEniCS is a popular open-source computing platform for solving partial differential equations (PDEs). It has C++ and Python interfaces and it can be used to solve acoustics problems, for example see here.

Of course, there are actually many more solvers, such as Calculix, Code_Aster, GetFEM++, Freefem++, FEMM, MOOSE and ONELAB to cite a few. Those reported are the ones with the greatest capabilities for acoustics, or acoustic related phenomena modelling.

## Psychoacoustics Modelling and Analysis

There are good packages also in the domain of psychoacoustics:

- Auditory Modelling Toolbox is an open-source Matlab/Octave toolbox for auditory modelling.
- The Large Time-Frequency Analysis Toolbox is a Matlab/Octave toolbox that provides many useful transforms for signal analysis that can be very useful to understand acoustic signals.
- Psychtoolbox is another Matlab/Octave toolbox that can be used for realtime analysis of auditory stimuli.
- CMUSphinx is an open-source toolbox for speech recognition.
- MoSQITo is an open-source python package by EOMYS which provides a unified and modular development framework of key sound quality metrics with open-source object-oriented technologies.

# 3D Modelling and CAD

In order to solve a problem, normally one must first create its geometry first. There are really many programs out of there which can be used for this. The ones below are especially worth to mention due to many solvers providing interfaces and integration for them.

- FreeCAD is very good to prepare geometries for FEM solving. Certain solvers, such as Calculix and Elmer, have an interface for FreeCAD which integrates within its GUI.
- Blender is more for graphics, but certain solvers (such as AcouSTO) actually have plugins for Blender. Blender is another good example of software that allows internal Python scripting.

# Pre and Post Processing

In order to use any solver, our geometry needs to be prepossessed. Moreover, our results from the numerical solvers might need further postprocessing. There are many packages that provide these functionality. Below are reported the most widely used and flexible.

- gmsh is a lightweight and effective pre- and postprocessor.
- Salome Platform is a very feature rich pre- and postprocessor. Plugins exist that integrate solvers within it, such as the Elmer plugin. To be noted that there are many packages based on Salome, such as Salome-Meca, a modelling suite based on Salome Platform incorporating the Code_Aster solver.
- ParaView is a very good postprocessor. Note that it is included as a module in Salome, so it can be used within Salome.

# Conclusion

This list was not exhaustive, and for every section there is plenty of good software that was not reported. However, it should give a sense of how vast the ecosystem is. Packages such as Elmer, Salome and ParaView are very mature, while languages such as Python are the de-facto backbone of scientific research. This article should be able to give the reader a sense of perspective about the many useful scientific and technical tools.

# License Information

This work is licensed under a Creative Commons Attribution 4.0 International License.