The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The bioSNR package is an open-source solver of the passive SOund NAvigation and Ranging (SONAR) equation. The calculator is capable of handling simple-level acoustic problems associated with bioacoustics and passive acoustic monitoring (PAM) systems.
This document gives quick examples of bioSNR’s more basic capabilities and functions while introducing some of the basic physics behind sound.
#Stable - Install package from CRAN
install.packages("bioSNR")
#Unstable - Install package from Github repository
::install_github("MattyD797/bioSNR")
devtools
#Attach package namespace to active libraries in Rstudio
library(bioSNR)
A acoustic wave is a mechanical wave with longitudinal propagation. It means that under the influence of a wave (e.g., issued from a sound source) the particles of a medium (e.g. air, water) oscillate parallel to the direction of propagation of the wave, propagating the perturbation. This movement of particles results in repeated patterns of compression and dilatation around the value of ambient pressure, resulting in a travelling pressure wave (Klinck 2022). Along with the majority of organisms, our hearing is based on these pressure changes, but some species (mainly fish and squid) rely on the motion of the particles. Therefore, we typically only measure sounds through small pressure changes, in Pascals (Pa).
For simplicity we often describe acoustics variables in relation with the illustration of sinusoid, the simplest waveform, where this oscillation exist both in space (for simplicity along one dimension) and in time. The period is the time interval between the successive occurrence of the same state in this oscillation. The frequency, (or pitch) is the number oscillations produced in one second represented by the unit Hertz (Hz). In reference to human hearing range, sound with a frequency below 20 Hz is infrasound and sound above 20kHz is ultrasound. The wavelength is the distance between successive crests if a wave and is measured in meters (m).
The relationship between the length of a wavelength and the frequency can be represented as
\[\lambda = \frac{c}{f}\], where, * \(\lambda\) is the wavelength (m), * \(c\) is speed of sound in (m/s) and, * \(f\) frequency in Hz (cycles per second).
By using this equation, the wof() function allows you to calculate either \(\lambda\) or the \(f\). — whichever your value of interest is. The first entry defaults to either \(\lambda\) or \(f\) — whichever value you already have. In the second position, you must set the c argument equal to the constant of sound speed in water or air.
You may calculate your own value for c relative to the conditions present in your ecosystem of study. As a general rule of thumb, however, c is equal to 1500 m/s in saltwater and 350 m/s in air. Note that the distinction between freshwater and saltwater is important. Sound speed is faster in saltwater than freshwater.
#Find the wavelength (m) given a sound level of 75 kHz (75000 Hz) in SALTWATER
wof(40000, c=15000)
#> [1] 0.375
#Find the frequency (Hz) given a wavelength of 0.015 in AIR
wof(0.012, c=350)
#> [1] 29166.67
While a sound wave travels similarly no matter its medium, different media still have different physical properties that alter the wave’s speed. The speed of a wave is influenced dynamic ecosystem conditions. In air, the parameters that influence sound speed are temperature, humidity, and wind speed. In water, the parameters are temperature, depth, and salinity. Nonetheless, on average, sound travels ~340 \(\frac{m}{s}\) in air and ~1500 \(\frac{m}{s}\) in salt water.
The formula to find sound speed in the ocean (Wilson 1960) is
\[ c = 1449.2 + 4.6t – 0.055t^2 + 0.00029t^3 + (1.34-0.010t) * (s-35) + 0.0165z \] where, * \(c\) is sound speed in \(\frac{m}{s}\) * \(t\) is temperature in °C * \(s\) is salinity in parts per thousand (ppt) * \(z\) is depth in m
The formula to find sound speed in air is
\[ c = 331 + 0.6t \] where, * \(c\) is sound speed in \(\frac{m}{s}\) * \(t\) is temperature in °C
The first entry corresponds to temperature. The second entry, either denote “water” or “air” for sound speed default. The third entry corresponds to salinity, while the fourth entry corresponds to depth.
#Speed of sound in air at 23°C
soundSpeed(23)
#> [1] 344.8
#Speed of sound in air at 3°C
soundSpeed(3)
#> [1] 332.8
#Speed of fish sound in saltwater
soundSpeed(30, "water", 35, 10)
#> [1] 1545.695
As a sound wave travels through a medium, it will be dynamically reflected and refracted. Reflection is like a ball bouncing off the ground in which the energy of a sound is directed into another direction by an object. Sound enters water from air at the critical angle of 15° at the air-water boundary – or the place where the surface of water meets air. Refraction is when sound changes speed after crossing into a different medium, such as when a sound from air enters the water. Refraction can also occur when sound changes speed in a medium with varying conditions, such as when temperature shifts through the water column in the ocean. The angle and longitudinal wave velocity of this new direction from reflection can be calculated utilizing Snell’s law, where reflection angle is represented as \(\Theta_1\) and refraction angle is represented as \(\Theta_2\):
\[ \frac{\sin\Theta_1}{{V_L}_1} = \frac{\sin\Theta_2}{{V_L}_2} \] where, * \(c_1\) and \(c_2\) are the sounds speeds in medium 1 and 2 given in \(\frac{m}{s}\) * \(theta_1\) and \(theta_2\) are the angles of incidence and refraction in °
snell(64,1564,1494)
#> [1] 61.13555
snell(15.5,1493,1502)
#> [1] 15.59344
Sound absorption is the energy dissipation through a medium or the total transmission loss of sound from a source to a receiver. The transmission loss is impacted by the same factors impacting the speed of sound in each medium.
Regarding absorption in air, the factors to take into consideration are the frequency of the sound source, ambient temperature, pressure, and relative humidity (if curious about how each of these paramters independently affects sound pressure, explore this interactive plot developed by Daniel Russel at Pennsylvania State University)Figure.
In water, absorption is impacted by the frequency of the sound source, ambient temperature, depth, salinity and pH. Absorption is only one factor of transmission loss and more details on transmission loss are provided later, but for more information on the calculation please refer to ISO 9613 Part 1 for sound absorption in air (Acoustics 1996) and Ainslie and McColm 1998 for sound absorption in water (Ainslie and McColm 1998). The equation pre-programmed within this package estimates absorption on average in a marine environment and thus would not be precise in estimating absorption freshwater environments. Note: There are several equations to estimate absorption in water for different ranges of predictors not functional in this package.
Impedance is the measure of resistance of a medium to wave propagation, or in other words, the willingness of a sound wave to move through a medium (Acoustic Impedance 2009). The factors that affect impedance are the medium’s properties and the type of wave propagation. Water is 800 times more dense than air. Coupled with a faster speed of sound, water has an acoustic impedance approximately 3,500 times higher than that of air (for further reading, see this explained from the University of South Wales). When perceiving the effect of impedance on a sound, the modality often considered is perception. The outcome of impedance is usually an altered intensity of how the signal of interest is perceived, which will be described in greater depth with sound intensity.
The unit of specific acoustic impedance is the Rayl (Ry), which is equal to 1 \(kg/(m^2s)\) or 1 \(Ns/m^3\). For air, z= 428 Ry at 20°C and z = 413 Ry at 0°C. For water, z = 14.8 MRy. We can map the relationship of impedance to the speed of the sound and density of the medium:
\[ z = c * \rho \]
Sound pressure is the average local pressure deviation from the surrounding pressure of the medium. In the case of bioacoustics, sound pressure is how the pressure of the vocalization of interest alters the average sound pressure of the surrounding ecosystem. We can measure the sound pressure (pressure root mean square) from either simulated sine wave representations of sound waves \(Prms = P_{zero2peak}/\sqrt{2}\) or, more typically, by averaging the absolute pressure measurements \(Prms = \sqrt{(P^2)_{average}}\). Below is a simulated sine wave representation to give you an understanding of \(P_{zero2peak}\)(blue) and \(P_{peak2peak}\)(red)(“Introduction to Signal Levels” 2019):
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
Finally, the sound intensity can be measured by the relationship between pressure and the impedance. Therefore, the definition of intensity of sound is the average amount of energy transmitted per unit time through a unit area in a specified direction. The acoustic impedance of water is 3,500 times higher than in air, meaning a specific sound produced in air would be 3,500 times less intense if instead produced in water. Further, if two different sounds in water and air were estimated to have the same intensity, the sound prouced in air would have much smaller pressure, since speed of sound is held relatively constant for each environment (“Acoustic Impedance, Intensity and Power,” n.d.; “Sound Intensity,” n.d.). The relationship between impedance and pressure can be represented as the following:
\[ Sound \;intensity = sound \;pressure * particle \;velocity\] \[ I = \frac{P_{rms}^2}{z}\] * \(I\) is the intensity of sound in \(\frac{W}{m^2}\)
absorptionWater(48,7.75,18,34,2)
#> [1] 9.433558
absorptionAir(10000,101.325,20,99)
#> [1] 0.0885461
#Assume standard impedance in water
<- 14.8
z
#pressure values for example
<- c(20, 24, 18, 34, 51, 29, 29, 15)
press
#pressure root mean square of pressure values
<- sqrt(mean(press^2))
prms
#Formula for impedance
^2/z
prms#> [1] 58.81757
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.