add_trackDefinition: Call any function to compute an EmuR SSFF track definition.

View source: R/reindeeR_signalextensions.R

add_trackDefinitionR Documentation

Call any function to compute an EmuR SSFF track definition.

Description

This function behaves like emuR::add_ssffTrackDefinition, but can also take a well defined function (see below) not defined in the wrassp package and apply it to speech signal files in an Emu database.

Usage

add_trackDefinition(
  emuDBhandle,
  name,
  columnName = NULL,
  fileExtension = NULL,
  onTheFlyFunctionName = NULL,
  onTheFlyParams = list(),
  onTheFlyOptLogFilePath = NULL,
  inputTrackExtension = NULL,
  metadata.defaults = list(Gender = NA, Age = 35),
  overwriteFiles = FALSE,
  verbose = TRUE,
  package = "superassp"
)

Arguments

emuDBhandle

The database handle.

name

The name of the SSFF track to list in the database.

columnName

The name of the column in the SSFF file to associate with the track.

fileExtension

The file extension of the created or already existing SSFF file.

onTheFlyFunctionName

The name of the function to apply to the input signal to produce the output track. This function must have attributes "ext" and "tracks" defined to give information on what output may be expected from using them. Alternatively, the function may be defined in the package wrassp and therefore well known. The function also has state, via an attribute outputType, that it will create an SSFF track.

onTheFlyParams

An optional list of arguments to the onTheFlyFunctionName function. Default arguments will be derived from Age and Gender metadata too, so this parameter should mainly be used for arguments that should be applied identically to all input files.

onTheFlyOptLogFilePath

The logging output directory.

inputTrackExtension

The file extension of the input file. If NULL, the '"mediafileExtension' set in the database template file (defaults to "wav") will be used.

metadata.defaults

A list of default values for named columns. Since values will always be set for these columns, the user may also rely on them being set when deducing which default parameters to use when computing SSFF tracks using the onTheFlyFunctionName function.

overwriteFiles

If set to TRUE, the function will calculate SSFF track files for ALL bundles and write them into the database, overwriting existing files. The default is FALSE which means that only only bundles which do not have an track file with the indicated output extension will be written.

verbose

Determines wheter the function should display output to the user. If FALSE, the function will run completely silent and only report error messages back to the user.

package

The name of the package in which tbe funciton onTheFlyFunctionName is defined.

Details

This will be a new section

What is a well defined function

The add_trackDefinition needs to know

  1. what SSFF tracks there will be in the output of the function, and

  2. what file extension is prefered for the track.

The function will attempt to get these pieces of information from one of two sources (in order)

  1. the wrassp::wrasspOutputInfos structure of lists, so that the functions defined in wrassp is handled transparently, or

  2. the contents of the attributes "ext" and "tracks" set on the function.

If found, the add_trackDefinition function will apply the signal generating function to all media files, and record the new tracks as SSFF track definitions in the database using emuR::add_ssffTrackDefinition in order to ensure compatibility

Value

A boolean value indicating whether creation signal files were sucessful or not.

Examples

require(superassp)
reindeer:::create_ae_db() -> ae
emuR::list_ssffTrackDefinitions(ae)
?praat_formant_burg
#This calls the praat_formant_burg function with default parameters
add_trackDefinition(ae,name="FORMANTS",columnName = "fm",fileExtension = "pfm",onTheFlyFunctionName = "praat_formant_burg")
#Compute formants with non-default parameters using Praat.
add_trackDefinition(ae,name="pfm",columnName = "fm",fileExtension = "pfm",onTheFlyFunctionName = "praat_formant_burg",onTheFlyParams=list(numFormants=3,window="hamming",maxhzformant=4000))
emuR::list_ssffTrackDefinitions(ae)
#Use the standard wrassp::forest function to compute the formants, using the defaults for female speakers
add_trackDefinition(ae,name="ffm",columnName = "fm",fileExtension = "ffm",onTheFlyFunctionName = "forest",onTheFlyParams=list(numFormants=3,gender="f"))
#And, you can attach another track definition to the same Praat-genereated file if you like.
add_trackDefinition(ae,name="bw",columnName = "bw",fileExtension = "pfm")
emuR::list_ssffTrackDefinitions(ae)
reindeer:::detach_demo_db(ae)




humlab-speech/reindeer documentation built on May 21, 2023, 4:43 p.m.