multiple_sounds {soundecology} | R Documentation |
Multiple sound files
Description
Function to extract the specified index from all the wav or flac files in a directory. The results, including the filename and wave technical details, are saved to a csv file. If the computer has multiple cores, it can run files in parallel.
Usage
multiple_sounds(directory, resultfile, soundindex, no_cores = 1,
flac = FALSE, from = NA, to = NA, units = NA, ...)
Arguments
directory |
a valid directory, readable by the user, that contains the wav files. |
resultfile |
name of the text file to which write the results in comma-separated values format. |
soundindex |
which index to calculate:
|
no_cores |
number of cores to use when calculating the indices. Can be |
flac |
logical variable to indicate that the files are in FLAC format. FLAC must be installed in the system (see note below). Uses the function |
from |
tells |
to |
tells |
units |
tells |
... |
additional variables to pass to the selected function. See each function's help for details. |
Note
FLAC stands for Free Lossless Audio Codec. Files in FLAC format have been compressed without destruction of data, which happens in lossy compression codecs like the popular MP3. Files can be between 40-60% of the size of the original wav file, although this value depends on the contents. For more information and to download FLAC, visit http://xiph.org/flac/
Examples
## Not run:
#Calculate the ACI of all the wav
# files in the directory "/home/user/wavs/"
# using the function acoustic_complexity
multiple_sounds(directory = "/home/user/wavs/",
resultfile = "/home/user/results.csv",
soundindex = "acoustic_complexity")
#Calculate the same as above using 12000Hz as the
# maximum frequency instead of the default.
multiple_sounds(directory = "/home/user/wavs/",
resultfile = "/home/user/results.csv",
soundindex = "acoustic_complexity", max_freq = 12000)
#Calculate the same as above using two cores
multiple_sounds(directory = "/home/user/wavs/",
resultfile = "/home/user/results.csv",
soundindex = "acoustic_complexity", no_cores = 2)
#Calculate the same as above using all the cores
# the computer has
multiple_sounds(directory="/home/user/wavs/",
resultfile = "/home/user/results.csv",
soundindex = "acoustic_complexity", no_cores = "max")
#Calculate the same as above using all but one cores
multiple_sounds(directory = "/home/user/wavs/",
resultfile = "/home/user/results.csv",
soundindex = "acoustic_complexity", no_cores = -1)
## End(Not run)