Skip to content

TimeFormatter

Defined in: packages/pleco-xa/src/scripts/xa-display.js:857

Time formatter for converting frame/sample indices to time strings

  • AxisFormatter

new TimeFormatter(options?): TimeFormatter

Defined in: packages/pleco-xa/src/scripts/xa-display.js:865

Formatter options

number = 512

Hop length in samples

number = 0

Lag parameter for time offset

number = 22050

Sample rate in Hz

string = 's'

Time unit: ‘s’, ‘ms’, ‘time’ (default: ‘s’)

TimeFormatter

AxisFormatter.constructor

hopLength: number

Defined in: packages/pleco-xa/src/scripts/xa-display.js:869


lag: number

Defined in: packages/pleco-xa/src/scripts/xa-display.js:867


sr: number

Defined in: packages/pleco-xa/src/scripts/xa-display.js:868


unit: string

Defined in: packages/pleco-xa/src/scripts/xa-display.js:870

call(value): string

Defined in: packages/pleco-xa/src/scripts/xa-display.js:878

Format frame index to time string

number

Frame index

string

Formatted time (e.g., “1.23s”, “1234ms”)

AxisFormatter.call


format(value, index): string

Defined in: packages/pleco-xa/src/scripts/xa-display.js:849

Make formatter callable (JavaScript equivalent of Python’s call)

number

Tick value

number

Tick index

string

Formatted label

AxisFormatter.format