def show_file_dialog(self): if (self.data_file == False): self.data_source = pathgetter() # print(self.data_source) if os.path.isfile(self.data_source) and (sndhdr.what(self.data_source) is not None): self.isValid = True else: self.isValid = False self.data_file = True
# -*- coding: utf-8 -*- #!/usr/bin/env python from sys import path import os.path thisrep = os.path.dirname(os.path.abspath(__file__)) path.append(os.path.dirname(thisrep)) from dejavu import Dejavu from EasyGame import pathgetter source = pathgetter()
from pygame.locals import * from matplotlib import pyplot as plt from music21 import * from sys import path import os.path thisrep = os.path.dirname(os.path.abspath(__file__)) path.append(os.path.dirname(thisrep)) from EasyGame import pathgetter ############################################################################################## # Initialization of sources and intial values source1 = str(pathgetter()) source2 = str(pathgetter()) note1 = note.Note("F#4") freq1 = note1.pitch.frequency note2 = note.Note("A#") freq2 = note2.pitch.frequency note3 = note.Note("G") freq3 = note3.pitch.frequency note4 = note.Note("D") freq4 = note4.pitch.frequency Channel_1 = MIDI_Channel(1) Channel_1.MIDI_wav(source1) p1 = pyaudio.PyAudio() Channel_1.open_stream(p1, False)
# -*- coding: utf-8 -*- #!/usr/bin/env python from sys import path import os.path thisrep = os.path.dirname(os.path.abspath(__file__)) path.append(os.path.dirname(thisrep)) from EasyGame import pathgetter source = pathgetter() print source
a.append([ev.pos]) c.append(color) if ev.type == MOUSEMOTION and ev.buttons[0]: a[-1].append(ev.pos) if len(a[-1]) >= 2: draw.aaline(scr, color, a[-1][-1], a[-1][-2], 1) display.flip() if ev.type == MOUSEBUTTONUP and ev.button == 1: if len(a[-1]) >= 2: draw.aaline(scr, color, a[-1][0], a[-1][-1], 1) gfxdraw.filled_polygon(scr, a[-1], color) display.flip() color = [randint(0, 255) for i in (1, 2, 3)] + [50] if ev.type == QUIT: break if ev.type == KEYDOWN and ev.key == K_s: p = pathgetter() if p: image.save(scr, p) if ev.type == KEYDOWN and ev.key == K_d and a: a.pop() c.pop() scr.fill(0) for lines, color in zip(a, c): draw.aalines(scr, color, 1, lines, 1) gfxdraw.filled_polygon(scr, lines, color) display.flip() if ev.type == KEYDOWN and ev.key == K_p: a = [[(x // 10 * 10, y // 10 * 10) for x, y in i] for i in a] scr.fill(0) for lines, col in zip(a, c): if len(lines) > 1: draw.aalines(scr, col, 1, lines, 1)
c.append(color) if ev.type == MOUSEMOTION and ev.buttons[0]: a[-1].append(ev.pos) if len(a[-1]) >= 2: draw.aaline(scr, color, a[-1][-1], a[-1][-2], 1) display.flip() if ev.type == MOUSEBUTTONUP and ev.button == 1: if len(a[-1]) >= 2: draw.aaline(scr, color, a[-1][0], a[-1][-1], 1) gfxdraw.filled_polygon(scr, a[-1], color) display.flip() color = [randint(0, 255) for i in (1, 2, 3)] + [50] if ev.type == QUIT: break if ev.type == KEYDOWN and ev.key == K_s: p = pathgetter() if p: image.save(scr, p) if ev.type == KEYDOWN and ev.key == K_d and a: a.pop() c.pop() scr.fill(0) for lines, color in zip(a, c): draw.aalines(scr, color, 1, lines, 1) gfxdraw.filled_polygon(scr, lines, color) display.flip() if ev.type == KEYDOWN and ev.key == K_p: a = [[(x // 10 * 10, y // 10 * 10) for x, y in i] for i in a] scr.fill(0) for lines, col in zip(a, c): if len(lines) > 1: