ms2samples: Convert between time and number of samples in sound files

View source: R/ms2samples.R

ms2samplesR Documentation

Convert between time and number of samples in sound files

Description

Convert time to number of samples or vice versa in sound files.

Usage

ms2samples(value, fs = 300000, tx = 1, inv = FALSE)

Arguments

value

Integer. Number of samples or time in ms.

fs

Integer. The sampling frequency in samples per second.

tx

Integer. Indicating the time expansion factor. If the recording is not time expanded tx must be set to 1 (the default).

inv

Logical. If TRUE converts time to number of samples, if FALSE number of samples to time.

Value

Integer. If inv = TRUE returns number of samples, if inv = FALSE returns time in ms.

Author(s)

Bruno Silva

Examples

ms2samples(150000, fs = 300000, tx = 1, inv = FALSE)
ms2samples(100, fs = 300000, tx = 1, inv = TRUE)

soundClass documentation built on May 30, 2022, 1:07 a.m.