Title: | Bioacoustic Basic Operations with Decibels and the Passive Sonar Equation |
Version: | 1.0 |
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. |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Imports: | dplyr, ggplot2, pracma, scales, stats |
Suggests: | rmarkdown, knitr |
VignetteBuilder: | knitr |
License: | GPL (≥ 3) |
Maintainer: | Matthew Duggan <mtd72@cornell.edu> |
NeedsCompilation: | no |
Packaged: | 2023-05-25 20:07:45 UTC; mattyd797 |
Author: | Matthew Duggan |
Repository: | CRAN |
Date/Publication: | 2023-05-26 08:20:05 UTC |
absorptionAir
Description
This function is the standard method of calculating the absorption of sound in air (ISO 9613-1).
Usage
absorptionAir(f, p, t, h, pr = 101.325, tr = 293.15, to = 273.16)
Arguments
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 |
Value
The sound attenuation rate in dB/m
Examples
#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)
absorptionWater
Description
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.
Usage
absorptionWater(f, pH = 8, t = 0, s = 35, z)
Arguments
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. |
Value
The sound attenuation rate in dB/km
Examples
#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)
opDB
Description
This function either adds, subtracts or averages dB values specified in function. This is for dB values in re to power, intensity or pressure.
Usage
opDB(dbs, PL, op = "add")
Arguments
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. |
Value
A sinlge dB value
Examples
#Given a set of intensity values, add them.
opDB(c(100, 101, 127, 96), 10)
Maximum Detection Range
Description
This function finds the maximum detection range of a given call.
Usage
rmax(sl, nl, dt, d, a = 0, xaxis = 25)
Arguments
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. |
Value
The maximum detection range in meters
Examples
# SL= 195, NL = 82.9897, DT = 10, TR = 2500
rmax(sl=195,nl=82.9897,dt=10,d=2500*2, xaxis=10000000)
Snell's Law
Description
This function is a reformated version of Snell's law that finds reflection or refraction angle given the two mediums longitudinal wave velocities.
Usage
snell(ang, v1, v2)
Arguments
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. |
Value
The opposing angle of reflection or refraction, respectfully
Examples
# 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)
Sound Speed
Description
This function finds the average speed of sound in water or air (c) in m/s given information on temperature, salinity, and depth.
Usage
soundSpeed(t, med = "air", s = NULL, z = NULL)
Arguments
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 |
Value
The speed of sound in m/s
Examples
#Speed of sound in 30°C water with a salinity of 2000 ppt and a depth of
# 2010 m
soundSpeed(30, "water", 2000, 2010)
Spectrum Level Graph and Marine Noise Level
Description
This function calculates the ambient noise level (NL; dB re. 1 microPa) in a deep-water marine environement.
Usage
specLvlGraph(freqBand, shipT = -1, seaState = -1, wSpeed = 0, boolR = TRUE)
Arguments
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. |
Value
The noise level (NL) in dB re. 1 microPa
Author(s)
Matthew Duggan, K. Lisa Yang Center for Conservation Bioacoustics, Cornell University.
References
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.
Examples
specLvlGraph(c(28,33), ship=4,seaState = 1, wSpeed = 10, boolR = TRUE)
wavelength and frequency
Description
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().
Usage
wof(b, c = 340)
Arguments
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. |
Value
The unknown wavelength (m) or frequency (Hz) given the identity of input a.
Examples
# 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)