getAudioMetadata.Rd
Extract metadata of audio files from a given root folder.
getAudioMetadata( ROOTfolderpath, extension = ".wav", ignore = NULL, filter_folder = NULL, is_timestamp_filename = FALSE, format_timestamp_filename = "ymd_hms", timezone = "America/Sao_Paulo", export = NULL )
ROOTfolderpath | full path to folder where all audio files are (without a final slash). E.g. '/Users/you/Desktop' |
---|---|
extension | extension of audio files, either a single string or a vector with more than one extension. Currently it takes |
ignore | Should any audio be skipped, enter a string or a vector of strings that match the file name of such files E.g. if you want to ignore all audio with file names containing 'test', then input |
filter_folder | Should entire folders be ignored, pass a string with the main subfolder tag name, the one from which the audios should be read from. For instance, if you have recorded from 2 different hydrophones (say, PAM and hand-held) and have saved them in different folders (say, './PAM_recordings/', './Handheld_recordings/') and only want to extract the metadata of the hand-held hydrophones then set |
is_timestamp_filename | logical. If TRUE, retrieves the date and time from file names using the date formats "ymd_hms" "epoch" formats, defined in the argument |
format_timestamp_filename | character. Depending on the file name structure, choose between "ymd_hms" and "epoch". |
timezone | string. Add the correct timezone where the drone videos were taken, as per the R base notation (for additional information, see |
export | full path and .csv filename to where the metadata should be exported to. E.g. export = '/Users/you/Database/camera_metadata.csv'. Should the metadata not be exported, |
a data frame with the metadata of audio files: "UTC_datetime_dec", "UTC_datetime_sec","UTC_datetime_min","audio.UTC_start_datetime","audio.UTC_end_datetime","audio.local_start_datetime" ,"audio.local_end_datetime","audio.date", "audio.folder" ,"audio.filename","audio.duration" , "audio.file_size_MB" ,"audio.num_channels" ,"audio.sample_rate" ,"audio.average_bytespersecond" ,"audio.bitspersample".
The function is designed to deal with the metadata from audios of hydrophones but it could work with other audio recording types. You can also edit the exiftool to extract metadata of other audio files (see line 121
).
Mauricio Cantor
if (FALSE) { audio_metadata = getPhotoMetadata(ROOTfolderpath = '/Desktop/you/data', extension='.wav', ignore = NA, filter_folder = NA, timezone='America/Sao_Paulo', export = NA) }