View source: R/segment_utilities.R
| segment_ann | R Documentation |
Takes a table of syllable annotations, formatted as the syllables
dataframe returned by segment, extracts the corresponding
audio segments, and saves each segment as a separate .wav file in a
subdirectory named "segment".
segment_ann(
syllables,
x,
samplingRate = NULL,
scale = NULL,
addSilence = 50,
path = NULL
)
syllables |
data frame with at least columns |
x |
path to a .wav or .mp3 file, a |
samplingRate |
sampling rate of |
scale |
maximum possible amplitude of |
addSilence |
silence added before and after each extracted segment, ms |
path |
optional full path to the directory in which to save the
extracted segments. If NULL, a subdirectory named "segment" is created
either in the folder containing the audio file (if |
If x is a path to an audio file, the default output directory is
segment inside the folder containing that file. If x is a
Wave object or a numeric vector, the default output directory is
segment inside the current working directory. Use path to
override the output location.
Does not return anything, just saves the files.
segment
sound = soundgen(nSyl = 3, sylLen = 100, pauseLen = 70,
pitch = 250, temperature = 0.001)
s = segment(sound, samplingRate = 16000, plot = FALSE)
s$syllables
# the annotation table should look like this, with start/end times in ms!
## Not run:
# extract and save all syllables
segment_ann(s$syllables, sound, samplingRate = 16000)
# save to a custom folder
segment_ann(s$syllables, sound, samplingRate = 16000,
path = '~/Downloads/temp_segment')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.