###########################################################
# convert stuff to included data
###########################################################
library(tidyverse)
mat_talk_full = audio::load.wave(here::here("data-raw", "jerry_mat_talk.wav"))
# enter audio start time and end time in seconds from the youtube video
get_audio_subset = function(audio_sample, start_time, end_time){
seconds = tibble(
index = 1:dim(audio_sample)[2],
seconds = seq(0, 242, length.out = max(index)))
indices = seconds %>%
summarize(start = which.min(abs(seconds - start_time)),
end = which.min(abs(seconds - end_time)))
audio_sample[, indices$start:indices$end]
}
sound_df =
read_csv(here::here("data-raw", "data_input.csv")) %>%
mutate(audio = map2(start_time, end_time, ~get_audio_subset(mat_talk_full, .x, .y)))
usethis::use_data(sound_df, overwrite = TRUE, internal = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.