Description Usage Arguments Examples
View source: R/track_extract.R
Takes a single audio file and exports a series of files of a given length. These excerpts are written to an output folder in the working directory. The files can either be gated samples of an increasing length or samples of a set length.
1 2 3 4 5 6 7 8 9 | track_extract(
path,
gate,
start = 0,
random,
excerpt_length,
n,
categorize = TRUE
)
|
path |
The path to the audio file to be created. Must be .mp3 or .wav |
gate |
TRUE/FALSE. If TRUE then n gated excerpts are created where the length of each exported excerpt is the length of the previously exported excerpt plus the length argument. If FALSE then n excerpts are created of the audio file where the length is equal to the length defined in the length argument |
start |
The time (in milliseconds) that the first excerpt should be taken from. |
random |
TRUE/FALSE. If TRUE then samples are taken from random start points after the specified start point throughout the audio file. If FALSE then samples are sequentially taken from the start point. If gate is TRUE then a random start point after the defined start is used |
excerpt_length |
The time (in milliseconds) of samples extracted/gates |
n |
The number of samples/gates to create |
categorize |
TRUE/FALSE. If TRUE extracts the name of the folder the audio file is immediately stored in and treats it as the category the audio belongs to and creates a corresponding folder in the output directory. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## Not run:
#' ## These examples are not reproducible path should be replaced witht the path to your audio files
#----
## Extract 7 1second excerpts from the beginning of the sad_song
extract_track(
path = "tracks/sad/sad_song.wav",
gate = FALSE,
start = 0,
random = TRUE,
excerpt_length = 1000,
n = 7,
categorize = T
)
## Randomly take 10 500ms excerpts from the beginning of the happy_song
extract_track(
path = "tracks/happy/happy_song.wav",
gate = FALSE,
start = 0,
random = TRUE,
excerpt_length = 1000,
n = 10,
categorize = T
)
## Extract 5 gates of 200ms from a random start point of the sad_song
gate_track(
path = "tracks/sad/sad_song.wav",
gate = TRUE,
start = 0,
random = TRUE,
excerpt_length = 200,
n = 5,
categorize = T
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.