I think I found the bug that I will fix quickly (but not tomorrow) in a new release.
Meanwhile can you try with sourcing the following update of audiomoth() after having loaded seewave
audiomoth <- function(x, # a character vector, not a Wave object
tz = "" # a character vector defining a time zone specification, see as.POSIXct(), argument 'tz'
)
{
if (!is.character(x)) stop("'x' should be of mode character.")
options(stringsAsFactors = FALSE)
res <- data.frame(year = numeric(0), month = numeric(0), day = numeric(0),
hour = numeric(0), min = numeric(0), sec = numeric(0),
time = numeric(0))
N <- length(x) ## number of file names
for (i in 1:N)
{
tmp <- x[i]
n <- nchar(tmp)
## check if .WAV or .wav file
extension <- substr(tmp, start = n-3, stop = n)
if(extension != ".wav" & extension != ".WAV"){warning(paste("File '", tmp, "' is not a '.wav' file", sep=""))}
else{
if(nchar(tmp)==12) ## hexadecimal format
{
hex <- unlist(strsplit(tmp, extension))
num <- strtoi(hex, base = 16)
time <- as.POSIXct(num, tz=tz, origin = "1970-01-01")
year <- as.numeric(format(time, "%Y"))
month <- as.numeric(format(time, "%m"))
day <- as.numeric(format(time, "%d"))
hour <- as.numeric(format(time, "%H"))
min <- as.numeric(format(time, "%M"))
sec <- as.numeric(format(time, "%S"))
}
else if(nchar(tmp)==19)
{
year <- substr(tmp, start = 1, stop = 4)
month <- substr(tmp, start = 5, stop = 6)
day <- substr(tmp, start = 7, stop = 8)
hour <- substr(tmp, start = 10, stop = 11)
min <- substr(tmp, start = 12, stop = 13)
sec <- substr(tmp, start = 14, stop = 15)
time <- strptime(paste(year,month,day,hour,min,sec), "%Y%m%d%H%M%S")
}
res <- rbind(res, data.frame(year, month, day, hour, min, sec, time))
}
}
return(res)
options(stringsAsFactors = TRUE)
}