warbleR (version 1.1.25)

manualoc: Interactive view of spectrograms

Description

manualoc produces an interactive spectrographic view in which the start and end times of acoustic signals can be measured.

Usage

manualoc(wl = 512, flim = c(0,12), seltime = 1, tdisp = NULL, reccomm =
  FALSE, wn = "hanning", title = TRUE, selcomm = FALSE, osci = FALSE, player =
  NULL, pal = reverse.gray.colors.2, path = NULL, flist = NULL, 
  fast.spec = FALSE, ext.window = TRUE, width = 15, height = 5)

Arguments

wl

A numeric vector of length 1 specifying the spectrogram window length. Default is 512.

flim

A numeric vector of length 2 specifying the frequency limit (in kHz) of the spectrogram, as in the function spectro. Default is c(0,12).

seltime

A numeric vector of length 1 indicating the time interval in seconds at which the spectrograms are produced with higher resolution (ovlp = 70) and oscillograms (if osci = TRUE). Default is 1 second.

tdisp

A numeric vector of length 1 specifying the length in seconds of the total sound file to be displayed. Default is NULL which displays the full sound file.

reccomm

Logical argument. If TRUE pops up a comment window at the end of each sound file. The comment needs to be quoted. Default is FALSE.

wn

A character vector of length 1 specifying the window function (by default "hanning"). See function ftwindow for more options.

title

Logical argument. If TRUE the name of the sound file will be printed as the main title of the spectrogram window. Default is TRUE

selcomm

Logical argument. If TRUE pops up a comment window after each selection. The comment is printed as a label on the selected unit. The comment must be quoted. Default is FALSE

osci

Logical argument. If TRUE adds a oscillogram whenever the spectrograms are produced with higher resolution (see seltime). Default is FALSE.

player

Path to or name of a program capable of playing a wave file by invocation from the command line. If under Windows and no player is given, windows player will be chosen as the default. "vlc" works in Linux if vlc player is installed. The external program must be closed before resuming analysis. Default is NULL.

pal

A color palette function to be used to assign colors in the plot, as in spectro. Default is reverse.gray.colors.2. See Details.

path

Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.

flist

character vector or factor indicating the subset of files that will be analyzed. Ignored if X is provided.

fast.spec

Logical. If TRUE then image function is used internally to create spectrograms, which substantially increases performance (much faster), although some options become unavailable, as collevels, and sc (amplitude scale). This option is indicated for signals with high background noise levels. Palette colors gray.1, gray.2, gray.3, topo.1 and rainbow.1 (which should be imported from the package monitoR) seem to work better with 'fast' spectrograms. Palette colors gray.1, gray.2, gray.3 offer decreasing darkness levels.

ext.window

Logical. If TRUE then and external graphic window is used. Default dimensions can be set using the 'width' and 'height' arguments. Default is TRUE.

width

Numeric of length 1 controlling the width of the external graphic window. Ignored if ext.window = FALSE. Default is 15.

height

Numeric of length 1 controlling the height of the external graphic window. Ignored if ext.window = FALSE. Default is 5.

Value

.csv file saved in the working directory with start and end time of selections.

Details

This function may work very slowly with middle and large size sound files. We strongly suggest using other software tools (e.g. Raven, Avisoft) to create selection tables manually.

Users can zoom-in a specific sound file segment by clicking at the start and end (left side and right side) of the segment. To select the start and end of a vocalization unit the users need to click at the end and then at the start (right side and left side) of the unit. In addition, 6 "buttons" are provided at the upper right side of the spectrogram that allow to display a full view of the spectrogram ("Full view"), go back to the previous view ("Previous view"), stop the analysis ("Stop"), go to the next sound file ("Next rec"), play the current view using external software ("Play", see "player" argument), or delete the last manual selection in the current sound file ("Delete"). When a unit has been selected, the function plots a red circle with the selection number in the middle point of the selection in the spectrogram. It also plots vertical dotted lines at the start and end of the selection. The circle and lines "disappear" when the selection is deleted ("Delete" button). Only the last selection can be deleted.

The function produces a .csv file (manualoc_output.csv) with information about the .wav file name, selection number, start and end time, selection comment (selcomm), and sound file comment (reccomm). The file is saved in the working directory and is updated every time the user moves into the next sound file (Next rec "button") or stop the process (Stop "button"). When resuming the process (after "stop" and re-running the function in the same working directory), the function will keep the previous selections and will only pick up .wav files that are not present in the .csv file (not previously analyzed). When users go to the next sound file (Next rec "button") without making any selection the file is still included in the .csv file, with NA's in the "end", "time" and "selec" field.

Windows length (wl) controls the temporal and frequency precision of the spectrogram. A high "wl" value increases the frequency resolution but reduces the temporal resolution, and vice versa. Any color palette that comes with the seewave package can be used: temp.colors, reverse.gray.colors.1, reverse.gray.colors.2, reverse.heat.colors, reverse.terrain.colors, reverse.topo.colors, reverse.cm.colors, heat.colors, terrain.colors, topo.colors, cm.colors. The function is slow when working on files of length > 5min. In most cases other sound analysis software for manually selecting acoustic signals (e.g. Raven, Syrinx) should be preferred.

See Also

seltailor

Examples

Run this code
# NOT RUN {
# save wav file examples
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
writeWave(Phae.long4, file.path(tempdir(), "Phae.long4.wav"))

manualoc(wl = 300, path = tempdir())
# need to use the buttoms to manipulate function
# check working directory for .csv file after stopping function
#check here:
tempdir()
# }

Run the code above in your browser using DataLab