JsonTrackObj — JSON Track Format Object
JsonTrackObj.RdA list-based S3 class representing a JSTF (JSON Speech Track Format) file
in memory: a self-describing container for summary measures (jitter, shimmer,
voice-quality scores, …) with their field schema and provenance. Produced by
lst_* functions with return_jstf = TRUE or toFile = FALSE, and read back
by read_jstf(). Unlike AsspDataObj (equally-spaced signal tracks), JSTF
holds a small number of time-bounded slices, each a set of named scalar or
vector values.
Usage
# S3 method for class 'JsonTrackObj'
print(x, ...)
# S3 method for class 'JsonTrackObj'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
# S3 method for class 'JsonTrackObj'
as_tibble(x, ...)
# S3 method for class 'JsonTrackObj'
summary(object, ...)Methods (by generic)
print(JsonTrackObj): Print a compact summary of a JsonTrackObj.as.data.frame(JsonTrackObj): Convert to a data.frame; each slice becomes a row.as_tibble(JsonTrackObj): Convert to a tibble with typed columns. Requires the tibble package.summary(JsonTrackObj): Print a summary of a JsonTrackObj to the console.
Structure
A named list with class c("JsonTrackObj", "list"):
format,version— always"JSTF"and the schema version.function_name— thelst_*function that produced it.file_path,sample_rate,audio_duration— source provenance.metadata—function_versionand theparametersused.field_schema— named list mapping each value field to its type ("numeric","numeric_vector","character", …).slices— list of{begin_time, end_time, values}records;valuesis a named list keyed by thefield_schema.
Inspecting an object
print() shows a compact summary (format, function, slice count). Read fields
directly: obj$field_schema lists available measures, and
obj$slices[[1]]$values holds the values for the first slice. sample_rate()
and file_path() accessors also work. Use write_jstf() to serialize and
read_jstf() to load.
See also
assp_accessors for accessor generics that work on this class;
read_jstf(), write_jstf() for I/O.
Examples
if (FALSE) { # \dontrun{
# Produce a JSTF object from a summary function
vq <- lst_voice_report(
system.file("samples", "sustained", "a1.wav", package = "superassp"),
toFile = FALSE
)
vq # compact summary (print method)
names(vq$field_schema) # available measures
vq$slices[[1]]$values # values for the first slice
# Round-trip to disk
f <- tempfile(fileext = ".json")
write_jstf(vq, f)
identical_obj <- read_jstf(f)
} # }