Learn R Programming

emuR (version 2.4.0)

convert_legacyEmuDB: Convert legacy EMU database to the emuDB format

Description

Converts an existing legacy EMU database to emuDB database structure. Copies or rewrites signal files and converts the database configuration and annotation data. The legacy database must be addressed by its template file.

Usage

convert_legacyEmuDB(
  emuTplPath,
  targetDir,
  dbUUID = uuid::UUIDgenerate(),
  verbose = TRUE,
  ...
)

Arguments

emuTplPath

EMU template file path

targetDir

target directory

dbUUID

optional UUID of emuDB, will be generated by default

verbose

be verbose, default: TRUE

...

currently available additional options:

  • rewriteSSFFTracks: if TRUE, rewrite SSFF tracks instead of copying the file to get rid of big endian encoded SSFF files (SPARC), default: TRUE

  • ignoreMissingSSFFTrackFiles: if TRUE, missing SSFF track files are ignored, if FALSE an error will be generated, default: TRUE

  • sourceFileTextEncoding: encoding of legacy database text files (template, label and hlb files), possible values: NULL, "latin1", "UTF-8" "bytes" or "unknown" :default NULL (uses encoding of operating system platform)

  • symbolicLinkSignalFiles: if TRUE, signal files are symbolic linked instead of copied. Implies: rewriteSSFFTracks=FALSE, Default: FALSE

Details

The database will be converted if the legacy database template file emuTplPath could be found and successfully loaded and parsed. The legacy template file usually has the extension '.tpl'. The UUID of the new emuDB will be randomly generated by default. If targetDir does not exist, the directory and its parents will be created. A new directory with the name of the database and the suffix '_emuDB' will be created in the targetDir. If the new database directory exists already, the function stops with an error. The template file is converted to a JSON file.

Some of the flags of the legacy EMU template files are ignored (lines with this syntax: "set [flagName] [flagValue]", known ignored flag names are: 'LabelTracks', 'SpectrogramWhiteLevel', 'HierarchyViewLevels', 'SignalViewLevels'). Legacy EMU utterances are reorganized to sessions and bundles. The naming of the sessions depends on the wildcard path pattern of the primary track: If the path contains no wildcard, only one session with the name '0000' will be created. If the path contains one wildcard path element, the names of the directories matching the pattern will be used as session names. If the path contains more than one wildcard path element, the session name is the concatenation of directory names separated by an underscore character.

Media files (usually WAV files) are copied, SSFF track files are rewritten using the ASSP library of package wrassp by default (see option rewriteSSFFTracks below, see also read.AsspDataObj write.AsspDataObj). Annotations in EMU hierarchy (.hlb) files and ESPS label files are converted to one JSON file per bundle (utterance). Only those files get copied, which match the scheme of the template file. Additional files in the legacy database directories are ignored. The legacy EMU database will not be modified. For more information on the structural elements of an emuDB see vignette{emuDB}.

options is a list of key value pairs:

See Also

load_emuDB

Examples

Run this code
if (FALSE) {
## Convert legacy EMU database specified by EMU 
## template file /mydata/EMU_legacy/ae/ae.tpl to directory /mydata/EMU/
## and load it afterwards

convert_legacyEmuDB("/mydata/EMU_legacy/ae/ae.tpl","/mydata/EMU/")
ae=load_emuDB("/mydata/EMU/ae_emuDB")

## Convert database "ae" and do not rewrite SSFF tracks 

convert_legacyEmuDB("/mydata/EMU_legacy/ae/ae.tpl",
"/mydata/EMU/",
options=list(rewriteSSFFTracks=FALSE))

## Convert legacy database "ae" from emuR demo data and load converted emuDB

create_emuRdemoData()
demoTplPath=file.path(tempdir(),"emuR_demoData/legacy_ae/ae.tpl")
targetDir=file.path(tempdir(),"converted_to_emuR")
convert_legacyEmuDB(demoTplPath,targetDir)
dbHandle=load_emuDB(file.path(targetDir,"ae_emuDB"))

}

Run the code above in your browser using DataLab