Beispiel #1
0
def runfromfft(f, psd):
    ax = gf.init_image()
    gf.semi_graph(ax, f, psd)
    maxdex = aa.max_range(psd, 20)
    # gf.button_grapher(ax, f, maxdex, psd)
    peaklist = aa.peak_map(psd)
    aa.peak_impose(ax, f, peaklist)
    plt.show()
def runfromfft_graph(f, psd):
    peaklist = aa.peak_map(psd)
    peaksdex = aa.peak_assign(peaklist)
    output = guesswork(f, psd, peaklist, peaksdex)
    ax = gf.init_image(ylabel='POWER')
    gf.std_graph(ax, output[:, 0], output[:, 1])
    ax2 = gf.get_twinx(ax)
    gf.std_graph(ax2, output[:, 0], output[:, 2], c='r')
    plt.show()
    print(aa.print_identify(aa.identify(output)))
Beispiel #3
0
    peaksdex = peak_assign(peaklist)
    gf.button_grapher(ax2, frequency, peaksdex, peaklist)


def runfromfft(f, psd):
    ax = gf.init_image()
    gf.semi_graph(ax, f, psd)
    maxdex = aa.max_range(psd, 20)
    # gf.button_grapher(ax, f, maxdex, psd)
    peaklist = aa.peak_map(psd)
    aa.peak_impose(ax, f, peaklist)
    plt.show()


if __name__ == '__main__':
    filename = sys.argv[1]
    bandpass = []
    if len(sys.argv) > 3:
        lowerbound = int(sys.argv[2])
        upperbound = int(sys.argv[3])
        bandpass = [lowerbound, upperbound]
    audio = aa.load_npy(filename)
    bandpass = [80, 10000]
    f, psd = aa.spectrum(audio, bandpass=bandpass)
    ax = gf.init_image()
    gf.semi_graph(ax, f, psd, label=filename)
    # maxdex = aa.max_range(psd, 20)
    # peaklist = aa.peak_map(psd)
    # plt.savefig('%s.png' % filename.split('.')[0])
    plt.show()
Beispiel #4
0
    result.append(intervaldata)
result = np.asarray(result)
print(result)


def plotdots(ax, i, detect):
    colored = 'r'
    if detect:
        colored = 'b'
    gf.std_graph(ax, [i, i + 1], [0, 0], c=colored, lw=3)


print(np.average(result[:, 2]) - 120)
print(np.average(result[:, 3]))

ax = gf.init_image(xlabel='Intervals', ylabel='Power Rating', title='')
ax.set_ylim(-10, 200)
i = 0
tot = 0
for each in result:
    print(each)
    print(aa.detect(each))
    if aa.detect(each):
        tot += 1
    plotdots(ax, i, aa.detect(each))
    i += 1
print(tot)
gf.std_graph(ax,
             np.arange(len(result)),
             result[:, 2] - 120,
             c='g',
def runfromfft_graph(f, psd):
    peaklist = aa.peak_map(psd)
    peaksdex = aa.peak_assign(peaklist)
    output = guesswork(f, psd, peaklist, peaksdex)
    ax = gf.init_image(ylabel='POWER')
    gf.std_graph(ax, output[:, 0], output[:, 1])
    ax2 = gf.get_twinx(ax)
    gf.std_graph(ax2, output[:, 0], output[:, 2], c='r')
    plt.show()
    print(aa.print_identify(aa.identify(output)))


if __name__ == '__main__':
    filename = sys.argv[1]
    parts = 1
    if len(sys.argv) > 2:
        parts = int(sys.argv[2])
    au = aa.load_npy(filename)
    # Get the shorter audio pack
    audiolist = np.array_split(au, parts)
    for audio in audiolist:
        output = run(audio)
        # for each in output:
        #     print(each)
        ax = gf.init_image(ylabel='POWER')
        gf.std_graph(ax, output[:, 0], output[:, 1] - 120)
        ax2 = gf.get_twinx(ax)
        gf.std_graph(ax2, output[:, 0], output[:, 2], c='r')
        plt.show()