Learn R Programming

soundClass (version 0.0.9.2)

ms2samples: 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.

Examples

Run this code
# NOT RUN {
ms2samples(150000, fs = 300000, tx = 1, inv = FALSE)
ms2samples(100, fs = 300000, tx = 1, inv = TRUE)
# }

Run the code above in your browser using DataLab