Setting up your folder structure
While most of ARUtools
focuses on processing recordings
once they are transferred from ARUs, setting up a folder structure can
greatly increase efficiency in transferring files.
To set up a folder structure you will need the hierarchical structure you wish to use and the list of sites/arus you are processing.
site_list <-
example_sites |>
tidyr::separate(Sites, into = c("plot", "site"), sep = "_", remove = F) |>
dplyr::select(site_id = Sites, plot, site)
tmp_dir <- tempdir(check = T) |> paste0("/ARUtools/")
dir.create(tmp_dir)
create_directory_structure(
hexagons = site_list$plot,
units = site_list$site_id,
base_dir = tmp_dir
)
This should create a series of folders with plot at the main level and site in the subdirectory below that.
list.dirs(tmp_dir, full.names = F)
Note that this will not work for all project structures and you should think carefully about how you want to set up your file names, folder structure and spatial information before you deploy any ARUs.
Wind processing
One issue that can cause difficulty in interpretation of acoustic recordings is wind. Wind can mask bird songs and even is a potential danger to interpreters’ ears.
The University Of Salford Acoustics Research Centre developed a softare program WindNoiseDetection that detects wind in wave files.
I have developed a fork of the software that has added the ability to run multiple files at once using parallel processing and to provide a list of files to process.
Running the program requires fairly complex setup in Windows as is
uses C
and C++
and requires
Cygwin
to run.
However if you do get it running, ARUtools
includes a
couple helper functions to process your metadata and set it up for
running with WindNoiseDetection.
wind_files <-
wind_detection_pre_processing(
wav_files = example_clean$path,
output_directory = "./wind_files/",
site_pattern = create_pattern_site_id(
p_digits = c(2, 3), sep = "_",
s_digits = c(1, 2)
),
write_to_file = F, chunk_size = NULL
)
The output is a list of vectors that include the path to the wave
files (filePaths
), the input wave filenames
(filenames
), and the list of sites to append to the output
results (sites
).
Once you have run WindNoiseDetection
you can read the
results in using wind_detection_summarize_json()
.
example_json <- system.file("extdata", "P71-1__20210606T232500-0400_SS.json", package = "ARUtools")
wind_summary <- wind_detection_summarize_json(example_json)
dplyr::glimpse(wind_summary)
#> Rows: 1
#> Columns: 7
#> $ totalwindless <dbl> 268.58
#> $ pwindless <dbl> 0.8966715
#> $ n <int> 5
#> $ length <dbl> 299.53
#> $ mean_windless <dbl> 53.716
#> $ path <chr> "/cygdrive/P/Path/To/WaveFile/NL/P71/P71-1/20210606_Napk…
#> $ jsonF <chr> "P71-1__20210606T232500-0400_SS.json"
Assign tasks
To assign tasks you will need to either download the task template
from ‘WildTrax’ or alternatively you can use the new
wildRtrax::wt_make_aru_tasks()
function.
You will also need a template for observers with the number of hours they will be interpreting. This doesn’t have to match exactly the time in a project as the relative amounts are used.
in_tasks <- fs::file_temp("Input_task_file", ext = ".csv")
task_template <- wildRtrax::wt_make_aru_tasks(
example_clean |>
dplyr::mutate(
recording_date_time = date_time,
file_path = path, location = site_id,
length_seconds = 300
),
output = in_tasks,
task_method = "1SPT", task_length = 300
)
template_observers
#> # A tibble: 4 × 2
#> transcriber hrs
#> <chr> <dbl>
#> 1 Charles Dickens 5
#> 2 John Von Jovie 1
#> 3 John Yossarian 6.5
#> 4 Rodion Romanovich Raskolnikov 2.3
Once you have the files you need, you can run
wt_assign_tasks()
to randomly assign tasks to interpreters
based on the amount of effort they can put in.
task_output <- wt_assign_tasks(
wt_task_template_in = task_template,
wt_task_output_file = NULL,
interp_hours = template_observers,
interp_hours_column = hrs,
random_seed = 65416
)
task_output$task_summary
#> # A tibble: 4 × 5
#> transcriber hrs_assigned hrs phrs updated_hrs_remain
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 John Yossarian 1.08 6.5 0.439 5.42
#> 2 Rodion Romanovich Raskolnikov 1.08 2.3 0.155 1.22
#> 3 Charles Dickens 1.17 5 0.338 3.83
#> 4 John Von Jovie 0.167 1 0.0676 0.833
You can alternatively use the Shiny
app Shiny_select by running
the following:
shiny::runGitHub("dhope/Shiny_select")