Mercurial > hg > segmentation
view foote.py @ 7:294f66d285af
some previous changes
author | mitian |
---|---|
date | Tue, 05 May 2015 08:54:09 +0100 |
parents | c11ea9e0357f |
children |
line wrap: on
line source
""" Foote method for segmentation, published here: Foote, J. (2000). Automatic Audio Segmentation Using a Measure Of Audio Novelty. In Proc. of the IEEE International Conference of Multimedia and Expo (pp. 452-455). New York City, NY, USA. """ __author__ = "Oriol Nieto" __copyright__ = "Copyright 2014, Music and Audio Research Lab (MARL)" __license__ = "GPL" __version__ = "1.0" __email__ = "oriol@nyu.edu" # Local stuff from utils import SegUtil M = 2 # Median filter for the audio features (in beats) Mg = 32 # Gaussian kernel size L = 16 # Size of the median filter for the adaptive threshold def segmentation(F, M, Mg, L, plot=False): """Computes the Foote segmentator. Parameters ---------- F : np.array((N,M)) Features matrix of N beats x M features. M : int Median filter size for the audio features (in beats). Mg : int Gaussian kernel size (in beats). L : int Median filter size for the adaptive threshold Return ------ bound_idx : np.array Array containing the indices of the boundaries. """ # Filter F = SegUtil.median_filter(F, M=M) # Self Similarity Matrix S = SegUtil.compute_ssm(F) # Compute gaussian kernel G = SegUtil.compute_gaussian_krnl(Mg) # Compute the novelty curve nc = SegUtil.compute_nc(S, G) # Find peaks in the novelty curve return SegUtil.pick_peaks(nc, L=L, plot=plot)