carat.util.segmentSignal¶
-
carat.util.
segmentSignal
(signal, window_len, hop)[source]¶ Segmentation of an array-like input:
Given an array-like, this function calculates the DFT of frames of the signal and stores them in bi-dimensional Scipy array.
- Args:
- signal (array-like): object to be windowed. Must be a one-dimensional array-like object. window_len (int): window size in samples. hop (int): frame hop between adjacent frames in seconds.
- Returns:
A 2-D numpy array containing the windowed signal. Each element of this array X can be defined as:
X[m,n] = x[n+Hm]
where, H is the HOP in samples, 0<=n<=N, N = window_len, and 0<m<floor(((len(x)-N)/H)+1).
- Raises:
- AttributeError if signal is not one-dimensional. ValueError if window_len or hop are not strictly positives.