Learn R Programming

callsync (version 0.2.3)

create.spec.object: create.spec.object

Description

Creates a tailored spectrogram (matrix) for spectrographic cross correlation.

Usage

create.spec.object(
  wave,
  wl = 512,
  ovl = 450,
  freq_range = c(0, 20000),
  plot_it = TRUE,
  thr_low = 1.5,
  thr_high = 3,
  sum_one = FALSE,
  method = "sd"
)

Value

Returns a numeric matrix with the spectrogram values.

Arguments

wave

wave object, e.g., from `load.wave` or `readWave`.

wl

numeric, window length in samples. Default is `512`.

ovl

numeric, overlap in samples. Default is `450`.

freq_range

numeric vector of length 2, the frequency range in Hz to return.

plot_it

logical, if `TRUE`, returns three-panel plot of wave form, envelope and spectrogram to current plotting window. Default is `FALSE`.

thr_low

numeric, the lower range (see `method`). Pixels with lower values are set to 0 for noise reduction.

thr_high

numeric, the upper range (see `method`). Pixels with higher values are set to `thr_high`.

sum_one

logical, if `TRUE` pixels are divided by the sum of all pixels, such that they sum to one.

method

character, either `sd` or `max`. If `sd`, pixels are standardised. If `max`, pixels are normalised.

Examples

Run this code
require(callsync)
require(seewave)
require(tuneR)
path_git = 'https://raw.githubusercontent.com'
path_repo = '/simeonqs/callsync/master/tests/testthat/files'
file_1 = '/wave_1.wav'
url_1 = paste0(path_git, path_repo, file_1)
local_file_1 = paste(tempdir(), file_1, sep = '/')
if(!file.exists(local_file_1))
  download.file(url_1, destfile = local_file_1, mode = 'wb',)
wave = readWave(local_file_1)
result = create.spec.object(wave, plot_it = FALSE)

Run the code above in your browser using DataLab