Learn R Programming

warbleR (version 1.1.2)

sig2noise: Measure signal-to-noise ratio

Description

sig2noise measures signal-to-noise ratio across multiple files.

Usage

sig2noise(X, mar, parallel = 1, path = NULL)

Arguments

X
Data frame with results from manualoc or any data frame with columns for sound file name (sound.files), selection number (selec), and start and end time of signal (start and end).
mar
numeric vector of length 1. Specifies the margins adjacent to the start and end points of selection over which to measure noise.
parallel
Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing). Not available in Windows OS.
path
Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.

Value

Data frame similar to autodetec output, but also includes a new variable with the signal-to-noise values.

Details

Signal-to-noise ratio (SNR) is a measure of the level of a desired signal compared to background noise. The function divides the mean amplitude of the signal by the mean amplitude of the background noise adjacent to the signal. A general margin to apply before and after the acoustic signal must be specified. Setting margins for individual signals that have been previously clipped from larger files may take some optimization, as for calls within a larger file that are irregularly separated. When margins overlap with another acoustic signal nearby, the signal-to-noise ratio (SNR) will be inaccurate. Any SNR less than or equal to one suggests background noise is equal to or overpowering the acoustic signal. snrspecs can be used to troubleshoot different noise margins.

Examples

Run this code
## Not run: 
# # First set temporary folder
# setwd(tempdir())
# 
# data(list = c("Phae.long1","manualoc.df"))
# writeWave(Phae.long1, "Phae.long1.wav") #save sound files 
# 
# # specifying the correct margin is important
# # use snrspecs to troubleshoot margins for sound files
# sig2noise(manualoc.df[grep("Phae.long1", manualoc.df$sound.files), ], mar = 0.2)
# 
# # this smaller margin doesn't overlap neighboring signals
# sig2noise(manualoc.df[grep("Phae.long1", manualoc.df$sound.files), ], mar = 0.1)
# ## End(Not run)

Run the code above in your browser using DataLab