splitw {voice}R Documentation

Split Wave

Description

Split WAV files either in fromWav directory or using (same names) RTTM files/subdirectories as guidance.

Usage

splitw(
  fromWav,
  fromRttm = NULL,
  toSplit = NULL,
  autoDir = FALSE,
  subDir = FALSE,
  output = "wave",
  filesRange = NULL,
  full.names = TRUE,
  recursive = FALSE,
  silence.gap = 0.5
)

Arguments

fromWav

Either WAV file or directory containing WAV files.

fromRttm

Either RTTM file or directory containing RTTM files. Default: NULL.

toSplit

A directory to write generated files. Default: NULL.

autoDir

Logical. Must the directories tree be created? Default: FALSE. See 'Details'.

subDir

Logical. Must the splitted files be placed in subdirectories? Default: FALSE.

output

Character string, the class of the object to return, either 'wave' or 'list'.

filesRange

The desired range of directory files (default: NULL, i.e., all files). Must be TRUE only if fromWav is a directory.

full.names

Logical. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned. (default: TRUE) Used by base::list.files.

recursive

Logical. Should the listing recursively into directories? (default: FALSE) Used by base::list.files. Inactive if fromWav is a file.

silence.gap

The silence gap (in seconds) between adjacent words in a keyword. Rows with tdur <= silence.gap are removed. (default: 0.5)

Details

When autoDir = TRUE, the following directories are created: '../mp3','../rttm', '../split' and '../musicxml'. Use getwd() to find the parent directory '../'.

Value

Splited audio files according to the correspondent RTTM file(s). See 'voice::diarize'.

See Also

voice::diarize

Examples

## Not run: 
library(voice)

urlWav <- 'https://raw.githubusercontent.com/filipezabala/voiceAudios/main/wav/sherlock0.wav'
destWav <- paste0(tempdir(), '/sherlock0.wav')
download.file(urlWav, destfile = destWav)

urlRttm <- 'https://raw.githubusercontent.com/filipezabala/voiceAudios/main/rttm/sherlock0.rttm'
destRttm <- paste0(tempdir(), '/sherlock0.rttm')
download.file(urlRttm, destfile = destRttm)

splitDir <- paste0(tempdir(), '/split')
dir.create(splitDir)
splitw(destWav, fromRttm = destRttm, toSplit = splitDir)

dir(splitDir)

## End(Not run)

[Package voice version 0.4.21 Index]