Learn R Programming

emuR (version 2.5.0)

convert_BPFCollection: Convert a Bas Partitur File Collection (audio and BAS Partitur files) to an emuDB

Description

Converts a Bas Partitur File Collection to an emuDB. Expects a collection of the following form: One master directory <sourceDir> containing any number of file pairs (= bundles). A file pair consists of an audio file with the extension <audioExt> and a BPF file with the extension <bpfExt>. Apart from extensions, the names of corresponding audio and BPF files must be identical. Each BPF file is converted into an emuDB annot file. An emuDB config file matching the data base is created after parsing.

Usage

convert_BPFCollection(
  sourceDir,
  targetDir,
  dbName,
  bpfExt = "par",
  audioExt = "wav",
  extractLevels = NULL,
  refLevel = NULL,
  newLevels = NULL,
  newLevelClasses = NULL,
  segmentToEventLevels = NULL,
  unifyLevels = NULL,
  verbose = TRUE
)

Arguments

sourceDir

path to the directory containing the Bas Partitur File collection

targetDir

directory where the new emuDB should be saved; if it does not exist, the function tries to create one

dbName

name given to the new emuDB

bpfExt

extension of BPF files (default = "par")

audioExt

extension of audio files (default = "wav")

extractLevels

optional vector containing the names of levels that should be extracted. If NULL (the default) all levels found in the BPF collection are extracted.

refLevel

optional name of level used as reference for symbolic links. If NULL (the default), a link-less data base is created.

newLevels

optional vector containing names of levels in the BPF collection that are not part of the standard BPF levels. See http://www.bas.uni-muenchen.de/forschung/Bas/BasFormatseng.html#Partitur_tiersdef for details on standard BPF levels.

newLevelClasses

optional vector containing the classes of levels in the newLevels vector as integers. Must have the same length and order as newLevels.

segmentToEventLevels

optional vector containing names of segment levels with overlapping segments. The parser treats segments on these levels as events (SEGMENT xyz becomes EVENT xyz_start and EVENT xyz_end). If a level contains segmental overlap but is not in this vector, the parser will throw an error. If overlap resolution leads to event overlap (e.g. if one segment's end coincides with the next segment's start), an error is thrown either way. If in doubt whether a level contains segmental overlap, try running the converter with segmentToEventLevels = NULL and see whether an error occurs.

unifyLevels

optional vector containing names of levels to be unified with the reference level. This means that they are treated as labels of the reference level rather than independent items. At the moment, only purely symbolic (class 1) levels can be unified. Links between the reference level and levels in unifyLevels must be one-to-one.

verbose

display infos, warnings and show progress bar

See Also

convert_TextGridCollection, convert_legacyEmuDB

Examples

Run this code
if (FALSE) {

##################################
# prerequisite: a dir with equally named file pairs *.wav and *.par
# (see ?create_emuRdemoData on how to create a demo)

# convert file pairs *.wav and *.par in /tmp/BPF_collection into emuRDB 'NewEmuR' in 
# dir /tmp/DirNewEmuR; the tier 'ORT' acts as the (word) reference tier; the 
# tier 'KAN' is one-to-one bound to 'ORT' as a label
convert_BPFCollection("/tmp/BPF_collection","/tmp/DirNewEmuR",'NewEmuR',
        bpfExt='par',audioExt='wav',refLevel='ORT',unifyLevels=c('KAN'))

}

Run the code above in your browser using DataLab