mi@0: """ mi@0: Foote method for segmentation, published here: mi@0: mi@0: Foote, J. (2000). Automatic Audio Segmentation Using a Measure Of Audio mi@0: Novelty. In Proc. of the IEEE International Conference of Multimedia and Expo mi@0: (pp. 452-455). New York City, NY, USA. mi@0: """ mi@0: mi@0: __author__ = "Oriol Nieto" mi@0: __copyright__ = "Copyright 2014, Music and Audio Research Lab (MARL)" mi@0: __license__ = "GPL" mi@0: __version__ = "1.0" mi@0: __email__ = "oriol@nyu.edu" mi@0: mi@0: # Local stuff mi@0: from utils import SegUtil mi@0: mitian@7: M = 2 # Median filter for the audio features (in beats) mitian@7: Mg = 32 # Gaussian kernel size mitian@7: L = 16 # Size of the median filter for the adaptive threshold mi@0: mi@0: def segmentation(F, M, Mg, L, plot=False): mi@0: """Computes the Foote segmentator. mi@0: mi@0: Parameters mi@0: ---------- mi@0: F : np.array((N,M)) mi@0: Features matrix of N beats x M features. mi@0: M : int mi@0: Median filter size for the audio features (in beats). mi@0: Mg : int mi@0: Gaussian kernel size (in beats). mi@0: L : int mi@0: Median filter size for the adaptive threshold mi@0: mi@0: Return mi@0: ------ mi@0: bound_idx : np.array mi@0: Array containing the indices of the boundaries. mi@0: """ mi@0: # Filter mitian@1: F = SegUtil.median_filter(F, M=M) mi@0: mi@0: # Self Similarity Matrix mitian@1: S = SegUtil.compute_ssm(F) mi@0: mi@0: # Compute gaussian kernel mitian@1: G = SegUtil.compute_gaussian_krnl(Mg) mi@0: mi@0: # Compute the novelty curve mitian@1: nc = SegUtil.compute_nc(S, G) mi@0: mi@0: # Find peaks in the novelty curve mitian@1: return SegUtil.pick_peaks(nc, L=L, plot=plot)