Ejemplo n.º 1
0
    def __init__(self, synth):
        window = gtk.Window()
        window.connect("key-press-event", (lambda x, y: False))
        window.connect("key-release-event", (lambda x, y: False))
        topVBox = gtk.VBox()
        toolbar_and_measure = gtk.HBox()
        self.XMLplayer = None

        keyboard = piano.Piano(synth)
        menu = self.makeMenu(keyboard)
        self.controlBar = self.makeToolBar()

        m_label = gtk.Label()
        m_label.set_text("Measure:")

        self.m_number = gtk.Entry()
        self.m_number.set_text("0")
        self.m_number.set_max_length(4)
        self.m_number.set_width_chars(4)

        toolbar_and_measure.pack_start(self.controlBar)
        toolbar_and_measure.pack_end(self.m_number, expand=False, fill=False)
        toolbar_and_measure.pack_end(m_label, expand=False, fill=False)
        topVBox.pack_start(menu)
        topVBox.pack_start(toolbar_and_measure)
        topVBox.pack_start(keyboard)
        window.add(topVBox)
        window.show_all()

        window.connect("destroy", self.main_quit)
        gtk.main()
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        QThread.__init__(self, parent=parent)
        self.stream = capture.VideoStream()
        self.piano = piano.Piano(4)  # 4 - number of octaves
        self.ai = ai.AI()

        self.is_image_processing_demo = True
        self.is_pianolbl_reset = True
        self.is_running = True
        logging.debug("UpdateThread Initialized")
Ejemplo n.º 3
0
	def parse_args(self, arguments):
		usage = "Wrong Syntax. usage: main.py -piano/-melodic numBars"
		if (sys.argv[1] == "-piano"):
			inst = piano.Piano(self.file)
		elif (sys.argv[1] == "-melodic"):
			inst = melodic.Melodic(self.file)
		else:
			print(usage)
			exit()
		bars = int(sys.argv[2])
		return inst, bars
Ejemplo n.º 4
0
    def __init__(self, window_title='Virtual Piano'):
        QWidget.__init__(self)
        self.setWindowTitle(window_title)
        self.layout = QVBoxLayout()
        self.inner_layout = QHBoxLayout()

        self.lbl_image = QLabel(self)
        self.lbl_image.resize(520, 360)

        self.lbl_keys = QLabel(self)
        self.lbl_keys.setPixmap(QPixmap("res/keys.png").scaledToWidth(520))
        self.lbl_keys.resize(520, 360)

        self.thread = UpdateThread(self)
        self.thread.pix_map_signal.connect(self.lbl_image.setPixmap)
        self.thread.start()

        logger = LogTextEdit(self)
        logging.getLogger().addHandler(logger)
        logger.setFormatter(
            logging.Formatter("%(asctime)s [%(levelname)s] - %(message)s",
                              "%d/%m/%y %H:%M:%S"))
        logging.getLogger().addHandler(logger)
        logging.getLogger().setLevel(LOG_LEVEL)

        self.inner_layout.addWidget(self.lbl_image)
        self.inner_layout.addWidget(self.lbl_keys)

        self.layout.addLayout(self.inner_layout)
        self.layout.addWidget(logger.widget)

        self.setLayout(self.layout)

        # Demo play notes, use in the ai class
        self.piano = piano.Piano(4)  # 4 - number of octaves
        self.piano.play('C-1')  # format: 'note-octave'

        # self.piano.stop() call this in the ai when the user stops the gesture

        logging.debug("GUI Initialized")
Ejemplo n.º 5
0
 def __init__(self, parent):
     self.frame = tk.Frame(parent, borderwidth=5)
     self.octaves = []
     piano = p.Piano(self.frame, 4)
     self.octaves = piano.octaves
     pass
Ejemplo n.º 6
0
 def recordPopup(self):
     noteFrame.destroy()
     piano.Piano(self.parent, None, self.currRow)
     self.parent.play_in_thread_looped()