Skip to contents

This function calculates the time and frequency resolution based on the provided sampling rate and either window length, time resolution, or frequency resolution. Depending on which parameters are given, it calculates and returns the appropriate values for the others.

Usage

get_fft_params(
  samp.rate = NULL,
  win.length = NULL,
  time.res = NULL,
  freq.res = NULL
)

Arguments

samp.rate

Numeric. The sampling rate of the audio signal in Hz.

win.length

Numeric. The window length in samples. Can be NULL if time or frequency resolution is provided.

time.res

Numeric. The time resolution in seconds. Can be NULL if window length or frequency resolution is provided.

freq.res

Numeric. The frequency resolution in Hz. Can be NULL if window length or time resolution is provided.

Value

Prints the calculated time and frequency resolution, or window length and either time or frequency resolution depending on the provided inputs.

Examples

get_fft_params(samp.rate = 44100, win.length = 1024)
#>  Time resolution: 0.023 s
#>  Frequency resolution: 43.066 Hz
get_fft_params(samp.rate = 44100, time.res = 0.023)
#>  Window length: 1014.3 samples
#>  Frequency resolution: 43.478 Hz
get_fft_params(samp.rate = 44100, freq.res = 43)
#>  Window length: 1025.581 samples
#>  Time resolution: 0.023 s