Learn R Programming

soundgen (version 2.7.2)

identifyAndPlay: Identify and play

Description

Internal soundgen function. NB: even built-in examples of identify() not working in R 4.4.1 (points not identified).

Usage

identifyAndPlay(
  x,
  y = NULL,
  data = NULL,
  audioFolder,
  to = 5,
  plot = FALSE,
  pch = 19,
  ...
)

Arguments

x, y

plot coordinates

data

dataframe from which x & y are taken, also containing a column called "file"

audioFolder

path to audio files

to

play only the first ... s

plot

if TRUE, plots the index of clicked points

pch

symbol for marking clicked points

...

other arguments passed to identify()

Details

A wrapper around identify() intended to play the sound corresponding to a clicked point.

Examples

Run this code
if (FALSE) {
msf = modulationSpectrum('~/Downloads/temp', plot = FALSE)

# Method 1: provide path to folder, leave data = NULL
plot(msf$summary$amMsFreq_median, msf$summary$amMsDep_median)
soundgen:::identifyAndPlay(msf$summary$amFreq_median, msf$summary$amDep_median,
  audioFolder = '~/Downloads/temp',
  to = 2,
 plot = TRUE,
 pch = 19)

# Method 2:
x = msf$summary$amMsFreq_median
y = msf$summary$amMsDep_median
plot(x, y)
soundgen:::identifyAndPlay(x, y, data = msf$summary,
  audioFolder = '~/Downloads/temp',
  to = 2,
  plot = FALSE,
  pch = 8)
}

Run the code above in your browser using DataLab