def mfcc(data=EMPTY, pos=None, repeatable=True): global last_operation, dataset ssub = int(spectrum_subtraction.get()) range_ = int(range_mfcc.get()) cmap_ = var_cmap.get() if data is EMPTY: window = dataset.windows[int(range_window.get())] data = gui.plot(ax, dsp.MFCC, range_, cmap_, ssub, window=window) else: if pos is not None and not args.disable_window: window = dataset.windows[pos] else: window = None gui.plot(ax, dsp.MFCC, range_, cmap_, ssub, data=data, window=window) # TODO: inference for MFCCs #if cnn_model: # infer(data, pos) last_operation = (mfcc, data, window, pos) fig.tight_layout() canvas.draw() if repeatable: repeat(mfcc)
def mfsc(data=EMPTY, pos=None, repeatable=True): global last_operation, dataset print(pos) ssub = int(spectrum_subtraction.get()) range_ = int(range_mfsc.get()) cmap_ = var_cmap.get() if data is EMPTY: window = dataset.windows[int(range_window.get())] data = gui.plot(ax, dsp.MFSC, range_, cmap_, ssub, window=window) else: if pos is not None and not args.disable_window: window = dataset.windows[pos] else: window = None gui.plot(ax, dsp.MFSC, range_, cmap_, ssub, data=data, window=window) if cnn_model: print(window) a, b, c = window[0], window[1], window[2] infer(data[a:b, :c]) last_operation = (mfsc, data, window, pos) fig.tight_layout() canvas.draw() if repeatable: repeat(mfsc)
def fft(repeatable=True): global last_operation ssub = int(spectrum_subtraction.get()) data = gui.plot(ax, dsp.FFT) last_operation = (fft, data, None, None) fig.tight_layout() canvas.draw() if repeatable: repeat(fft)
def raw_wave(repeatable=True): global last_operation range_ = int(range_amplitude.get()) data = gui.plot(ax, dsp.RAW_WAVE, range_=range_) last_operation = (raw_wave, data, None, None) fig.tight_layout() canvas.draw() if repeatable: repeat(raw_wave)
def spectrogram(data=EMPTY, pos=0, repeatable=True): global last_operation, dataset ssub = int(spectrum_subtraction.get()) range_ = int(range_spectrogram.get()) cmap_ = var_cmap.get() if data is EMPTY: window = dataset.windows[int(range_window.get())] data = gui.plot(ax, dsp.SPECTROGRAM, range_, cmap_, ssub) else: window = dataset.windows[pos] gui.plot(ax, dsp.SPECTROGRAM, range_, cmap_, ssub, data=data, window=None) last_operation = (spectrogram, data, window, pos) fig.tight_layout() canvas.draw() if repeatable: repeat(spectrogram)
def MST(v): if (gui.t != 0): for i in range(0, len(main.adjacency_matrix)): for j in range(i, len(main.adjacency_matrix[i])): if (main.adjacency_matrix[i][j] == 1): print("assign weight to edge", i + 1, "to", j + 1) temp = int(input()) off_y = (gui.y_matrix[j] - gui.y_matrix[i]) / 2 off_x = (gui.x_matrix[j] - gui.x_matrix[i]) / 2 gui.canvas.create_text(gui.x_matrix[i] + off_x, gui.y_matrix[i] + off_y, text=str(temp), font="Times 20 italic bold") main.adjacency_matrix[i][j] = temp main.adjacency_matrix[j][i] = temp g = Graph(len(main.adjacency_matrix)) g.graph = [] g.graph.extend(main.adjacency_matrix) g.primsAlgo() print("how many weights you want to change ?") z = int(input()) if (z > 0): for i in range(0, z): print( "Type the edge of which you want to change weight in fromat ->", "e1 e2 w") s = list(map(int, input().split())) main.adjacency_matrix[s[0] - 1][s[1] - 1] = s[2] gui.canvas.delete("all") #print(gui.x_matrix) #print(gui.y_matrix) tag_name = str(s[0] - 1) + str(s[1] - 1) gui.canvas.delete(tag_name) gui.plot(main.adjacency_matrix)
def elapsed_time(): gui.plot(ax, dsp.ELAPSED_TIME)
def filterbank(): data = gui.plot(ax, dsp.FILTERBANK) canvas.draw()