return None def show_spectogram(spectogram): plt.imshow(spectogram.T, aspect="auto", interpolation="none") ax = plt.gca() ax.set_xlabel("Time") ax.set_ylabel("Frequencies") ax.set_ylim((128, 256)) ax.set_xlim((0, 23)) plt.show() if __name__ == "__main__": import soundfiles signal = soundfiles.load_wav("training/pokemon/103.wav") fingers = get_fingerprints(signal, 1024, 2) time = [] peaks = [] for t, ps in fingers: time += [t] * len(ps) peaks += ps print len(peaks) plt.scatter(time, peaks, color="red") plt.show()
''' This file tests the loading of wav files. ''' import soundfiles import fingerprint import numpy as np import matplotlib.pyplot as plt signal = soundfiles.load_wav("training/pokemon/003.wav") x = [] for i in signal: x.append(i) plt.subplot(411) plt.title("original") plt.ylim(-1, 1) plt.plot(x) ''' fingers = get_fingerprints(signal, 2048, 8) time = [] peaks = [] for t, ps in fingers: time += [t] * len(ps) peaks += ps plt.subplot(221) plt.title("original") plt.scatter(time, peaks, color="red")
''' This file tests the loading of wav files. ''' import soundfiles import fingerprint import numpy as np import matplotlib.pyplot as plt signal = soundfiles.load_wav("training/pokemon/003.wav") x = [] for i in signal: x.append(i) plt.subplot(411) plt.title("original") plt.ylim(-1,1) plt.plot(x) ''' fingers = get_fingerprints(signal, 2048, 8) time = [] peaks = [] for t, ps in fingers: time += [t] * len(ps) peaks += ps plt.subplot(221) plt.title("original")