Learn R Programming

warbleR (version 1.1.13)

read_wave: A wrapper for tuneR's readWave that read sound files listed within selection tables

Description

read_wave A wrapper for tuneR's readWave function that read sound files listed within selection tables

Usage

read_wave(X, index, from = X$start[index], to = X$end[index], header = FALSE, path = NULL)

Arguments

X

'data.frame', 'selection_table' or 'extended_selection_table' containing columns for sound file name (sound.files), selection number (selec), and start and end time of signals (start and end). Low and high frequency columns are optional. Default is NULL.

index

Index of the selection in 'X' that will be read. Ignored if 'X' is NULL.

from

Where to start reading, in seconds. Default is X$start[index].

to

Where to stop reading, in seconds. Default is X$end[index].

header

If TRUE, only the header information of the Wave object is returned, otherwise (the default) the whole Wave object.

path

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

Value

An object of class "Wave".

Details

The function is a wrapper for readWave that read sound files listed within selection tables ignores file extension mismatches, a common mistake when reading wave files. It is also used internally by warbleR functions to read wave objects from extended selection tables (see selection_table for details).

Examples

Run this code
# NOT RUN {
{
# First set temporary folder
# setwd(tempdir())

# write wave files with lower case file extension
data(list = c("Phae.long1"))
writeWave(Phae.long1,"Phae.long1.wav")

read_wave(X = selec.table, index  =  1)
}
# }

Run the code above in your browser using DataLab