carat.util.beat2signal¶
-
carat.util.
beat2signal
(y, time, beats, ind_beat)[source]¶ - Get the signal fragment corresponding to a beat given by index ind_beat.
- If instead of beats, downbeats are used, then a bar is returned.
- Args:
- y (numpy array): signal array. Must be a one-dimensional array. time (numpy array): corresponding time. Must be a one-dimensional array. beats (numpy array): time instants of the beats. ind_beat (int): index of the desired beat.
- Returns:
- beat_segment (numpy array): segment of the signal corresponding to the beat.
- Raises:
- AttributeError if y or time is not a one-dimensional numpy array. ValueError if ind_beat fall outside the beats bounds.