espnet2.tts.feats_extract.yin.differenceFunction
Less than 1 minute
espnet2.tts.feats_extract.yin.differenceFunction
espnet2.tts.feats_extract.yin.differenceFunction(x, N, tau_max)
Compute the difference function of the input audio data.
This function computes the difference function of the given audio data x. This corresponds to equation (6) in the referenced literature. The solution is implemented directly using PyTorch’s rfft.
espnet2.tts.feats_extract.yin.None
- Parameters:
- x (torch.Tensor) – Audio data in the form of a 2D tensor where the first dimension represents the batch size and the second dimension represents the audio signal length.
- N (int) – The length of the audio data.
- tau_max (int) – The integration window size, which determines the maximum lag to be considered in the difference function.
- Returns: The computed difference function.
- Return type: list
- Raises:AssertionError – If the input tensor x does not have exactly 2 dimensions.
Examples
>>> import torch
>>> x = torch.randn(32, 22050) # Simulated audio data for 32 samples
>>> N = x.shape[1]
>>> tau_max = 2048
>>> difference_function_result = differenceFunction(x, N, tau_max)