Esempio n. 1
0
def extractTemporalFeature(wavedata):
    """time domain features"""
    zcrs = []
    rmss = []
    for frame in sliding_window(wavedata, 1024, 512):
        zcrs.append(zcr(frame, np.max(np.abs(wavedata))))
        rmss.append(rms(frame))
    return [zcrs, rmss]
def extractTemporalFeature(wavedata):
    """time domain features"""
    zcrs = []
    rmss = []
    for frame in sliding_window(wavedata, 1024, 512):
        zcrs.append(zcr(frame, np.max(np.abs(wavedata))))
        rmss.append(rms(frame))
    return [zcrs, rmss]
Esempio n. 3
0
def temporalCentroid(wavedata):
    """
        calculate the center of mass in the temporal energy envelop and return the ratio to the total length of signal
        the hop size is 1024
    """
    rmss = []
    timp = len(wavedata) / 44100.0
    for frame in sliding_window(wavedata, 1024, 1024):
        rmss.append(energy(frame))
    t = np.linspace(0,timp, len(rmss))
    rmss = np.array(rmss)
    return np.sum((t * rmss))/np.sum(rmss) / timp
def temporalCentroid(wavedata):
    """
        calculate the center of mass in the temporal energy envelop and return the ratio to the total length of signal
        the hop size is 1024
    """
    rmss = []
    timp = len(wavedata) / 44100.0
    for frame in sliding_window(wavedata, 1024, 1024):
        rmss.append(energy(frame))
    t = np.linspace(0, timp, len(rmss))
    rmss = np.array(rmss)
    return np.sum((t * rmss)) / np.sum(rmss) / timp