diff --git a/warbleR_xeno-canto/Phaethornis-longirostris-154072-.pdf b/warbleR_xeno-canto/Phaethornis-longirostris-154072-.pdf new file mode 100644 index 0000000..44910a4 Binary files /dev/null and b/warbleR_xeno-canto/Phaethornis-longirostris-154072-.pdf differ diff --git a/warbleR_xeno-canto/Phaethornis-longirostris-154072.wav b/warbleR_xeno-canto/Phaethornis-longirostris-154072.wav new file mode 100644 index 0000000..2770470 Binary files /dev/null and b/warbleR_xeno-canto/Phaethornis-longirostris-154072.wav differ diff --git a/warbleR_xeno-canto/Phaethornis-longirostris-154129-.pdf b/warbleR_xeno-canto/Phaethornis-longirostris-154129-.pdf new file mode 100644 index 0000000..fa33fee Binary files /dev/null and b/warbleR_xeno-canto/Phaethornis-longirostris-154129-.pdf differ diff --git a/warbleR_xeno-canto/Phaethornis-longirostris-154129.wav b/warbleR_xeno-canto/Phaethornis-longirostris-154129.wav new file mode 100644 index 0000000..9c09ffb Binary files /dev/null and b/warbleR_xeno-canto/Phaethornis-longirostris-154129.wav differ diff --git a/warbleR_xeno-canto/Phaethornis-longirostris-154138-.pdf b/warbleR_xeno-canto/Phaethornis-longirostris-154138-.pdf new file mode 100644 index 0000000..de9f90f Binary files /dev/null and b/warbleR_xeno-canto/Phaethornis-longirostris-154138-.pdf differ diff --git a/warbleR_xeno-canto/Phaethornis-longirostris-154138.wav b/warbleR_xeno-canto/Phaethornis-longirostris-154138.wav new file mode 100644 index 0000000..40efe0c Binary files /dev/null and b/warbleR_xeno-canto/Phaethornis-longirostris-154138.wav differ diff --git a/warbleR_xeno-canto/warbleR_xeno-canto.r b/warbleR_xeno-canto/warbleR_xeno-canto.r index c7c721b..489c79a 100644 --- a/warbleR_xeno-canto/warbleR_xeno-canto.r +++ b/warbleR_xeno-canto/warbleR_xeno-canto.r @@ -67,4 +67,82 @@ write.csv(Phae.lon.LS, "Phae_lon.LS.csv", row.names = FALSE) # to speed up downstream analyses in the vignette series mp32wav(samp.rate = 22.05) # Use checkwavs to see if wav files can be read -check_wavs() \ No newline at end of file +check_wavs() + +## +# Make long spectrograms of whole recordings +## + +# Create a vector of all the recordings in the directory +wavs <- list.files(pattern = "wav$") +# Print this object to see all sound files +wavs +# How long are these files? this will determine number of pages returned by full_spectrograms +duration_wavs(wavs) +# ovlp = 10 to speed up function +# tiff image files are better quality and are faster to produce +full_spectrograms(flist = wavs, ovlp = 10, it = "tiff") +# We can zoom in on the frequency axis by changing flim, +# the number of seconds per row, and number of rows +full_spectrograms(flist = wavs, flim = c(2, 10), sxrow = 6, rows = 15, ovlp = 10, it = "tiff") + +## +# Once satisfied with the argument settings we can make long spectrograms for all the sound files. +## + +# Make long spectrograms for the xeno-canto sound files +full_spectrograms(flim = c(2, 10), ovlp = 10, sxrow = 6, rows = 15, it = "jpeg", flist = wavs) +# Concatenate full_spectrograms image files into a single PDF per recording +# full_spectrograms images must be jpegs to do this +full_spectrogram2pdf(keep.img = FALSE, overwrite = TRUE) + +## +# Automatically detect signals with auto_detect +## + +# Select a subset of sound files +# Reinitialize the wav object +wavs <- list.files(pattern = ".wav$", ignore.case = TRUE) +# Set a seed so we all have the same results +set.seed(1) +sub <- wavs[sample(1:length(wavs), 3)] + +## +# Run auto_detec() on subset of recordings +## + +# Once we’re satisfied with the detection, we can run the auto_detec on all the +# recordings, removing the argument flist (so auto_detec runs over all wav files +# in the working directory). We will also save the temporal output in an object. +# Once we’re satisfied with the detection, we can run the auto_detec on all the +# recordings, removing the argument flist (so auto_detec runs over all wav files +# in the working directory). We will also save the temporal output in an object. +Phae.ad <- auto_detec( + path = wd, + threshold = 20, # amplitude threshold in % + ssmooth = 900, # amplitude envelope with sum smooth + bp = c(2, 10), # bandpass filter (between 2 and 10 kHz) + wl = 300, # window for ffilter bandpass + parallel = 6*2 # how many cores shall be used in parallel (*2 due to hyper threading) +) + +# Let’s look at the number of selections per sound file +table(Phae.ad$sound.files) + +# create an image with all detections +full_spectrograms(flim = c(2, 10), + ovlp = 10, + sxrow = 6, + rows = 15, + it = "jpeg", + flist = wavs, + X = auto_detec( + path = wd, + threshold = 20, + ssmooth = 900, + bp = c(2, 10), + wl = 300, + parallel = 6*2)) + +# combine the image into a single pdf per species like before +full_spectrogram2pdf(keep.img = FALSE, overwrite = TRUE) \ No newline at end of file