Title: | Bioacoustic Basic Operations with Decibels and the Passive Sonar Equation |
---|---|
Description: | A beginners toolbox to help those in ecology who want to deepen their understanding or utilize Bioacoustics in their work. The package has a number of utilizations from calculating frequency from waveform, performing operations in dB, and determining acoustic range of recorders. The majority of this package is based on key concepts learned from the K. Lisa Yang Center for Conservation Bioacoustics at Cornell University and their associated course: Introduction to Bioacoustics course. More information can be found within the walk through vignettes at <https://github.com/MattyD797/bioSNR/tree/main/vignettes>. |
Authors: | Matthew Duggan [aut, cre] , Marissa Garcia [aut] |
Maintainer: | Matthew Duggan <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0 |
Built: | 2024-12-05 06:54:45 UTC |
Source: | CRAN |
This function is the standard method of calculating the absorption of sound in air (ISO 9613-1).
absorptionAir(f, p, t, h, pr = 101.325, tr = 293.15, to = 273.16)
absorptionAir(f, p, t, h, pr = 101.325, tr = 293.15, to = 273.16)
f |
The frequency of the sound source in Hz |
p |
The ambient atmospheric pressure in kPa |
t |
The ambient atmospheric temperature in C |
h |
The relative humidity as a percent |
pr |
The standard pressure at mean sea level |
tr |
The standard temperature in Celcius (293.15 in kelvin) |
to |
The triple-point isotherm temperature |
The sound attenuation rate in dB/m
#How much are Malayan tapir calls (15 kHz) absorbed in a tropical region #(30 deg C) assuming a humidity of 80% and standard pressure (101.325)? absorptionAir(15000, 101.325, 30, 80)
#How much are Malayan tapir calls (15 kHz) absorbed in a tropical region #(30 deg C) assuming a humidity of 80% and standard pressure (101.325)? absorptionAir(15000, 101.325, 30, 80)
This function is a simplified method of calculating the absorption of sound in water proposed in Ainslie and McColm, 1998 and based on Francois and Garrison, 1982.
absorptionWater(f, pH = 8, t = 0, s = 35, z)
absorptionWater(f, pH = 8, t = 0, s = 35, z)
f |
The frequency of the sound source in kHz. |
pH |
The average acidity or pH of the water. Default is 8. |
t |
The average temperature of the water in Celsius. Default is 0. |
s |
The average salinity of the water in parts per thousand (ppt). Default is 35 ppt. |
z |
The depth in km. |
The sound attenuation rate in dB/km
#How much are blue whale calls (30 kHz) absorbed in a tropical region #(30 deg C) assuming a salinity of 35 ppt, pH of 8, and a depth of 5 km? absorptionWater(30, 8, 30, 35, 5)
#How much are blue whale calls (30 kHz) absorbed in a tropical region #(30 deg C) assuming a salinity of 35 ppt, pH of 8, and a depth of 5 km? absorptionWater(30, 8, 30, 35, 5)
This function either adds, subtracts or averages dB values specified in function. This is for dB values in re to power, intensity or pressure.
opDB(dbs, PL, op = "add")
opDB(dbs, PL, op = "add")
dbs |
A vector of dB values of all the same reference. |
PL |
Should be 10 if dB measurements were for intensity or power and 20 if dB measurements were for pressure. |
op |
Default = 'add'. Can be 'add', 'sub', or 'avg' to add, subtract, or average, respectively. |
A sinlge dB value
#Given a set of intensity values, add them. opDB(c(100, 101, 127, 96), 10)
#Given a set of intensity values, add them. opDB(c(100, 101, 127, 96), 10)
This function finds the maximum detection range of a given call.
rmax(sl, nl, dt, d, a = 0, xaxis = 25)
rmax(sl, nl, dt, d, a = 0, xaxis = 25)
sl |
Source level of the signal of interest, as measured in dBs. |
nl |
Noise Level or background ambient noise in the recorder’s local environment. |
dt |
Detection Threshold or the additional dBs the signal of interest must achieve above ambient noise conditions in order to be detected by the receiver. |
d |
Depth |
a |
The absorption coefficeant given to you by the absorptionAir or absorptionWater formula. |
xaxis |
Exaggerated max distance. This gives the largest distance to evaluate in order to find the intercept of your detection threshold and propogation of the source level. |
The maximum detection range in meters
# SL= 195, NL = 82.9897, DT = 10, TR = 2500 rmax(sl=195,nl=82.9897,dt=10,d=2500*2, xaxis=10000000)
# SL= 195, NL = 82.9897, DT = 10, TR = 2500 rmax(sl=195,nl=82.9897,dt=10,d=2500*2, xaxis=10000000)
This function is a reformated version of Snell's law that finds reflection or refraction angle given the two mediums longitudinal wave velocities.
snell(ang, v1, v2)
snell(ang, v1, v2)
ang |
The known angle of relfection or refraction |
v1 |
The longitudinal wave velocity of medium where angle (refraction or reflection) is known given in m/s. |
v2 |
The longitudinal wave velocity of medium where angle (refraction or reflection) is unknown given in m/s. |
The opposing angle of reflection or refraction, respectfully
# Calculate the reflection angle given the angle of a black-tailed godwit sound #source is 64 degrees, the speed is 1564 m/s in the first medium and 1494 m/s #in the second medium. snell(64,1564,1494)
# Calculate the reflection angle given the angle of a black-tailed godwit sound #source is 64 degrees, the speed is 1564 m/s in the first medium and 1494 m/s #in the second medium. snell(64,1564,1494)
This function finds the average speed of sound in water or air (c) in m/s given information on temperature, salinity, and depth.
soundSpeed(t, med = "air", s = NULL, z = NULL)
soundSpeed(t, med = "air", s = NULL, z = NULL)
t |
The temperature in °C |
med |
The medium sound is traveling through |
s |
The salinity in parts per thousand (ppt) |
z |
The depth in m |
The speed of sound in m/s
#Speed of sound in 30°C water with a salinity of 2000 ppt and a depth of # 2010 m soundSpeed(30, "water", 2000, 2010)
#Speed of sound in 30°C water with a salinity of 2000 ppt and a depth of # 2010 m soundSpeed(30, "water", 2000, 2010)
This function calculates the ambient noise level (NL; dB re. 1 microPa) in a deep-water marine environement.
specLvlGraph(freqBand, shipT = -1, seaState = -1, wSpeed = 0, boolR = TRUE)
specLvlGraph(freqBand, shipT = -1, seaState = -1, wSpeed = 0, boolR = TRUE)
freqBand |
The frequency band of interest |
shipT |
The intensity ship traffic in the area * 1 - 2 low ship traffic * 3-4-5 standard ship traffic * 6 - 7 heavy ship traffic * 8 - 9 intense ship traffic |
seaState |
The sea state as specified by the National Weather Service |
wSpeed |
The wind speed in miles per hour (mph) |
boolR |
Boolean of whether you want the value printed out in a string. Should be true for HW problems. |
The noise level (NL) in dB re. 1 microPa
Matthew Duggan, K. Lisa Yang Center for Conservation Bioacoustics, Cornell University.
Wenz, G. M. (1962). Acoustic ambient noise in the ocean: Spectra and sources. The Journal of the Acoustical Society of America, 34(12), 1936-1956.
Urick, R. J. (1975). Principles of underwater sound v.2.
Zimmer, W. M. (2011). Passive acoustic monitoring of cetaceans. Cambridge University Press.
specLvlGraph(c(28,33), ship=4,seaState = 1, wSpeed = 10, boolR = TRUE)
specLvlGraph(c(28,33), ship=4,seaState = 1, wSpeed = 10, boolR = TRUE)
This function finds the length of a sound wave, known as the wavelength (m), or frequency of a sound (Hz), given the identity of the input. The speed of sound is the default in air (340 m/s). You may calculate your own value for c relative to the conditions present in your ecosystem of study via soundSpeed().
wof(b, c = 340)
wof(b, c = 340)
b |
The known wavelength (m) or frequency (Hz). |
c |
The speed of sound in m/s. 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. |
The unknown wavelength (m) or frequency (Hz) given the identity of input a.
# Given a frequency of 80 Hz in air, what is the wavelength? wof(80000) # Given a wavelength of 0.004 m in salt water, what is the frequency? wof(0.004, c=1500)
# Given a frequency of 80 Hz in air, what is the wavelength? wof(80000) # Given a wavelength of 0.004 m in salt water, what is the frequency? wof(0.004, c=1500)