Пример #1
0
def B3():
    w = 2048
    h = 1024
    path = '../audio/train/vio/'
    
    vio_64 = librosa.load(path + 'vio_64.wav', fs)[0][0:61000]
    vio_88 = librosa.load(path + 'vio_88.wav', fs)[0][0:61000]
    cla_64 = librosa.load('../audio/train/cla/cla_64.wav', fs)[0][0:61000]
   
    S_1 = NMF.extractTemplate(vio_64)
    S_2 = NMF.extractTemplate(vio_88)
    S_3 = NMF.extractTemplate(cla_64)
 
    librosa.display.specshow(S_1, y_axis='cqt_note', x_axis='frames', n_yticks=180)
    plt.axis([0, 2, 0, 100])
    plt.show()

    librosa.display.specshow(S_2, y_axis='cqt_note', x_axis='frames', n_yticks=10)
    #plt.axis([0, 2, 0, 100])
    plt.show()
    
    librosa.display.specshow(S_3, y_axis='cqt_note', x_axis='frames', n_yticks=180)
    plt.axis([0, 2, 0, 100])
    plt.show()

    S_1 = librosa.core.istft(S_1)
    librosa.display.waveplot(S_1, x_axis='time')
    plt.show()
    S_2 = librosa.core.istft(S_2)
    librosa.display.waveplot(S_2, x_axis='time')
    plt.show()
Пример #2
0
def extractAllTemplate(data, n_components=NMF.nc):
    init = False
    for d in data:
        comp = NMF.extractTemplate(d[0][0:70000], n_components=n_components)
        if init == False:
            init = True
            W = comp
            continue
        W = np.append(W, comp, axis=1)
    return W