Title: | Bioacoustic Analysis and Publication Tools |
---|---|
Description: | Provides tools for manipulating sound files for bioacoustic analysis, and preparing analyses these for publication. The package validates that values are physically possible wherever feasible. |
Authors: | Ed Baker [aut, cre] |
Maintainer: | Ed Baker <[email protected]> |
License: | GPL-3 |
Version: | 0.0.8.9000 |
Built: | 2025-02-17 06:18:44 UTC |
Source: | https://github.com/edwbaker/sonicscrewdriver |
PseudoWave scalar subtraction
## S4 method for signature 'PseudoWave,numeric' e1 - e2
## S4 method for signature 'PseudoWave,numeric' e1 - e2
e1 |
Input 1 |
e2 |
Input 2 |
Check if two annotations overlap or are continuous
.annotation_check_overlap(annotation1, annotation2, domain = "time")
.annotation_check_overlap(annotation1, annotation2, domain = "time")
annotation1 |
An Annotation object. |
annotation2 |
An Annotation object. |
domain |
Domain of the annotations, either "time", "frequency", or "both". |
TRUE if the annotations overlap, FALSE otherwise.
Checks a list of annotations for those that are overlapping in the time or frequency domain, and returns a list where overlapping annotations are merged.
.merge_annotations(annotations, domain = "time")
.merge_annotations(annotations, domain = "time")
annotations |
A list of Annotation objects. |
domain |
Domain of the annotations, either "time" or "frequency". |
The exported function merge_annotations()
handles sanity checks and calls this function.
A list of Annotation objects.
Helper function to convert a Wave-like object to scikit-maad spectrogram
.spectrogram_maad_power(object)
.spectrogram_maad_power(object)
object |
A Wave or WaveMC object (or Tagged equivalent), or a spectrogram_maad object |
A spectrogram_maad object
Helper function to convert a Wave-like object to scikit-maad spectrum
.spectrum_maad(object)
.spectrum_maad(object)
object |
A Wave or WaveMC object (or Tagged equivalent), or a spectrum |
A spectrum list
Allow subsetting a Wave object with a TimeRegion
## S4 method for signature 'Wave,TimeRegion' x[i]
## S4 method for signature 'Wave,TimeRegion' x[i]
x |
Wave Object |
i |
TimeRegion object |
Numeric multiplication by PseudoWave
## S4 method for signature 'numeric,PseudoWave' e1 * e2
## S4 method for signature 'numeric,PseudoWave' e1 * e2
e1 |
Input 1 |
e2 |
Input 2 |
PseudoWave scalar manipulation
## S4 method for signature 'PseudoWave,numeric' e1 * e2
## S4 method for signature 'PseudoWave,numeric' e1 * e2
e1 |
Input 1 |
e2 |
Input 2 |
PseudoWave scalar division
## S4 method for signature 'PseudoWave,numeric' e1 / e2
## S4 method for signature 'PseudoWave,numeric' e1 / e2
e1 |
Input 1 |
e2 |
Input 2 |
Numeric addition by PseudoWave
## S4 method for signature 'numeric,PseudoWave' e1 + e2
## S4 method for signature 'numeric,PseudoWave' e1 + e2
e1 |
Input 1 |
e2 |
Input 2 |
PseudoWave scalar addition
## S4 method for signature 'PseudoWave,numeric' e1 + e2
## S4 method for signature 'PseudoWave,numeric' e1 + e2
e1 |
Input 1 |
e2 |
Input 2 |
This function takes a traits dataset retrieved from audioblast and converts values such as "day" into a numeric time of day based on the date and location.
ab_diel_traits(traits, date, lat, lon, overwrite = FALSE)
ab_diel_traits(traits, date, lat, lon, overwrite = FALSE)
traits |
Traits dataset retrieved using audioblast(). |
date |
The date used for conversion for time. |
lat |
Latitude of location. |
lon |
Longitude of location. |
overwrite |
If TRUE then the function will overwrite any existing min/max. |
This function takes a TaggedWave
or TaggedWaveMC
object and adds a process
to the processing
slot. This is used to keep a record of the processes that
have been applied to the object.
addProcess(object, process, output = NULL, duration = NULL) ## S4 method for signature 'TaggedWave' addProcess(object, process, output = NULL, duration = NULL) ## S4 method for signature 'TaggedWaveMC' addProcess(object, process, output = NULL, duration = NULL)
addProcess(object, process, output = NULL, duration = NULL) ## S4 method for signature 'TaggedWave' addProcess(object, process, output = NULL, duration = NULL) ## S4 method for signature 'TaggedWaveMC' addProcess(object, process, output = NULL, duration = NULL)
object |
An object. |
process |
A description of the process. |
output |
The output of the process. |
duration |
The duration of the process in seconds. |
The object with the process added.
This function takes two spectra from seewave (or equivalent) and adds their values. The spectra must have the same bins.
addSpectra(s1, s2, coerceNegative = TRUE)
addSpectra(s1, s2, coerceNegative = TRUE)
s1 |
First spectrum |
s2 |
Second spectrum |
coerceNegative |
Sets any values below zero to zero in output. |
A spectrum of s1+s2
## Not run: subtractSpectra(spec1, spec2) ## End(Not run)
## Not run: subtractSpectra(spec1, spec2) ## End(Not run)
Some functions (e.g. ffilter from seewave) only operate on a single channel at a time. This function applies the function to each channel and returns a list of analyses.
allChannels( w, FUN, cl = NULL, channel.param = "channel", output.FUN = NULL, ... )
allChannels( w, FUN, cl = NULL, channel.param = "channel", output.FUN = NULL, ... )
w |
A Wave or WaveMC object |
FUN |
Function to apply to the wave. |
cl |
Optionally a cluster for parallel calculation. |
channel.param |
Name of the channel parameter to FUN. Can be NULL. |
output.FUN |
Optional. Function that processes the output of FUN. The "channels_se" function provides standard functionality for the soundecology package. |
... |
Optional. Additional parameters to pass to FUN. |
A list of outputs.
Create a new Annotation object
annotation( file = "", metadata = list(), start = 0, end = Inf, low = 0, high = Inf, source = "", type = "", value = "" )
annotation( file = "", metadata = list(), start = 0, end = Inf, low = 0, high = Inf, source = "", type = "", value = "" )
file |
File being annotated. |
metadata |
A list of metadata. |
start |
Start time of annotation (seconds). |
end |
End time of annotation (seconds). |
low |
Low frequency of annotation (Hz). |
high |
High frequency of annotation (Hz). |
source |
Source of annotation. |
type |
Type of annotation. |
value |
Value of annotation. |
An Annotation object.
The Annotation
class is used to store annotations on Wave
-like objects.
file
File being annotated.
metadata
A list for storing metadata.
start
Start time of annotation.
end
End time of annotation.
low
Low frequency of annotation.
high
High frequency of annotation.
source
Source of annotation.
type
Type of annotation.
value
Value of annotation.
Converts a list of Annotation objects to a data.frame, with one column for each metadata name in the list.
AnnotationList2DataFrame(x)
AnnotationList2DataFrame(x)
x |
A list of Annotation objects. |
A data.frame.
Calculates the raw size of audio date at set sample rate, bit depth and duration.
audio_filesize( samp.rate = 44100, bit.depth = 16, channels = 1, duration = 1, duration.unit = "seconds", output.unit = "bits" )
audio_filesize( samp.rate = 44100, bit.depth = 16, channels = 1, duration = 1, duration.unit = "seconds", output.unit = "bits" )
samp.rate |
Sample rate |
bit.depth |
Bit depth |
channels |
The number of audio channels |
duration |
Duration of recording |
duration.unit |
One of seconds, minutes, hours, days |
output.unit |
"human", "bits" or "bytes" |
By default humanBytes()
is used to convert the output to human readable format,
however this can be changed by setting output.unit
to "bits" or "bytes".
The size of the audio file in the specified unit
# One minute of mono 16-bit audio sampled at 44.1kHz audio_filesize(samp.rate=44100, bit.depth=16, channels=1, duration=1, duration.unit="minutes") # One year of stereo 24-bit audio sampled at 96kHz audio_filesize(samp.rate=96000, bit.depth=24, channels=2, duration=1, duration.unit="years")
# One minute of mono 16-bit audio sampled at 44.1kHz audio_filesize(samp.rate=44100, bit.depth=16, channels=1, duration=1, duration.unit="minutes") # One year of stereo 24-bit audio sampled at 96kHz audio_filesize(samp.rate=96000, bit.depth=24, channels=2, duration=1, duration.unit="years")
Search for data or analyses on audioBlast.
audioblast( type, name, endpoint = NULL, check = TRUE, max_pages = NULL, page = 1, quiet = FALSE, on.issue = stop, output = "data.frame", ... )
audioblast( type, name, endpoint = NULL, check = TRUE, max_pages = NULL, page = 1, quiet = FALSE, on.issue = stop, output = "data.frame", ... )
type |
One of data, analysis, standalone. |
name |
Name of data or analysis source. |
endpoint |
Optionally specify endpoint of an audioBlast module. |
check |
Logical. Performs sanity check on input before sending to audioBLAST. |
max_pages |
Maximum number of data pages to return, by default this is set to NULL and returns all pages. |
page |
First page of results to request, defaults to 1. |
quiet |
If true will not print progress. Silence is a virtue. |
on.issue |
Function to call on error or warning. By default |
output |
By default a |
... |
Fields and values to filter on. Any field defined by audioBLAST. |
A data frame
## Not run: audioblast("data", "recordings", taxon="Gryllotalpa vineae") ## End(Not run)
## Not run: audioblast("data", "recordings", taxon="Gryllotalpa vineae") ## End(Not run)
Downloads audio files associated with a search using the audioBlast() function.
audioblastDownload( d, metadata = TRUE, skip.existing = TRUE, dir = ".", quiet = FALSE, on.issue = .audioblastIssue )
audioblastDownload( d, metadata = TRUE, skip.existing = TRUE, dir = ".", quiet = FALSE, on.issue = .audioblastIssue )
d |
Data returned from a search using audioBlast(). |
metadata |
If true saves the data in d as a csv file. |
skip.existing |
If true will not overwrite existing files. |
dir |
Directory to save files to. |
quiet |
If true will not print progress. |
on.issue |
Function to call on error or warning. By default |
Reads and parses an AudioMoth configuration file.
audiomothConfig(filename)
audiomothConfig(filename)
filename |
Path to the configuration file to read |
A data frame of matching annotations
## Not run: audiomothConfig("./CONFIG.TXT") ## End(Not run)
## Not run: audiomothConfig("./CONFIG.TXT") ## End(Not run)
Reads and parses metadata stored in wave files produced by AudioMoth devices.
audiomothWave(filename)
audiomothWave(filename)
filename |
Path to the wave file to read |
A list of extracted parameters
## Not run: audiomothWave("./FILENAME.WAV") ## End(Not run)
## Not run: audiomothWave("./FILENAME.WAV") ## End(Not run)
Creates an automatic bandpass filter based on the strongest frequency. The allowed bandwidth can be an integer multiple of the bandwidth at either -3dB or -10dB.
autoBandPass(wave, bw = "-3dB", n.bw = 1, lowcut = 1000)
autoBandPass(wave, bw = "-3dB", n.bw = 1, lowcut = 1000)
wave |
A Wave object |
bw |
Either -3dB or -10dB. This is calculated by |
n.bw |
The number of bandwidths either side of the centre of the centre to keep |
lowcut |
High-pass filtering is applied at this frequency before calculating the centre frequency and bandwidth |
A band-pass filtered Wave object
## Not run: autoBandPass(sheep) autoBandPass(sheep, bw="-3dB", n.bw=1, lowcut=1000) autoBandPass(sheep, bw="-10dB", n.bw=2, lowcut=0) ## End(Not run)
## Not run: autoBandPass(sheep) autoBandPass(sheep, bw="-3dB", n.bw=1, lowcut=1000) autoBandPass(sheep, bw="-10dB", n.bw=2, lowcut=0) ## End(Not run)
Creates a band pass WaveFilter between values specified to a Wave object.
bandpass(from, to, ...)
bandpass(from, to, ...)
from |
Bottom of bandpass frequency (Hz). |
to |
Top of bandpass frequency (Hz). |
... |
Further arguments to pass to ffilter. |
This is a simple wrapper function to the seewave ffilter function allowing its use with filterw and pipes.
A WaveFilter object.
## Not run: nwave <- noise("white", duration=44100, samp.rate=44100) fwave <- filterWave(nwave, bandpass(from=1000, to=2000)) nwave |> filterWave(bandpass(from=1000, to=2000)) -> fwave ## End(Not run)
## Not run: nwave <- noise("white", duration=44100, samp.rate=44100) fwave <- filterWave(nwave, bandpass(from=1000, to=2000)) nwave |> filterWave(bandpass(from=1000, to=2000)) -> fwave ## End(Not run)
This function computes a beatSpectrum
and calculates some basic
measurements of its complexity. The complexity value is calculated as the
maximum identified repeating period (in seconds) divided by the number of
peaks.
beatComplexity(wave, plot = FALSE)
beatComplexity(wave, plot = FALSE)
wave |
A Wave object |
plot |
If TRUE a spectrogram overlaid with the peaks is plotted. |
A list of the complexity, a vector of the peak periods, and the number of peaks.
## Not run: beatComplexity(sheep) beatComplexity(sheep, plot=TRUE) ## End(Not run)
## Not run: beatComplexity(sheep) beatComplexity(sheep, plot=TRUE) ## End(Not run)
Beat spectra represent the periodicity in signal amplitude. It is computed by performing a continuous wavelet transform on the envelope of a preprocessed signal, and processing the average power per frequency band.
beatSpectrum(wave, min_period = 0.005, max_period = 30, dj = 1/32, ...)
beatSpectrum(wave, min_period = 0.005, max_period = 30, dj = 1/32, ...)
wave |
an R object or path to a wave file |
min_period |
the minimal rythmicity period expected, in seconds |
max_period |
the maximal rythmicity period expected, in seconds |
dj |
the frequency resolution of the cwt (in voices per octave) |
... |
extra arguments passed to |
a spectrum as a data frame.
It contains two columns: power
and period
.
The number of rows depend on the resolution and frequency range.
Quentin Geissmann
## Not run: beatSpectrum(sheep) beatSpectrum(sheep, min_period=0.005, max_period=30, dj=1/32) ## End(Not run)
## Not run: beatSpectrum(sheep) beatSpectrum(sheep, min_period=0.005, max_period=30, dj=1/32) ## End(Not run)
This function takes a list of sound files and analyses them using the
BirdNET-Analyzer
(Kahl et al. 2021). The function
either returns a data frame with the results of the analysis or a list of
Annotation
objects.
birdNetAnalyse( files, lat = NULL, lon = NULL, date = NULL, output = "Annotation" )
birdNetAnalyse( files, lat = NULL, lon = NULL, date = NULL, output = "Annotation" )
files |
A character vector of file paths. |
lat |
A latitude or vector of latitudes. |
lon |
A longitude or vector of longitudes. |
date |
A |
output |
One of "data.frame" or "Annotation". |
Kahl S, Wood CM, Eibl M, Klinck H (2021). “BirdNET: A deep learning solution for avian diversity monitoring.” Ecological Informatics, 61.
## Not run: birdnetAnalyse(files=c("path/to/file1.wav", "path/to/file2.wav"), output="data.frame") ## End(Not run)
## Not run: birdnetAnalyse(files=c("path/to/file1.wav", "path/to/file2.wav"), output="data.frame") ## End(Not run)
Used to process the output of acoustic index functions from the soundecology package when using allChannels.
channels_se(...)
channels_se(...)
... |
Export from a bioacoustic index function from the soundecology package |
When plotting rings or horizons that are meant to cover the entirety of the time period in a dielPlot() or yearlyPlot() this function append the beginning values to the end to ensure an entire loop is created.
circularise(values)
circularise(values)
values |
A vector if values |
The concat()
method is a more flexible version of the bind()
method
from tuneR
package, that allows specifying more advanced types of
concatenation. Setting method
to "noClick" will remove any click between
Wave objects caused by sudden jumps in amplitude by applying tuneR::prepComb()
appropriately with default value of zero (this is only effective for the left
channel or stereo or multi-channel recordings).
concat(object, ..., method = "bind") ## S4 method for signature 'Wave' concat(object, ..., method = "bind") ## S4 method for signature 'WaveMC' concat(object, ..., method = "bind") ## S4 method for signature 'TaggedWave' concat(object, ..., method = "bind") ## S4 method for signature 'TaggedWaveMC' concat(object, ..., method = "bind")
concat(object, ..., method = "bind") ## S4 method for signature 'Wave' concat(object, ..., method = "bind") ## S4 method for signature 'WaveMC' concat(object, ..., method = "bind") ## S4 method for signature 'TaggedWave' concat(object, ..., method = "bind") ## S4 method for signature 'TaggedWaveMC' concat(object, ..., method = "bind")
object |
A Wave like object. |
... |
Wave like objects to concatenate to object. |
method |
One of "bind", "noClick". Default is "bind". |
A concatenated Wave like object, with type of object
.
Converts time measurements into seconds
convert2bytes(S, input = "bits")
convert2bytes(S, input = "bits")
S |
The value to convert |
input |
The unit to convert, allowed values are "bits", "kB", "MB", "GB" |
The numeric value in seconds
Converts temperature measurements into Celsius
convert2Celsius(temp, input = "K")
convert2Celsius(temp, input = "K")
temp |
The value of the temperature to convert |
input |
The unit of the temperature to convert, allowed values are "K", "F". |
Numeric value in degrees Celsius
convert2Celsius(15, input="K") convert2Celsius(15, input="F")
convert2Celsius(15, input="K") convert2Celsius(15, input="F")
Converts angle measurements into degrees
convert2degrees(A, input = "radians")
convert2degrees(A, input = "radians")
A |
The angle value to convert |
input |
The unit of angle to convert, allowed values are "radians". |
The numeric value in degrees
Converts pressure measurements into dyne per square centimetre
convert2dyne_cm2(P, input = "kPa")
convert2dyne_cm2(P, input = "kPa")
P |
The value of the pressure to convert |
input |
The unit of the pressure to convert, allowed values are "kPa", "P". |
convert2dyne_cm2(1, input="Pa") convert2dyne_cm2(1, input="kPa")
convert2dyne_cm2(1, input="Pa") convert2dyne_cm2(1, input="kPa")
Converts temperature measurements into Fahrenheit
convert2Fahrenheit(temp, input)
convert2Fahrenheit(temp, input)
temp |
The value of the temperature to convert |
input |
The unit of the temperature to convert, allowed values are "K", "C". |
## Not run: convert2Fahrenheit(15, input = "C") ## End(Not run)
## Not run: convert2Fahrenheit(15, input = "C") ## End(Not run)
Converts temperature measurements into Kelvin
convert2Kelvin(temp, input = "C")
convert2Kelvin(temp, input = "C")
temp |
The value of the temperature to convert |
input |
The unit of the temperature to convert, allowed values are "C", "F". |
Numeric value in Kelvin
convert2Kelvin(15, input="C") convert2Kelvin(15, input="F")
convert2Kelvin(15, input="C") convert2Kelvin(15, input="F")
Converts pressure measurements into Pascals
convert2Pascals(P, input = "kPa")
convert2Pascals(P, input = "kPa")
P |
The value of the pressure to convert |
input |
The unit of the pressure to convert, allowed values are "kPa", "dyne_cm2". |
The numeric value in Pascals
convert2Pascals(1000, input="kPa") convert2Pascals(10, input="dyne_cm2")
convert2Pascals(1000, input="kPa") convert2Pascals(10, input="dyne_cm2")
Converts angle measurements into radians
convert2radians(A, input = "degrees")
convert2radians(A, input = "degrees")
A |
The angle value to convert |
input |
The unit of angle to convert, allowed values are "degrees". |
The numeric value in radians
Converts time measurements into seconds
convert2seconds(T, input = "minutes", origin = "day")
convert2seconds(T, input = "minutes", origin = "day")
T |
The time value to convert |
input |
The unit of time to convert, allowed values are "minutes", "hours", "days", "years", "HHMM". |
origin |
For POSIX whether to return relative to start of day ("day") or Unix epoch ("unix") |
The numeric value in seconds
Uses the corenv function from seewave to calculate the envelope correlation for timed events between the channels of a WaveMC object
corWaveMC(wave, times, window, temp = 25, cluster = NULL)
corWaveMC(wave, times, window, temp = 25, cluster = NULL)
wave |
A WaveMC object |
times |
One or more times of events to correlate |
window |
Width of the window to correlate in seconds (centred on times) |
temp |
Air temperature in Celsius |
cluster |
A cluster for parallel execution |
List of corenv lists for events, and a list of the time differences between channels
Extract a section of a Wave object based on sample positions. This function will automatically detect if a Wave object is stereo.
cutws(wave, from = 1, to = Inf, plot = FALSE)
cutws(wave, from = 1, to = Inf, plot = FALSE)
wave |
A Wave object |
from |
First sample to return |
to |
Last sample to return |
plot |
If TRUE shows the cut region within the original waveform |
A Wave object
## Not run: cutws(sheep, 1, 20) cutws(sheep, 1, 20, plot=TRUE) ## End(Not run)
## Not run: cutws(sheep, 1, 20) cutws(sheep, 1, 20, plot=TRUE) ## End(Not run)
Make a sequence of data into a normalised Wave object.
data2Wave( left, samp.rate = 44100, bit = 16, unit = NULL, remove.offset = TRUE, normalise = TRUE )
data2Wave( left, samp.rate = 44100, bit = 16, unit = NULL, remove.offset = TRUE, normalise = TRUE )
left |
Data for mono audio channel |
samp.rate |
Sampling rate for Wave object |
bit |
Bit depth of Wave object |
unit |
See tuneR::normalize. If NULL this is handled automatically. |
remove.offset |
If TRUE any DC offset is removed |
normalise |
IF TRUE the output Wave is normalised to -1:1 |
A mono Wave object.
pattern <- seq(from=-1, to=1, length.out=100) data <- rep.int(pattern, 100) w <- data2Wave(data)
pattern <- seq(from=-1, to=1, length.out=100) data <- rep.int(pattern, 100) w <- data2Wave(data)
Given a start time and (optionally) a duration returns the phase of day at a given location. This is primarily used to calculate phase of day information for soundscape recording projects.
dayPhase( time = Sys.time(), duration = 40000, lat = 50.1, lon = 1.83, tz = "UTC" )
dayPhase( time = Sys.time(), duration = 40000, lat = 50.1, lon = 1.83, tz = "UTC" )
time |
A time object representing the start time of a recording |
duration |
Duration of recording |
lat |
Latitude of recording device |
lon |
Longitude of recording device |
tz |
Time-zone of recording device when recording was made |
Data frame of day phases with absolute timestamps and relative times within file
Wrapper for suncalc::getSunlightTimes that formats output for this package.
dayPhases(time = as.Date(Sys.time()), lat = 50.1, lon = 1.83, tz = "UTC")
dayPhases(time = as.Date(Sys.time()), lat = 50.1, lon = 1.83, tz = "UTC")
time |
A time object representing the start time of a recording |
lat |
Latitude of recording device |
lon |
Longitude of recording device |
tz |
Time-zone of recording device when recording was made |
Phases of days
daysPhases( date = Sys.Date(), period = "year", plot = FALSE, lat = 50.1, lon = 1.83, tz = "UTC" )
daysPhases( date = Sys.Date(), period = "year", plot = FALSE, lat = 50.1, lon = 1.83, tz = "UTC" )
date |
A time object representing the start time of a recording |
period |
"month" or "year" |
plot |
If true plots the data, default FALSE |
lat |
Latitude of recording device |
lon |
Longitude of recording device |
tz |
Time-zone of recording device when recording was made |
Creates a default cluster using one less than the total cores available on the system. By default this uses forking, which is not be available on Windows. Hence, the fork parameter has no effect on Windows.
defaultCluster(fork = TRUE)
defaultCluster(fork = TRUE)
fork |
If TRUE uses forking to create the cluster (Unix like systems only) |
A cluster object for parallel processing
## Not run: cl <- defaultCluster() stopCluster(cl) cl <- defaultCluster(FALSE) stopCluster(cl) ## End(Not run)
## Not run: cl <- defaultCluster() stopCluster(cl) cl <- defaultCluster(FALSE) stopCluster(cl) ## End(Not run)
Given an object that can be coerced to POSIXlt or is in a supported string format, return the fraction of a day represented by the object.
dielFraction(t, input = "POSIX", unit = "radians")
dielFraction(t, input = "POSIX", unit = "radians")
t |
Object to be converted to a fraction |
input |
One of POSIX (default) or HHMM |
unit |
If set to radians outputs a position around a circle. If set to fraction outputs the raw fraction. |
Draws a histogram on a dielPlot() using pre-defined bins related to time of day.
dielHistogram( times, by = "hour", col = "grey", maxval = NA, presence.only = FALSE, limits = c(1, 2) )
dielHistogram( times, by = "hour", col = "grey", maxval = NA, presence.only = FALSE, limits = c(1, 2) )
times |
A vector of times that can be pocessed by dielFraction(). |
by |
Controls the size of histogram bins, one of "hour", "15minute", "30minute". |
col |
Colour of the plot. |
maxval |
By default scales histogram within limits, specifying a maximum value here allows comparison between plots. |
presence.only |
Only show presence/absence not values. |
limits |
Limits of the plotting (see dielPlot()). |
A data frame of start and end points of bins.
Generates labels for a dielPlot() in 12- or 24-hour format. Labels are generated at three hourly intervals.
dielLabels(format = "clock24")
dielLabels(format = "clock24")
format |
One of clock24 (default) or clock12 |
dielLabels() dielLabels("clock12")
dielLabels() dielLabels("clock12")
A diel plot shows the times of night, twilight and the maximum altitude of the sun for a given date.
dielPlot( date, lat, lon, limits = c(0, 2), plot = NULL, rot = tzRot(0), method = "plotrix", legend = F )
dielPlot( date, lat, lon, limits = c(0, 2), plot = NULL, rot = tzRot(0), method = "plotrix", legend = F )
date |
Date to plot. |
lat |
Numeric latitude. |
lon |
Numeric longitude. |
limits |
Plotting limits of the daylight regions, default to c(1,2) |
plot |
Character vector of components to plot |
rot |
Either "Solar Noon" or an offset calculated by tz |
method |
Plotting library to use |
legend |
Whether to show a legend |
Generates positions for three-hourly labels of a dielPlot() in radians.
dielPositions(format = "3hourly")
dielPositions(format = "3hourly")
format |
One of "3hours" (default), "hours", or "minutes" |
dielPositions() dielPositions("hours") dielPositions("minutes")
dielPositions() dielPositions("hours") dielPositions("minutes")
Plot rings on a diel plot.
dielRings( names, starts, ends, cols = "grey", format = "HHMM", limits = c(1, 2), legend = T )
dielRings( names, starts, ends, cols = "grey", format = "HHMM", limits = c(1, 2), legend = T )
names |
Labels for the rings |
starts |
Start times for rings in HHMM string format |
ends |
End times for rings in HHMM string format |
cols |
Colours of the rings |
format |
Defaults to HHMM |
limits |
Region of a dielPlot() to plot rings. Defaults to c(1,2) |
legend |
Boolean. Whether to plot a legend. |
Dolbear (1897) was the first to publish a formula for how the rate of chirping of crickets varies with temperature, using the tree cricket Oecanthus fultoni.
dolbear(n = NULL, t = NULL, species = "Oecanthus fultoni")
dolbear(n = NULL, t = NULL, species = "Oecanthus fultoni")
n |
Chirps per minute |
t |
Temperature in Celsius |
species |
Species to use (by default Oecanthus fultoni), NULL to calculate for all species. |
Subsequent research by Dolbear and others have published additional formulae for other species: Oecanthus fultoni (Fulton 1925), Oecanthus rileyi (Walker 1962), Oecanthus alexanderi (Walker and Collins 2010), and Oecanthus allardi (Allard 1957).
Data frame with t and n calculated for matching species.
Allard HA (1957).
“The stridulations of some crickets in the Dominican Republic.”
Journal Washington Academy of Sciences, 47, 150–152.
Dolbear AE (1897).
“The Cricket as a Thermometer.”
The American Naturalist, 31(371), 970–971.
ISSN 00030147, 15375323, http://www.jstor.org/stable/2453256.
Fulton BB (1925).
“Physiological variation in the snowy tree cricket, Oecanthus fultoni, De Geer.”
Annals of the Entomological Society of America, 18, 363–383.
Walker TJ (1962).
“The taxonomy and calling songs of United States tree crickets (Orthoptera: Gryllidae: Oecanthinae). I. The genus Neoxabea and the niveus and varicornis groups of the genus Oecanthus.”
Annals Entomological Society of America, 55, 303–322.
http://entnemdept.ifas.ufl.edu/walker/Buzz/s576lw62.pdf.
Walker TJ, Collins N (2010).
“New World thermometer crickets: the Oecanthus rileyi species group and a new species from North America.”
Journal of Orthoptera Research, 19(2).
ISSN 10826467, 19372426, http://www.jstor.org/stable/25822725.
dolbear(n=6) dolbear(t=25)
dolbear(n=6) dolbear(t=25)
Proportion of a wave with signal above the limit
dutyCycle(wave, limit = 0.1, output = "unit", normalise = TRUE)
dutyCycle(wave, limit = 0.1, output = "unit", normalise = TRUE)
wave |
A Wave object |
limit |
Threshold above which to consider the signal |
output |
If "unit" the duty cycle will be in the range 0-1. For a percentage use "percent". |
normalise |
If TRUE the Wave is normalised using tuneR |
A numerical value for the duty cycle between 0 and 1 (or 0 and 100% if percentage output).
wave <- tuneR::sine(2000) dc <- dutyCycle(wave) pc <- dutyCycle(wave, output="percent")
wave <- tuneR::sine(2000) dc <- dutyCycle(wave) pc <- dutyCycle(wave, output="percent")
Create a diel plot with labels but without sun altitude or times of day plotted.
emptyDiel(method = "plotrix", rot = pi)
emptyDiel(method = "plotrix", rot = pi)
method |
Plotting package to use |
rot |
Rotation of the origin (defaults to pi) |
Create a yearly plot with labels but without sun or night duration plotted.
emptyYearly(year = 2022, method = "plotix", rot = pi)
emptyYearly(year = 2022, method = "plotix", rot = pi)
year |
Year to plot (allows for leap years) |
method |
Plotting package to use |
rot |
Rotation of the origin (defaults to pi) |
Calculates the peak, centre, bandwidth and quality factor. The quality factor (Q) is calculated at both -3dB and -10dB as discussed by Bennett-Clark (1999) doi:10.1080/09524622.1999.9753408.
entropyStats(wave)
entropyStats(wave)
wave |
A Wave object |
A list of spectral entropy types.
## Not run: entropyStats(sheep) ## End(Not run)
## Not run: entropyStats(sheep) ## End(Not run)
A WaveFilter object is an object containing information necessary for the filterw function to apply the filter to a Wave object. This is designed to allow a pipe operator (either magrittr or base R) to be used to apply filters to a Wave in a pipeline.
filterWave(w, filt, cl = NULL)
filterWave(w, filt, cl = NULL)
w |
A Wave object. |
filt |
Wave object with the selected filter applied. |
cl |
Optional. If a cluster is specified, the filter will be applied in parallel. |
Supported filters include those from the seewave package.
Calculates the frequency of a sound wave given the wavelength and speed of sound in that medium.
frequencySound(wl, s = soundSpeed(medium = "air"))
frequencySound(wl, s = soundSpeed(medium = "air"))
wl |
Wavelength |
s |
Speed of sound (defaults to the speed of sound in air) |
Frequency of the sound in Hertz
f <- frequencySound(wl=100, s=343)
f <- frequencySound(wl=100, s=343)
Calculates the peak, centre, bandwidth and quality factor. The quality factor (Q) is calculated at both -3dB and -10dB as discussed by Bennett-Clark (1999) <doi: 10.1080/09524622.1999.9753408>.
frequencyStats(wave, wave_spec = NULL, warn = TRUE, lowcut = 1, plot = FALSE)
frequencyStats(wave, wave_spec = NULL, warn = TRUE, lowcut = 1, plot = FALSE)
wave |
A Wave object |
wave_spec |
A precomputed spectrum (optional, if not present will be generated) |
warn |
If TRUE provides warnings when values are not consistent |
lowcut |
Frequency (in kHz) values below which are ignored. |
plot |
IF TRUE displays values |
Adding noise to a Wave like object allows for testing of the robustness of automated identification algorithms to noise.
generateNoise( wave, noise = c("white"), noise.add = FALSE, noise.ratio = 0.5, noise.ref = "file", output = "list" )
generateNoise( wave, noise = c("white"), noise.add = FALSE, noise.ratio = 0.5, noise.ref = "file", output = "list" )
wave |
Object to add noise to ( |
noise |
Vector of noise to add (unif, gaussian, white, pink, power, red) |
noise.add |
If TRUE all noise sources are added to wave. If FALSE separate outputs are created for each noise source. |
noise.ratio |
Ratio of maximum noise amplitude to the maximum amplitude in wave. |
noise.ref |
Reference maximum for noise.ratio. If "max" then the maximum amplitude, if "file" then the maximum amplitude of wave. |
output |
TODO: Is this implemented? |
A list of Wave objects with the required noise added.
Given a Wave
-like object (or a list of Wave
-like objects), generate
new Wave
-like objects with time masking.
generateTimeMask(wave, method = "squarewave", dutyCycle = 0.95, n.periods = 10)
generateTimeMask(wave, method = "squarewave", dutyCycle = 0.95, n.periods = 10)
wave |
A |
method |
The method to use for time masking (one of "squarewave", "random). |
dutyCycle |
The duty cycle of the output. A value of 0.95 means that 5% of the time is masked. |
n.periods |
The number of waves to generate in the squarewave method. |
Given a Wave-like object (or list of Wave-like objects), this function generates time-shifted versions of the object. The time-shifted versions are generated by adding a constant amount of time to the start or end of the object. This is achieved by either inserting silence and truncating the object to the original length, or by rotating the audio within the object.
generateTimeShift( wave, type = "silent", amount = c(1, 2), where = "start", output = "list" )
generateTimeShift( wave, type = "silent", amount = c(1, 2), where = "start", output = "list" )
wave |
A Wave-like object or list of Wave-like objects. |
type |
The type of time-shift to apply. Either "silent" or "rotate". |
amount |
Vector of amount of time to shift by (seconds). |
where |
Where to insert silence if |
output |
Return a list. |
A Wave-like object or list of Wave-like objects.
Imports the scikit-maad object into R. This allows reuse of the same object between function calls.
getMaad()
getMaad()
Wrapper around various Google packages to simplify speech transcription.
gs_transcribe(filename, bucket = NULL, ...)
gs_transcribe(filename, bucket = NULL, ...)
filename |
Path to file for analysis |
bucket |
Storage bucket on Google Cloud for larger files |
... |
Additional arguments to pass to gl_speech() |
A gs_transcribe object containing details of the transcription
## Not run: gs_transcribe("demo.wav") ## End(Not run)
## Not run: gs_transcribe("demo.wav") ## End(Not run)
Given an input of bytes calculates the result in a sensible output unit (e.g. MB, GB, PB).
humanBytes(S)
humanBytes(S)
S |
Number of bytes |
String in human readable format
Given an input of bytes calculates the result in a sensible output unit (e.g. minutes, hours).
humanTime(S, unit = "seconds")
humanTime(S, unit = "seconds")
S |
Time to convert in unit |
unit |
The unit of time to convert |
String in human readable format
Jitter is a measure of the variability of periods in the waveform. Relative jitter is scaled by the jitter in the analysed waveform.
jitter(wave, method = "absolute")
jitter(wave, method = "absolute")
wave |
A Wave object |
method |
One of "absolute" or "relative" |
A vector of zero crossing locations
## Not run: jitter(sheep, method="absolute") jitter(sheep, method="relative") ## End(Not run)
## Not run: jitter(sheep, method="absolute") jitter(sheep, method="relative") ## End(Not run)
Takes labels from Google Speech API transcript and pads the time by a specified number of seconds.
labelPadding(t, pad = 0.5, max_t = NULL)
labelPadding(t, pad = 0.5, max_t = NULL)
t |
Transcript from Google Speech API |
pad |
Amount of time (in seconds) to add to start and end |
max_t |
Optional. The duration of the file, so padding does not exceed length of file. |
A modified Google Speech API transcript object
## Not run: labelPadding(t, pad=2, max_t=duration(wave)) ## End(Not run)
## Not run: labelPadding(t, pad=2, max_t=duration(wave)) ## End(Not run)
Takes labels from Google Speech API transcript and combines overlapping labels.
labelReduction(t)
labelReduction(t)
t |
Transcript from Google Speech API |
A list containing start and end times of speech containing regions
## Not run: labelReduction(t) ## End(Not run)
## Not run: labelReduction(t) ## End(Not run)
ACI depends on the duration of the spectrogram as the derivation of the signal is normalized by the sum of the signal. Thus, if the background noise is high due to high acoustic activity the normalization by the sum of the signal reduced ACI. So ACI is low when there is no acoustic activity or high acoustic activity with continuous background noise. ACI is high only when acoustic activity is medium, with sounds well above the background noise.
maad_acoustic_complexity_index(object, maad = NULL)
maad_acoustic_complexity_index(object, maad = NULL)
object |
A Wave object or a spectrogram_maad object generated by
|
maad |
An optional maad object. If not provided, one will be created using |
For addition documentation see https://scikit-maad.github.io/generated/maad.features.temporal_acoustic_complexity_index.html (Pieretti et al. 2011).
List comprising:
ACI_xx |
Acoustic Complexity Index. |
ACI_per_bin |
Acoustic Complexity Index. |
ACI_sum |
Sum of ACI value per frequency bin (Common definition) |
Pieretti N, Farina A, Morri D, Gage SH (2011). “A new methodology to infer the singing activity of an avian community: the Acoustic Complexity Index (ACI).” Ecological Indicators, 11, 868–873. doi:10.1016/j.ecolind.2010.11.005.
The spectral entropy of a signal measures the energy dispersion along frequencies. Low values indicates a concentration of energy around a narrow frequency band. If the DC value is not removed before processing the large peak at f=0Hz will lower the entropy of the signal.
maad_frequency_entropy(object, compatibility = "QUT", maad = NULL)
maad_frequency_entropy(object, compatibility = "QUT", maad = NULL)
object |
A Wave object or a spectrogram_maad object generated by
|
compatibility |
One of "QUT" (Towsey et al. 2018) or "seewave" (Sueur et al. 2008). Default is "QUT". |
maad |
An optional maad object. If not provided, one will be created using |
For addition documentation see https://scikit-maad.github.io/generated/maad.features.frequency_entropy.html
List comprising:
Hf |
Frequency entropy. |
Ht_per_bin |
Temporal entropy per frequency bin. |
Sueur J, Aubin T, Simonis C (2008).
“Seewave, a free modular tool for sound analysis and synthesis.”
Bioacoustics, 18(2), 213–226.
Towsey M, Truskinger A, Cottman-Fields M, Roe P (2018).
“Ecoacoustics Audio Analysis Software.”
https://github.com/QutEcoacoustics/audio-analysis.
Count the number of frequency peaks on a mean spectrum. This function was adapted from the function fpeaks of the R package Seewave (Sueur et al. 2008).
maad_number_of_peaks( object, mode = "dB", min_peak_val = NULL, min_freq_dist = 200, slopes = c(1, 1), prominence = 0, maad = NULL )
maad_number_of_peaks( object, mode = "dB", min_peak_val = NULL, min_freq_dist = 200, slopes = c(1, 1), prominence = 0, maad = NULL )
object |
A Wave object or a spectrogram_maad object generated by
|
mode |
One of "dB", "linear". |
min_peak_val |
Only peaks above this threshold will be considered. |
min_freq_dist |
Frequency threshold parameter (in Hz). If the frequency difference of two successive peaks is less than this threshold, then the peak of highest amplitude will be kept only. |
slopes |
Refers to the amplitude slopes of the peak. The first value is the left slope and the second value is the right slope. Only peaks with higher slopes than threshold values will be kept. |
prominence |
The first element is the minimal prominence and the second element is the maximal prominence. If a single number is provided it is interpreted as the minimal value, and no maximal value will be used. |
maad |
An optional maad object. If not provided, one will be created
using |
For addition documentation see https://scikit-maad.github.io/generated/maad.features.number_of_peaks.html
Numeric number of peaks
Acoustic activity corresponds to the portion of the spectrogram above a threshold frequency per frequency along time axis (Towsey 2017).
maad_spectral_activity(object, dB_threshold = 6, maad = NULL)
maad_spectral_activity(object, dB_threshold = 6, maad = NULL)
object |
A Wave object or a spectrogram_maad object. |
dB_threshold |
dB threshold of activity (default = 6). |
maad |
An optional maad object. If not provided, one will be created using |
The function computes for each frequency bin:
ACTfract |
Proportion (fraction) of points above the threshold. |
ACTcount |
Total number of points above the threshold. |
ACTmean |
Mean value (in dB) of the portion of the signal above the threshold. |
Towsey M (2017). “The calculation of acoustic indices derived from long-duration recordings of the natural environment.” Queensland University of Technology. https://eprints.qut.edu.au/110634/1/QUTePrints110634_TechReport_Towsey2017August_AcousticIndices%20v3.pdf.
Compute different entropies based on the average spectrum, its variance, and its maxima.
maad_spectral_entropy(object, flim = NULL, maad = NULL)
maad_spectral_entropy(object, flim = NULL, maad = NULL)
object |
A Wave object or a spectrogram_maad object generated by
|
flim |
A numeric vector of length 2 specifying the frequency limits for the entropy calculation. |
maad |
An optional maad object. If not provided, one will be created using |
For addition documentation see https://scikit-maad.github.io/generated/maad.features.spectral_entropy.html
List comprising:
EAS |
Entropy of Average Spectrum. |
ECU |
Entropy of spectral variance (along the time axis for each frequency). |
ECV |
Entropy of Coefficient of Variation (along the time axis for each frequency). |
EPS |
Entropy of spectral maxima (peaks). |
EPS_KURT |
Kurtosis of spectral maxima. |
EPS_SKEW |
Skewness of spectral maxima. |
This is a wrapper function for the maad.sound.spectrogram
function
from the scikit-maad package for Python. It computes the spectrogram of a
sound wave. Further usage details are provided at
https://maad.readthedocs.io/en/latest/maad.sound.html#maad.sound.spectrogram.
maad_spectrogram(wave, mode = "power", ..., maad = NULL)
maad_spectrogram(wave, mode = "power", ..., maad = NULL)
wave |
A Wave object |
mode |
The type of spectrogram to compute. Options are "power", "amplitude" "complex". Default is "power". |
... |
Additional arguments to pass to |
maad |
An optional |
Generically a spectrogram_maad
object.
This is a wrapper function for the maad.sound.spectrum
function.
It computes the spectrum of a sound wave. Further usage details are provided at
https://maad.readthedocs.io/en/latest/maad.sound.html#maad.sound.spectrum.
maad_spectrum(wave, ..., maad = NULL)
maad_spectrum(wave, ..., maad = NULL)
wave |
A Wave object |
... |
Additional arguments to pass to |
maad |
An optional |
A list comprising:
pxx |
Power spectral density estimate. |
f_idx |
Index of sample frequencies. |
For addition documentation see https://scikit-maad.github.io/generated/maad.features.temporal_activity.html (Towsey 2013).
maad_temporal_activity( wave, dB_threshold = 3, mode = "fast", Nt = 512, maad = NULL )
maad_temporal_activity( wave, dB_threshold = 3, mode = "fast", Nt = 512, maad = NULL )
wave |
A Wave object. |
dB_threshold |
dB threshold of activity (default = 3). |
mode |
Mode of the envelope calculation. Can be "fast" or "Hilbert". |
Nt |
Size of each frame. The largest, the highest is the approximation. |
maad |
An optional maad object. If not provided, one will be created using |
List of calculated values, comprising:
ACTfrac |
fraction)of points above the threshold for each frequency bin. |
ACTcount |
total number of points above the threshold for each frequency bin. |
ACTmean |
mean value (in dB) of the portion of the signal above the threshold. |
Towsey M (2013). “Noise Removal from Waveforms and Spectrograms Derived from Natural Recordings of the Environment.” Queensland University of Technology. https://eprints.qut.edu.au/216373/.
For addition documentation see https://scikit-maad.github.io/generated/maad.features.temporal_entropy.html.
maad_temporal_entropy( wave, compatibility = "QUT", mode = "fast", Nt = 512, maad = NULL )
maad_temporal_entropy( wave, compatibility = "QUT", mode = "fast", Nt = 512, maad = NULL )
wave |
A Wave object. |
compatibility |
One of "QUT" (Towsey et al. 2018), "seewave" (Sueur et al. 2008). |
mode |
Mode of the envelope calculation. Can be "fast" or "hilbert". |
Nt |
Size of each frame. The largest, the highest is the approximation. |
maad |
An optional maad object. If not provided, one will be created using |
Numeric entropy of the envelope.
Sueur J, Aubin T, Simonis C (2008).
“Seewave, a free modular tool for sound analysis and synthesis.”
Bioacoustics, 18(2), 213–226.
Towsey M, Truskinger A, Cottman-Fields M, Roe P (2018).
“Ecoacoustics Audio Analysis Software.”
https://github.com/QutEcoacoustics/audio-analysis.
An acoustic event corresponds to the period of the signal above a threshold. An acoustic event could be short (at list one point if rejectDuration is None) or very long (the duration of the entire audio). Two acoustic events are separated by a period with low audio signal (i.e. below the threshold).
maad_temporal_events( wave, dB_threshold = 3, rejectDuration = 0.1, mode = "fast", Nt = 512, maad = NULL )
maad_temporal_events( wave, dB_threshold = 3, rejectDuration = 0.1, mode = "fast", Nt = 512, maad = NULL )
wave |
A Wave object. |
dB_threshold |
dB threshold of activity (default = 3). |
rejectDuration |
Duration of the silence to reject an acoustic event (default = 0.1). |
mode |
Mode of the envelope calculation. Can be "fast" or "Hilbert". |
Nt |
Size of each frame. The larger, the highest is the approximation. |
maad |
An optional maad object. If not provided, one will be created using |
For addition documentation see https://scikit-maad.github.io/generated/maad.features.temporal_events.html (Towsey 2013) (Towsey et al. 2018).
List of calculated values, comprising:
EVTfrac |
fraction of points above the threshold for each frequency bin. |
EVTcount |
total number of points above the threshold for each frequency bin. |
EVTmean |
mean value (in dB) of the portion of the signal above the threshold. |
EVN |
logical vector or matrix with 1 corresponding to event position. |
Towsey M (2013).
“Noise Removal from Waveforms and Spectrograms Derived from Natural Recordings of the Environment.”
Queensland University of Technology.
https://eprints.qut.edu.au/216373/.
Towsey M, Truskinger A, Cottman-Fields M, Roe P (2018).
“Ecoacoustics Audio Analysis Software.”
https://github.com/QutEcoacoustics/audio-analysis.
For addition documentation see https://scikit-maad.github.io/generated/maad.features.temporal_median.html.
maad_temporal_median(wave, mode = "fast", Nt = 512, maad = NULL)
maad_temporal_median(wave, mode = "fast", Nt = 512, maad = NULL)
wave |
A Wave object. |
mode |
Mode of the envelope calculation. Can be "fast" or "hilbert". |
Nt |
Size of each frame. The largest, the highest is the approximation. |
maad |
An optional maad object. If not provided, one will be created using |
Numeric median of the envelope.
Maps three vectors of equal length to RGB for use in false-colour index spectrograms
map2RGB(red, green, blue)
map2RGB(red, green, blue)
red |
The red channel vector |
green |
The green channel vector |
blue |
The blue channel vector |
A vector of RGB values
Checks a list of annotations for those that are overlapping in the time or
frequency domain, and returns a list where overlapping annotations are merged.
Annotation objects must have the same file
, type
and value
to be merged.
merge_annotations(annotations, domain = "time", same.source = TRUE)
merge_annotations(annotations, domain = "time", same.source = TRUE)
annotations |
A list of Annotation objects. |
domain |
Domain of the annotations, either "time" or "frequency". |
same.source |
If TRUE, annotations must have the same source to be merged. |
A list of Annotation objects.
Calculates the natural frequency given the inductance, capacitance and resistance. In the acoustic case the inductance is inertia or mass, the capacitance is elasticity (bulk modulus) and resistance is composed of air resistance and related quantities. All units are SI.
naturalFrequency(L, C = "default", R)
naturalFrequency(L, C = "default", R)
L |
Inductance |
C |
Capacitance, by default IUPAC standard pressure. |
R |
Resistance |
For isothermal compression, the bulk modulus is equal to the pressure. The default value of C therefore is the IUPAC standard pressure.
naturalFrequency(L=20,R=0.5) naturalFrequency(L=20,C=1/4,R=0.5)
naturalFrequency(L=20,R=0.5) naturalFrequency(L=20,C=1/4,R=0.5)
Similar to normalize() from the tuneR package but automatically identifies the unit parameter.
normalise(wave, unit = NULL, ...)
normalise(wave, unit = NULL, ...)
wave |
Wave or WaveMC object |
unit |
If not null behaves as in normalize() from tuneR, if null the unit is automatically identified. |
... |
Additional arguments passed to normalize() from tuneR |
Normalised Wave or WaveMC object
Runs a function on the wave and outputs values in the Natural Time Domain (see Varotsos, Sarlis & Skordas(2011) doi:10.1007/978-3-642-16449-1).
ntd(wave, events, FUN, normalise = FALSE, argument = "wave", ...)
ntd(wave, events, FUN, normalise = FALSE, argument = "wave", ...)
wave |
A Wave object containing pulses |
events |
Onset of detected events, e.g. from pulseDetection() |
FUN |
The function to run |
normalise |
If TRUE the output is a probability density |
argument |
If "wave" supplies a weave object to the function, if "vector" supplies the left channel as a numeric vector. |
... |
Additional arguments to FUN |
A list of outputs form the applied function
Attempts to extract meaningful information from a filename, typically the date and time a recording started.
parseFilename(file, format = NULL, timezone = NULL)
parseFilename(file, format = NULL, timezone = NULL)
file |
A filename (or list of filenames). |
format |
Optionally force a given format (see Details). If NULL (default) an attempt is made to automatically detect the format for each file. If "match" and a list of filenames is given then an attempt will be made to find a format that matches all files. This may give incorrect results if the filename is ambiguous (see Details). |
timezone |
Optionally set a timezone. |
It is sometimes impossible to accurately determine the format of a filename, e.g. when an eight-digit 'AudioMoth HEX' only contains numbers it could be confused with a YYYYMMDD format. If a list of filenames is given and the "match" format is specified then an effort will be made to determine the most likely format that applies to all filenames.
AudioMoth - The newer format for AudioMoth devices consists of a
standard YYYYMMDD_HHMMSS.wav format. Specifying 'AudioMoth' forces a call
to the audiomoth()
function from the seewave
package
(Sueur et al. 2008).
AudioMoth HEX - Older format for AudioMoth devices consisting of eight
hexadecimal characters. Conversion is handled by a call to
seewave::audiomoth()
.
timestamp - A standard date-time format. Uses the R standard origin of 1970-01-01 00:00:00 UTC.
Wildlife Acoustics SM2 - Can also be used for Wildlife Acoustics SM4
devices. Conversion is handled by a call to seewave::songmeter()
.
Wildlife Acoustics SM3 - Conversion is handled by a call to
seewave::songmeter()
.
YYYYMMDD_HHMMSS - A standard date-time format.
A list of file, type of match, datetime.
It is possible to determine additional properties from some files, these will
be added to the list.
Sueur J, Aubin T, Simonis C (2008). “Seewave, a free modular tool for sound analysis and synthesis.” Bioacoustics, 18(2), 213–226.
parseFilename("5E90A4D4.wav")
parseFilename("5E90A4D4.wav")
Detects pulses in a Wave using the method described in Dietrich et al (2004) doi:10.1016/j.patcog.2004.04.004.
pd_dietrich2004( wave, U = 120, gamma = 0.05, alpha = 1.4, scaling = 32, V = 480, psi = 1 )
pd_dietrich2004( wave, U = 120, gamma = 0.05, alpha = 1.4, scaling = 32, V = 480, psi = 1 )
wave |
A Wave object |
U |
Window length |
gamma |
Gamma |
alpha |
Alpha |
scaling |
Scaling |
V |
V Window length |
psi |
Psi |
A list of input values plus the onset and offset times of pulses
Detects pulses in a Wave.
pd_simple( wave, U = 120, gamma = 0.05, alpha = 1.4, scaling = 32, V = 480, psi = 1 )
pd_simple( wave, U = 120, gamma = 0.05, alpha = 1.4, scaling = 32, V = 480, psi = 1 )
wave |
A Wave object |
U |
Window length |
gamma |
Gamma |
alpha |
Alpha |
scaling |
Scaling |
V |
V Window length |
psi |
Psi |
This function is used to create a PseudoWave object that can be used to generate a Wave object when operated on.
pseudoWave( type = NA_character_, subtype = NA_character_, scale = 1, offset = 0, seed = 1, params = list() )
pseudoWave( type = NA_character_, subtype = NA_character_, scale = 1, offset = 0, seed = 1, params = list() )
type |
Type of PseudoWave (e.g. "noise", "sine") |
subtype |
Subtype of PseudoWave (e.g. "white" if type is "noise") |
scale |
The Wave channels are multiplied by this value |
offset |
This value is added to the Wave channels |
seed |
Random seed for reproducible output. NA for no |
params |
List of additional parameters to pass to generating function |
A PseudoWave object.
pw <- pseudoWave("noise", "white") pw <- pseudoWave("sine", params=list("f0"=440))
pw <- pseudoWave("noise", "white") pw <- pseudoWave("sine", params=list("f0"=440))
An S4 class to represent a PseudoWave object that is converted to a Wave object when operated on.
type
Type of PseudoWave (e.g. "noise")
subtype
Subtype of PseudoWave (e.g. "white" if type is "noise")
scale
The Wave channels are multiplied by this value
offset
This value is added to the Wave channels
seed
Random seed for reproducible output, NA for no seed
scale
Logical. Whether to use the random seed value
params
List of additional parameters to pass to generating function
Generate a single pulse, either a Dirac pulse (Dirac delta) or a square pulse.
pulse( type = "dirac", leading = 22050, pulse.length = 1, duration = samp.rate, samp.rate = 44100, bit = 1, pcm = FALSE, stereo = FALSE, output = "Wave", invert = FALSE )
pulse( type = "dirac", leading = 22050, pulse.length = 1, duration = samp.rate, samp.rate = 44100, bit = 1, pcm = FALSE, stereo = FALSE, output = "Wave", invert = FALSE )
type |
Either "dirac" or "square". |
leading |
The number of samples before the pulse. |
pulse.length |
The number of samples in the pulse (for "square"). |
duration |
The total number of samples generated. |
samp.rate |
The sample rate. |
bit |
The bit depth. |
pcm |
Whether Wave generated is PCM (see tuneR). |
stereo |
Whether Wave generated is stereo. |
output |
The output format ("Wave"). |
invert |
Whether to invert the pulse. |
Specified by output.
Detects pulses in a Wave, defaults to using Dietrich (2004).
pulseDetection(wave, method = "simple", ...)
pulseDetection(wave, method = "simple", ...)
wave |
A Wave object containing pulses |
method |
Which method to use for pulse detection |
... |
Other arguments to pass to pulse detection function |
Used to locate area of no pulses from the results of pulseDetection().
pulseIntervals(pulses, nsd = 2)
pulseIntervals(pulses, nsd = 2)
pulses |
The result of a pulseDetection. |
nsd |
The number of standard deviations each sid of the mean pulse interval to discard |
A list of onset and offset times for pulses
This function installs scikit-maad in the sonicscrewdriver
environment using reticulate
.
pythonInstall(unattended = FALSE)
pythonInstall(unattended = FALSE)
unattended |
If TRUE then the function will not prompt the user to install the environment in a non-interactive session. |
## Not run: pythonInstall() pythonInstall(unattended=TRUE) ## End(Not run)
## Not run: pythonInstall() pythonInstall(unattended=TRUE) ## End(Not run)
Calculates the power returned from an echolocation pulse
radarPower(P_t, r, area, G_t = 1, G_r = 1, wl = 1)
radarPower(P_t, r, area, G_t = 1, G_r = 1, wl = 1)
P_t |
Power transmitted (from sender) |
r |
Range of the target |
area |
Effective cross-sectional area of the target |
G_t |
Transmitter gain |
G_r |
Receiver gain |
wl |
Wavelength (use only with G_r and G_t) |
The received power
radarPower(12, 20, 0.05) radarPower(12, 20, 0.05, G_t=1.2, G_r=1.5, wl=0.045)
radarPower(12, 20, 0.05) radarPower(12, 20, 0.05, G_t=1.2, G_r=1.5, wl=0.045)
Calculates the distance of an object based on the round trip time of an echolocation pulse
radarRange(t, c = soundSpeed(medium = "air"))
radarRange(t, c = soundSpeed(medium = "air"))
t |
Time in seconds |
c |
Speed of sound in transmission medium m/s (by default air) |
Distance to object
radarRange(2) radarRange(2, c=343) radarRange(2, c=soundSpeed(medium = "sea water"))
radarRange(2) radarRange(2, c=343) radarRange(2, c=soundSpeed(medium = "sea water"))
Used to plot sectors, annuli and horizons on a dielPlot() or yearlyPlot(). The polygon has an inner and outer horizon - which can be set to a fixed radius or a vector.
radialPolygon( angle1, angle2, radius1, radius2, col = "grey", border = NA, rot = -pi, angleinc = 0.01, reverse = TRUE, ... )
radialPolygon( angle1, angle2, radius1, radius2, col = "grey", border = NA, rot = -pi, angleinc = 0.01, reverse = TRUE, ... )
angle1 |
Angles for the inner line |
angle2 |
Angles for the outer line |
radius1 |
Radii for the inner line |
radius2 |
Radii for the outer line |
col |
Colour of the polygon |
border |
Border colour (see polygon() for details) |
rot |
Rotation of the plot, defaults to pi to match dielPlot() and yearlyPlot() |
angleinc |
The angular increment in radians for calculating circular lines |
reverse |
If FALSE plots in an anti-clockwise direction |
... |
Other parameters passed to polygon() |
Detects rainfall in a Wave. An uncalibrated version of Bedoya et al (2017) doi:10.1016/j.ecolind.2016.12.018 is available in this package. The hardRain package can also be accessed via this wrapper.
rainfallDetection(wave, method = "bedoya2017", ...)
rainfallDetection(wave, method = "bedoya2017", ...)
wave |
A Wave object to detect rainfall in |
method |
Which rainfall detection method to use ("bedoya2017") |
... |
Other arguments to pass to rain detection function |
Numeric value from the rainfall detection algorithm chosen.
## Not run: rainfallDetection(sheep, method="bedoya2017") ## End(Not run)
## Not run: rainfallDetection(sheep, method="bedoya2017") ## End(Not run)
Reads an Audacity label file and returns either a list of Annotation
objects
or a data frame.
readAudacityLabels(file, output = "annotations")
readAudacityLabels(file, output = "annotations")
file |
Path to the Audacity label file. |
output |
One of "annotations" or "data.frame". |
This file is used to read an audio file and return a Wave object, it is an abstraction function for various specific audio reading functions. If no existing method can be identified an attempt is made to use the av package to read the audio.
readAudio(file, mime = "auto", from = 0, to = Inf, units = "seconds")
readAudio(file, mime = "auto", from = 0, to = Inf, units = "seconds")
file |
File to read |
mime |
MIME type of file to read, or "auto". Supported types are "audio/x-wav" and "audio/mpeg" (MP3) |
from |
Start point in file to return |
to |
End point in file to return |
units |
One of "samples", "seconds", "minutes", "hours". Default is "seconds". |
A Wave object
Reads a single file, or directory of files, output by BirdNet Analyser.
readBirdNet(file, filename_parsing = "none")
readBirdNet(file, filename_parsing = "none")
file |
Filename or directory |
filename_parsing |
Allows for filename parsing, accepted values are one of none, audiomoth, timestamp. |
A data frame.
The Seeed Studio Respeaker-6 when used as described in the documentation saves an eight channel audio file with channels 7 and 8 not containing input audio. This function reads such a file and saves it as a six channel file.
readRespeaker6(filename, from = 1, to = Inf, units = "samples", header = FALSE)
readRespeaker6(filename, from = 1, to = Inf, units = "samples", header = FALSE)
filename |
file to read. |
from |
Where to start reading the wave in units. |
to |
Where to stop reading the wave in units. |
units |
Units in which from and to is given, the default is "samples", but can be set to time intervals such as "seconds". |
header |
If TRUE, just header information of the Wave file are returned, otherwise (the default) the whole Wave object. |
A WaveMC object.
Provides the standard reference intensity level.
referenceIntensity(unit = "watt_cm2")
referenceIntensity(unit = "watt_cm2")
unit |
Unit to return, "watt_cm2" |
ri <- referenceIntensity()
ri <- referenceIntensity()
Provides the standard reference pressure level.
referencePressure(unit = "Pa")
referencePressure(unit = "Pa")
unit |
Unit to return, "Pa" or "dyne_cm2" |
rp <- referencePressure() rp <- referencePressure(unit="dyne_cm2")
rp <- referencePressure() rp <- referencePressure(unit="dyne_cm2")
Specifies a time-bounded region to analyse.
region(unit, from = 0, to = Inf)
region(unit, from = 0, to = Inf)
unit |
Unit of time (one of samples, seconds, minutes, hours) |
from |
Start time |
to |
End time |
A TimeRegion object.
Calculates the resonant frequency given the inductance and capacitance. In the acoustic case the inductance is inertia or mass, the capacitance is elasticity (bulk modulus) and resistance is composed of air resistance and related quantities. All units are SI.
resonantFrequency(L, C = "default")
resonantFrequency(L, C = "default")
L |
Inductance |
C |
Capacitance, by default IUPAC standard pressure. |
For isothermal compression, the bulk modulus is equal to the pressure. The default value of C therefore is the IUPAC standard pressure.
f <- resonantFrequency(L=1)
f <- resonantFrequency(L=1)
Calculates the time represented by n samples in a Wave.
sDuration(n = 1, wave = NULL, samp.rate = NULL)
sDuration(n = 1, wave = NULL, samp.rate = NULL)
n |
The number of the samples |
wave |
A Wave object containing pulses |
samp.rate |
Integer sampling rate |
A numeric value in seconds
sDuration(n=20, samp.rate=44100) ## Not run: sDuration(n=20, wave=sheep)#' ## End(Not run)
sDuration(n=20, samp.rate=44100) ## Not run: sDuration(n=20, wave=sheep)#' ## End(Not run)
The frequencyStats of the sheep data file from the seewave package.
sheepFrequencyStats
sheepFrequencyStats
An object of class list
of length 3.
Jitter is a measure of the variability of amplitudes within periods in the waveform. Relative shimmer is scaled by the shimmer in the analysed waveform.
shimmer(wave)
shimmer(wave)
wave |
A Wave object |
A vector of zero crossing locations
## Not run: shimmer(sheep) ## End(Not run)
## Not run: shimmer(sheep) ## End(Not run)
Sorts a list of annotations by either start time, frequency, or both.
sort_annotations(annotations, domain = "time", decreasing = FALSE)
sort_annotations(annotations, domain = "time", decreasing = FALSE)
annotations |
A list of Annotation objects. |
domain |
Domain of the annotations, either "time", "frequency", or "both". |
decreasing |
If TRUE, sort in decreasing order. |
A list of Annotation objects.
Given sufficient parameters (i.e. wavelength and frequency, bulk modulus and density) this function calculates the speed of sound.
soundSpeed( medium = NULL, method = NULL, wl = NULL, f = NULL, bulkModulus = NULL, density = NULL, ... )
soundSpeed( medium = NULL, method = NULL, wl = NULL, f = NULL, bulkModulus = NULL, density = NULL, ... )
medium |
Propagation medium (e.g. "air"), or "all" to return a list of all available media. |
method |
Use a specific method to calculate the speed of sound (see Details). |
wl |
Wavelength |
f |
Frequency |
bulkModulus |
Bulk modulus |
density |
Density |
... |
Additional parameters passed to the method. |
The speed of sound can be calculated using the following methods:
cramer Uses the method described in Cramer (1993). Additional parameters are:
temp Temperature
temp.unit Temperature unit
pressure Pressure
pressure.unit Pressure unit
RH Relative humidity
MoleFracCO2 Mole fraction of CO2
seewave Delegates the calculation of the speed of sound in air to the
package seewave
(Sueur et al. 2008). This calculation is
. performed as .
Additional parameters are:
temp Temperature
Cramer O (1993).
“The variation of the specific heat ratio and the speed of sound in air with temperature, pressure, humidity, and CO2 concentration.”
The Journal of the Acoustical Society of America, 93(5), 2510–2516.
ISSN 0001-4966, doi:10.1121/1.405827.
Sueur J, Aubin T, Simonis C (2008).
“Seewave, a free modular tool for sound analysis and synthesis.”
Bioacoustics, 18(2), 213–226.
soundSpeed(medium="air") soundSpeed(medium="sea water") soundSpeed(method="cramer", temp=14, pressure=3, RH=10) soundSpeed(method="cramer", temp=14, temp.unit="C", pressure=3, pressure.unit="kPa", RH=10) t <- 1:30 s <- lapply(t, \(x){soundSpeed(method="cramer", temp=x)})
soundSpeed(medium="air") soundSpeed(medium="sea water") soundSpeed(method="cramer", temp=14, pressure=3, RH=10) soundSpeed(method="cramer", temp=14, temp.unit="C", pressure=3, pressure.unit="kPa", RH=10) t <- 1:30 s <- lapply(t, \(x){soundSpeed(method="cramer", temp=x)})
Given a list of outputs from meanspec generates a plot with the mean shown by a line, and either the minimum/maximum values or one standard deviation shown by a ribbon.
specStats(spectra, stats = "minMax", line.col = "black", ribbon.col = "grey70")
specStats(spectra, stats = "minMax", line.col = "black", ribbon.col = "grey70")
spectra |
A list of spectra |
stats |
Either minMax or sd |
line.col |
Colour for the line |
ribbon.col |
Colour for the ribbon |
A ggplot2 object
An S4 class to represent a spectrogram from scikit-maad.
Sxx
The spectrogram matrix
tn
The time vector
fn
The frequency vector
extents
The extents of the spectrogram. A list of tmin, tmax, fmin, fmax.
Computes the short term energy of a Wave.
ste(wave, method = "dietrich2004", ...)
ste(wave, method = "dietrich2004", ...)
wave |
A Wave object |
method |
Which method used to calculate the short term energy, by default "dietrich2004" to use (Dietrich et al. 2004). |
... |
Other arguments to pass to ste method. |
A vector of short term energy values
Dietrich C, Palm G, Riede K, Schwenker F (2004). “Classification of bioacoustic time series based on the combination of global and local decisions.” Pattern Recognition, 37(12), 2293–2305.
## Not run: ste(sheep, method="dietrich2004") ## End(Not run)
## Not run: ste(sheep, method="dietrich2004") ## End(Not run)
Dataset compiled from various sources for differing values of STP.
STP
STP
An object of class list
of length 2.
This function takes two spectra from seewave (or equivalent) and subtracts their values. The spectra must have the same bins.
subtractSpectra(s1, s2, coerceNegative = TRUE)
subtractSpectra(s1, s2, coerceNegative = TRUE)
s1 |
First spectrum |
s2 |
Second spectrum |
coerceNegative |
Sets any values below zero to zero in output. |
A spectrum of s1 - s2
## Not run: subtractSpectra(spec1, spec2) subtractSpectra(spec1, spec2, coerceNegative=TRUE) ## End(Not run)
## Not run: subtractSpectra(spec1, spec2) subtractSpectra(spec1, spec2, coerceNegative=TRUE) ## End(Not run)
Generates a frequency swept sine wave (either linear or logarithmic) and returns it as a Wave object or vector.
sweptsine( f0 = 100, f1 = 2500, mode = "linear", sweep.time = 1, time.unit = "seconds", samp.rate = 44100, output = "wave", ... )
sweptsine( f0 = 100, f1 = 2500, mode = "linear", sweep.time = 1, time.unit = "seconds", samp.rate = 44100, output = "wave", ... )
f0 |
Start frequency |
f1 |
End frequency |
mode |
One of "linear", "log" |
sweep.time |
Duration of swept wave |
time.unit |
One of "seconds", "samples" |
samp.rate |
Sample rate of swept wave |
output |
"wave" for a Wave object, or "vector" |
... |
Additional arguments to pass to data2Wave |
A swept wave object of the type specified in output.
#Generate a swept sine wave between 0Hz and 10kHz. w <- sweptsine(0, 10e3) #Generate a swept sine wave between 0Hz and 10kHz and normalise it. w <- normalise(sweptsine(0, 10e3)) #Generate a stereo swept sine wave between 100Hz and 1KHz. w <- tuneR::stereo(sweptsine(100, 1e3)) #Generate an exponentially swept sine wave between 100Hz and 1KHz. w <- sweptsine(100, 1e3, mode="log")
#Generate a swept sine wave between 0Hz and 10kHz. w <- sweptsine(0, 10e3) #Generate a swept sine wave between 0Hz and 10kHz and normalise it. w <- normalise(sweptsine(0, 10e3)) #Generate a stereo swept sine wave between 100Hz and 1KHz. w <- tuneR::stereo(sweptsine(100, 1e3)) #Generate an exponentially swept sine wave between 100Hz and 1KHz. w <- sweptsine(100, 1e3, mode="log")
The TaggedWave class extended the Wave class from the tuneR package so that it can include extended metadata and the results of analyses.
metadata
A list for storing metadata.
analyses
A list for storing analyses.
The TaggedWaveMC class extended the WaveMC class from the tuneR package so that it can include extended metadata and the results of analyses.
metadata
A list for storing metdata.
analyses
A list for storing analyses.
This function takes a Wave
/WaveMC
object (or a list of such objects) and
returns a corresponding tagged version (TaggedWave
or TaggedWaveMC
).
tagWave(w, origin = "user")
tagWave(w, origin = "user")
w |
A |
origin |
The origin of the object (default "user"). |
A TaggedWave
or TaggedWaveMC
object (or list of such objects).
An S4 class to represent a TimeRegion within a Wave object.
from
Start position
to
End position
unit
Time unit (one of seconds, minutes, hours)
Calculates the number of samples for a given duration of a wave
tSamples(time = 1, wave = NULL, samp.rate = NULL)
tSamples(time = 1, wave = NULL, samp.rate = NULL)
time |
The duration in seconds |
wave |
A Wave object containing pulses |
samp.rate |
Integer sampling rate |
Number of samples
tSamples(10, samp.rate=44100) ## Not run: tSamples(10, wave=sheep) ## End(Not run)
tSamples(10, samp.rate=44100) ## Not run: tSamples(10, wave=sheep) ## End(Not run)
Typical volumes of everyday things.
typicalVolume(thing = NA_character_)
typicalVolume(thing = NA_character_)
thing |
Volume of thing, if missing then returns all volumes |
Typical volume of thing in dBA, or if no thing parameter a data frame of all volumes
typicalVolume() typicalVolume("rocket launch")
typicalVolume() typicalVolume("rocket launch")
Given a timezone offset in hours returns a rotation in radians to apply to values for a diel plot.
tzRot(tz, init = pi)
tzRot(tz, init = pi)
tz |
Timezone numeric |
init |
Initial rotation. Defaults to pi. |
This function takes a TaggedWave/TaggedWaveMC object (or a list of such objects) and returns a corresponding Wave/WaveMC object (or list of such objects).
untagWave(w)
untagWave(w)
w |
A TaggedWave or TaggedWaveMC object (or list of such objects). |
A Wave or WaveMC object.
## Not run: w <- noise("white") tw <- tagWave(w) w2 <- untagWave(tw) ## End(Not run)
## Not run: w <- noise("white") tw <- tagWave(w) w2 <- untagWave(tw) ## End(Not run)
Used to upsample a Wave object. The upsampled sample rate must be an natural multiple of the current sample rate.
upsample(wave, upsample.rate, method = "basic")
upsample(wave, upsample.rate, method = "basic")
wave |
Wave object to upsample. |
upsample.rate |
The sample rate to upsample to. |
method |
"basic" for linear, or a function to interpolate NAs in a vector |
A resampled Wave object
wave <- tuneR::sine(4000, samp.rate=44100) wave2 <- upsample(wave, 88200)
wave <- tuneR::sine(4000, samp.rate=44100) wave2 <- upsample(wave, 88200)
Helper function to test that the input is a Wave object. Will create an error if not.
validateIsWave(wave)
validateIsWave(wave)
wave |
Object to test |
A WaveFilter
object is an object containing information necessary for the
filterWave()
function to apply the filter to a Wave
or TaggedWave
object. This is designed to allow a pipe operator (either magrittr or base R)
to be used to apply filters to a Wave in a pipeline. If used with a
TaggedWave
object the function adds information to the processing
slot
documenting its action.
description
Description of the filter.
func
Name of function.
params
List of additional parameters to pass to the function.
Separates a Wave object into windows of a defined length and runs a function on the window section. Windows may overlap, and the function can make use of 'parallel' package for multi-core processing. It will also show a progress bar if the 'pbapply' package is installed.
windowing( wave, window.length = 1000, FUN, window.overlap = 0, bind.wave = FALSE, complete.windows = TRUE, cluster = NULL, ... )
windowing( wave, window.length = 1000, FUN, window.overlap = 0, bind.wave = FALSE, complete.windows = TRUE, cluster = NULL, ... )
wave |
A Wave object or filename. Using filenames may save loading an entire large file into memory. |
window.length |
The length of the analysis window (in samples). |
FUN |
FUN to be applied to windows. |
window.overlap |
The overlap between successive windows (in samples), a negative value will result in a gap between windows. |
bind.wave |
If TRUE and FUN returns wave objects, then these are combined into a single object |
complete.windows |
If TRUE (default) the final window will not be processed unless it has a length equal to window.length. |
cluster |
A cluster form the 'parallel' package for multi-core computation. |
... |
Additional parameters to FUN |
## Not run: windowing(wave, window.length=1000, FUN=duration, window.overlap=0, bind.wave=TRUE) ## End(Not run)
## Not run: windowing(wave, window.length=1000, FUN=duration, window.overlap=0, bind.wave=TRUE) ## End(Not run)
Save a time region defined by an Annotation object as a Wave file
writeAnnotationWave(annotation, wave = NULL)
writeAnnotationWave(annotation, wave = NULL)
annotation |
An Annotation object. |
wave |
(Optional) A Wave object, if not given will load the wave file from Annotation filename. |
Writes a list of Annotation
objects to an Audacity label file.
Internally this uses the write.audacity()
function from the seewave
package (Sueur et al. 2008).
writeAudacityLabels(annotations, file)
writeAudacityLabels(annotations, file)
annotations |
A list of |
file |
Path to the Audacity label file. |
Sueur J, Aubin T, Simonis C (2008). “Seewave, a free modular tool for sound analysis and synthesis.” Bioacoustics, 18(2), 213–226.
Given an object that can be coerced to POSIXlt, return the fraction of a year represented by the object.
yearlyFraction(t, year = 2022, input = "POSIX", unit = "radians")
yearlyFraction(t, year = 2022, input = "POSIX", unit = "radians")
t |
Object to be converted to a fraction |
year |
Year to calculate fractions of (allows for leap years) |
input |
One of POSIXlt (default) |
unit |
If set to radians outputs a position around a circle. If set to fraction outputs the raw fraction. |
Generates monthly labels for a yearlyPlot()..
yearlyLabels()
yearlyLabels()
ToDO......
yearlyPlot( year = 2022, lat, lon, limits = c(0, 2), plot = NULL, method = "plotrix", legend = F )
yearlyPlot( year = 2022, lat, lon, limits = c(0, 2), plot = NULL, method = "plotrix", legend = F )
year |
Year to plot (allows for leap years). |
lat |
Numeric latitude. |
lon |
Numeric longitude. |
limits |
Plotting limits of the daylight regions, default to c(1,2) |
plot |
Character vector of components to plot |
method |
Plotting library to use |
legend |
Whether to show a legend |
Generates positions for monthly labels of a dielPlot() in radians. The positions can either be for the start of the month, or middle of the month.
yearlyPositions(year = 2022, format = "months")
yearlyPositions(year = 2022, format = "months")
year |
Year to calculate |
format |
One of months, mid-months, days |
The function allows for leap years if the year parameter is provided.
Returns a vector of the position (in samples) of zero crossings in a Wave object
zerocross(wave)
zerocross(wave)
wave |
A Wave object |
A vector of zero crossing locations
## Not run: zerocross(sheep) ## End(Not run)
## Not run: zerocross(sheep) ## End(Not run)
This function takes a spectrum from seewave and creates a new zero-valued spectrum with the same structure.
zeroSpectrum(s1)
zeroSpectrum(s1)
s1 |
Spectrum to emulate the structure of. |
A zero-valued spectrum.
## Not run: zeroSpectrum(spec) ## End(Not run)
## Not run: zeroSpectrum(spec) ## End(Not run)