Hi, I'm a beginner so maybe it's not a big issue.. but for me it is
I would like to read multiple MIDI files with the "readmidi" function (package "tuneR") and then convert every single file with the "getmidinotes" function into readable information . For this I built a loop that unfortunately doesn't work:
library(tuneR)
library(fs)
file_paths <- fs::dir_ls("path_to_the_folder_of_my_files")
file_paths
file_contents <- list()
for (i in seq_along(file_paths)) {
file_contents[[i]] <- readMidi(file = file_paths[[i]])
getMidiNotes(file_contents)
}
file_contents <- set_names(file_contents, file_paths)
I'm not sure if the function is in the right place! Maybe there ist the mistake? I got the following error massages:
"In readChar(con, elength[1]) : truncating string with embedded nuls"