musicflower.util.get_fourier_component

musicflower.util.get_fourier_component(pcds, fourier_component=None)[source]

Compute the amplitude and phase of one or all Fourier components of a real-valued input.

Parameters:
  • pcds (ndarray) – array of arbitrary shape (…, n) with pitch-class distributions of size n along the last dimension, along which the Fourier transform is computed using numpy.fft.rfft.

  • fourier_component (Optional[int]) – None (default) to return all components or int specifying the component to return (must not be larger than ` n//2`)

Return type:

ndarray

Returns:

array of shape (2, …, n//2 + 1) with amplitude and phase along the first dimension and the different Fourier components along the last dimension