Beispiel #1
0
def standard_b(parent, img):
    brightness = watchman.get_brightness(img.histogram(250), 20)
    [red_brightness, green_brightness, blue_brightness] = watchman.count_colours(img)
    motion = watchman.get_motion()

    # if performer.bar % 4 == 0:
        # facecount = watchman.get_facecount(img)

    motion_threshold = 10

    if motion > motion_threshold:  
        watchman.activity_boost = 1
        stabs.multifire(motion)
    else:
        watchman.activity_boost = 0
        
    mixer.set_volume(parent, "bass", 127 * tools.invlerp(motion_threshold, 200, motion))
    mixer.set_volume(parent, "drums", 127 * tools.invlerp(motion_threshold, 200, motion))
    mixer.set_volume(parent, "chords", 127 * tools.invlerp(motion_threshold, 200, motion))
    mixer.set_volume(parent, "melody", 127 * tools.invlerp(motion_threshold, 200, motion))
    mixer.set_volume(parent, "stabs", 127 * tools.invlerp(motion_threshold, 200, motion))

    parent.set_user_tempo_modifier(0.5 + brightness)

    watchman.change_activity("bass", red_brightness, 16)
    watchman.change_activity("drums", green_brightness, 16)
    watchman.change_activity("melody", red_brightness, 8)
    watchman.change_activity("chords", blue_brightness, 16)

    if blue_brightness > 0.5: 
        if parent.user_mode == "major": parent.set_user_mode("Minor")
    else:
        if parent.user_mode == "minor": parent.set_user_mode("Major")
Beispiel #2
0
def sparse(parent, img):
    global motion

    brightness = watchman.get_brightness(img.histogram(250), 20)
    [red_brightness, green_brightness, blue_brightness] = watchman.count_colours(img)
    motion = watchman.get_motion()

    # if performer.bar % 4 == 0:
        # facecount = watchman.get_facecount(img)

    if motion > 5: 
        watchman.activity_boost = 1
        stabs.multifire(motion)
        
        #tempomod = tools.clamp(1, 1.5, (motion / 100))
        tempomod = 1 + (tools.invlerp(0, 0.5, (motion / 100) / 2))
        parent.set_user_tempo_modifier(tempomod)
    else:
        watchman.activity_boost = 0
        parent.set_user_tempo_modifier(1)

    watchman.change_activity("bass", red_brightness, 16)
    watchman.change_activity("drums", green_brightness, 16)
    watchman.change_activity("melody", red_brightness, 8)
    watchman.change_activity("chords", max(green_brightness, blue_brightness), 16)

    if blue_brightness > 0.5: 
        if parent.user_mode == "major": parent.set_user_mode("Minor")
    else:
        if parent.user_mode == "minor": parent.set_user_mode("Major")

    mixer.set_volume(parent, "bass", 100 * (1 - brightness))
    mixer.set_volume(parent, "drums", 100 * (1 - brightness))
    mixer.set_volume(parent, "chords", 100 * brightness)
    mixer.set_volume(parent, "melody", 127 * brightness)
    mixer.set_volume(parent, "stabs", 127 * brightness)
Beispiel #3
0
def standard_a(parent, img):
    global motion

    # b_detail = 3 # NEEDS TO BE AN ODD NUMBER
    # b_grid = watchman.get_brightness_grid(img, b_detail)
    # b_totals = watchman.get_brightness_totals(b_grid)
    # brightness = watchman.get_brightness(img.histogram(255), 20)
    # brightness = watchman.get_avg_brightness(img)
    brightness = watchman.get_luminosity(img, "a")
    [red_brightness, green_brightness, blue_brightness] = watchman.count_colours(img)
    # motion = watchman.get_motion()
    # motion = extractor.edge()
    motion = tools.clamp(0, 100, extractor.hue() * 100000)

    # watchman.get_avg_brightness(img)
    # watchman.get_luminosity(img, "a")
    # watchman.get_luminosity(img, "b")
    # watchman.get_luminosity(img, "c")

    lower_vol = 5
    higher_vol = 120
    old_faces = 0

    # if performer.bar % 4 == 0:
    #     facecount = watchman.get_facecount(img)
    #     if facecount > old_faces:
    #         stabs.multifire(100)
    #     old_faces = facecount

    # print motion

    if motion > 40: 
        watchman.activity_boost = 0.5 # 1
        stabs.multifire(motion / 2)
    else:
        watchman.activity_boost = 0

    if motion >= 0 and motion <= 0.03:
        mixer.set_volume(parent, "bass", lower_vol)
        mixer.set_volume(parent, "drums", lower_vol)
        mixer.set_volume(parent, "chords", lower_vol)
        mixer.set_volume(parent, "melody", lower_vol)
        mixer.set_volume(parent, "stabs", lower_vol)
    else:
        mixer.set_volume(parent, "bass", tools.clamp(lower_vol, higher_vol - 40, 127 * (1 - brightness)))
        mixer.set_volume(parent, "drums", tools.clamp(lower_vol, higher_vol - 20, 127 * brightness))
        mixer.set_volume(parent, "chords", tools.clamp(lower_vol, higher_vol, 127 * brightness))
        mixer.set_volume(parent, "melody", tools.clamp(lower_vol, higher_vol, 127 * brightness))
        mixer.set_volume(parent, "stabs", tools.clamp(lower_vol, higher_vol, 60 * brightness))

    watchman.change_activity("bass", red_brightness, 2)
    watchman.change_activity("drums", brightness, 4)
    watchman.change_activity("melody", blue_brightness, 2)
    watchman.change_activity("chords", green_brightness, 2)
    watchman.change_activity("section", brightness, 2)
Beispiel #4
0
    def open_mixer(self):
        print "Opening mixer."

        mix_w = 400
        row_w = mix_w / 4
        row_h = 30
        mix_h = row_h * 10

        firstcolx = 0
        secondcolx = row_w
        thirdcolx = row_w * 2

        title_slot = 0
        stitle_slot = 1
        header_slot = 2
        drums_slot = 3
        bass_slot = 4
        chords_slot = 5
        melody_slot = 6
        stabs_slot = 7
        metro_slot = 8
        info_slot = 9

        self.mix = QtGui.QWidget()

        self.mix.resize(mix_w, mix_h)
        self.mix.setWindowTitle('SeePlay Mixer')
        self.center()

        mixbg = QtGui.QLabel(self.mix)
        mixbg.resize(mix_w, mix_h)
        mixbg.move(0, 0)
        mixbg.setStyleSheet("QLabel { background-color: #333333; color: #EEEEEE; }")

        mixtitle = QtGui.QLabel(self.mix)
        mixtitle.resize(mix_w, row_h)
        mixtitle.move(0, row_h * title_slot)
        mixtitle.setText('SeePlay Mixer')
        mixtitle.setStyleSheet("QLabel { padding: 5px; font-size: 18px; text-align: center; background-color: rgba(100, 100, 100, 100); color: #FFFFFF; }")

        mixstitle = QtGui.QLabel(self.mix)
        mixstitle.resize(mix_w, row_h)
        mixstitle.move(0, row_h * stitle_slot)
        mixstitle.setText('Assign the instrument channels for MIDI output (0-15).')
        mixstitle.setStyleSheet("QLabel { padding: 5px; font-size: 10px; text-align: center; background-color: rgba(200, 200, 200, 150); color: #333333; }")

        self.mix.inst = QtGui.QLabel("Instrument:", self.mix)
        self.mix.inst.resize(row_w, row_h)
        self.mix.inst.move(firstcolx, row_h * header_slot)
        self.mix.inst.setStyleSheet("QLabel { padding: 5px; font-size: 16px; text-align: center; color: #FFFFFF; }")

        self.mix.chan = QtGui.QLabel("Channel:", self.mix)
        self.mix.chan.resize(row_w, row_h)
        self.mix.chan.move(secondcolx, row_h * header_slot)
        self.mix.chan.setStyleSheet("QLabel { padding: 5px; font-size: 16px; text-align: center; color: #FFFFFF; }")

        self.mix.vol = QtGui.QLabel("Volume (auto):", self.mix)
        self.mix.vol.resize(row_w * 2, row_h)
        self.mix.vol.move(thirdcolx, row_h * header_slot)
        self.mix.vol.setStyleSheet("QLabel { padding: 5px; font-size: 16px; text-align: center; color: #FFFFFF; }")

        self.mix.drums = QtGui.QLabel("Drums:", self.mix)
        self.mix.drums.resize(row_w, row_h)
        self.mix.drums.move(firstcolx, row_h * drums_slot)
        self.mix.drums.setStyleSheet("QLabel { padding: 5px; font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; }")

        self.mix.drumbox = QtGui.QComboBox(self.mix)
        self.mix.drumbox.resize(row_w, row_h)
        self.mix.drumbox.move(secondcolx,row_h * drums_slot)
        for i in xrange(16):
            self.mix.drumbox.addItem(str(i))
        self.mix.drumbox.addItem("Off")
        self.mix.drumbox.setCurrentIndex(mixer.get_stdchannel("drums"))
        self.mix.drumbox.activated[str].connect(lambda: mixer.set_channel("drums", self.mix.drumbox.currentText()))

        self.mix.drumvol = QtGui.QSlider(QtCore.Qt.Horizontal, self.mix)
        self.mix.drumvol.setFocusPolicy(QtCore.Qt.NoFocus)
        self.mix.drumvol.resize(row_w * 2, row_h)
        self.mix.drumvol.move(thirdcolx, row_h * drums_slot)
        self.mix.drumvol.setMinimum(0)
        self.mix.drumvol.setMaximum(127)
        self.mix.drumvol.setValue(mixer.get_volume("drums"))
        self.mix.drumvol.valueChanged[int].connect(lambda: mixer.set_volume(self, "drums", self.mix.drumvol.value()))

        self.mix.bass = QtGui.QLabel("Bass:", self.mix)
        self.mix.bass.resize(secondcolx, row_h)
        self.mix.bass.move(firstcolx, row_h * bass_slot)
        self.mix.bass.setStyleSheet("QLabel { padding: 5px; font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; }")

        self.mix.bassbox = QtGui.QComboBox(self.mix)
        self.mix.bassbox.resize(row_w, row_h)
        self.mix.bassbox.move(secondcolx,row_h * bass_slot)
        for i in xrange(16):
            self.mix.bassbox.addItem(str(i))
        self.mix.bassbox.addItem("Off")
        self.mix.bassbox.setCurrentIndex(mixer.get_stdchannel("bass"))
        self.mix.bassbox.activated[str].connect(lambda: mixer.set_channel("bass", self.mix.bassbox.currentText()))

        self.mix.bassvol = QtGui.QSlider(QtCore.Qt.Horizontal, self.mix)
        self.mix.bassvol.setFocusPolicy(QtCore.Qt.NoFocus)
        self.mix.bassvol.resize(row_w * 2, row_h)
        self.mix.bassvol.move(thirdcolx, row_h * bass_slot)
        self.mix.bassvol.setMinimum(0)
        self.mix.bassvol.setMaximum(127)
        self.mix.bassvol.setValue(mixer.get_volume("bass"))
        self.mix.bassvol.valueChanged[int].connect(lambda: mixer.set_volume(self, "bass", self.mix.bassvol.value()))

        self.mix.chords = QtGui.QLabel("Chords:", self.mix)
        self.mix.chords.resize(row_w, row_h)
        self.mix.chords.move(firstcolx, row_h * chords_slot)
        self.mix.chords.setStyleSheet("QLabel { padding: 5px; font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; }")

        self.mix.chordsbox = QtGui.QComboBox(self.mix)
        self.mix.chordsbox.resize(row_w, row_h)
        self.mix.chordsbox.move(secondcolx,row_h * chords_slot)
        for i in xrange(16):
            self.mix.chordsbox.addItem(str(i))
        self.mix.chordsbox.addItem("Off")
        self.mix.chordsbox.setCurrentIndex(mixer.get_stdchannel("chords"))
        self.mix.chordsbox.activated[str].connect(lambda: mixer.set_channel("chords", self.mix.chordsbox.currentText()))

        self.mix.chordsvol = QtGui.QSlider(QtCore.Qt.Horizontal, self.mix)
        self.mix.chordsvol.setFocusPolicy(QtCore.Qt.NoFocus)
        self.mix.chordsvol.resize(row_w * 2, row_h)
        self.mix.chordsvol.move(thirdcolx, row_h * chords_slot)
        self.mix.chordsvol.setMinimum(0)
        self.mix.chordsvol.setMaximum(127)
        self.mix.chordsvol.setValue(100)
        self.mix.chordsvol.valueChanged[int].connect(lambda: mixer.set_volume(self, "chords", self.mix.chordsvol.value()))

        self.mix.melody = QtGui.QLabel("Melody:", self.mix)
        self.mix.melody.resize(row_w, row_h)
        self.mix.melody.move(firstcolx, row_h * melody_slot)
        self.mix.melody.setStyleSheet("QLabel { padding: 5px; font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; }")

        self.mix.melodybox = QtGui.QComboBox(self.mix)
        self.mix.melodybox.resize(row_w, row_h)
        self.mix.melodybox.move(secondcolx,row_h * melody_slot)
        for i in xrange(16):
            self.mix.melodybox.addItem(str(i))
        self.mix.melodybox.addItem("Off")
        self.mix.melodybox.setCurrentIndex(mixer.get_stdchannel("melody"))
        self.mix.melodybox.activated[str].connect(lambda: mixer.set_channel("melody", self.mix.melodybox.currentText()))

        self.mix.melodyvol = QtGui.QSlider(QtCore.Qt.Horizontal, self.mix)
        self.mix.melodyvol.setFocusPolicy(QtCore.Qt.NoFocus)
        self.mix.melodyvol.resize(row_w * 2, row_h)
        self.mix.melodyvol.move(thirdcolx, row_h * melody_slot)
        self.mix.melodyvol.setMinimum(0)
        self.mix.melodyvol.setMaximum(127)
        self.mix.melodyvol.setValue(100)
        self.mix.melodyvol.valueChanged[int].connect(lambda: mixer.set_volume(self, "melody", self.mix.melodyvol.value()))

        self.mix.stabs = QtGui.QLabel("Stabs:", self.mix)
        self.mix.stabs.resize(row_w, row_h)
        self.mix.stabs.move(firstcolx, row_h * stabs_slot)
        self.mix.stabs.setStyleSheet("QLabel { padding: 5px; font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; }")

        self.mix.stabsbox = QtGui.QComboBox(self.mix)
        self.mix.stabsbox.resize(row_w, row_h)
        self.mix.stabsbox.move(secondcolx,row_h * stabs_slot)
        for i in xrange(16):
            self.mix.stabsbox.addItem(str(i))
        self.mix.stabsbox.addItem("Off")
        self.mix.stabsbox.setCurrentIndex(mixer.get_stdchannel("stabs"))
        self.mix.stabsbox.activated[str].connect(lambda: mixer.set_channel("stabs", self.mix.stabsbox.currentText()))

        self.mix.stabsvol = QtGui.QSlider(QtCore.Qt.Horizontal, self.mix)
        self.mix.stabsvol.setFocusPolicy(QtCore.Qt.NoFocus)
        self.mix.stabsvol.resize(row_w * 2, row_h)
        self.mix.stabsvol.move(thirdcolx, row_h * stabs_slot)
        self.mix.stabsvol.setMinimum(0)
        self.mix.stabsvol.setMaximum(127)
        self.mix.stabsvol.setValue(100)
        self.mix.stabsvol.valueChanged[int].connect(lambda: mixer.set_volume(self, "stabs", self.mix.stabsvol.value()))

        self.mix.metro = QtGui.QLabel("Metronome:", self.mix)
        self.mix.metro.resize(row_w, row_h)
        self.mix.metro.move(firstcolx, row_h * metro_slot)
        self.mix.metro.setStyleSheet("QLabel { padding: 5px; font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; }")

        self.mix.metrobox = QtGui.QComboBox(self.mix)
        self.mix.metrobox.resize(row_w, row_h)
        self.mix.metrobox.move(secondcolx,row_h * metro_slot)
        for i in xrange(16):
            self.mix.metrobox.addItem(str(i))
        self.mix.metrobox.addItem("Off")
        self.mix.metrobox.setCurrentIndex(mixer.get_stdchannel("metronome"))
        self.mix.metrobox.activated[str].connect(lambda: mixer.set_channel("metronome", self.mix.metrobox.currentText()))

        self.mix.metrovol = QtGui.QSlider(QtCore.Qt.Horizontal, self.mix)
        self.mix.metrovol.setFocusPolicy(QtCore.Qt.NoFocus)
        self.mix.metrovol.resize(row_w * 2, row_h)
        self.mix.metrovol.move(thirdcolx, row_h * metro_slot)
        self.mix.metrovol.setMinimum(0)
        self.mix.metrovol.setMaximum(127)
        self.mix.metrovol.setValue(100)
        self.mix.metrovol.valueChanged[int].connect(lambda: mixer.set_volume(self, "metronome", self.mix.metrovol.value()))

        self.mix.info = QtGui.QLabel("Please use your connected DAW to control master volume.", self.mix)
        self.mix.info.resize(mix_w, row_h)
        self.mix.info.move(firstcolx, row_h * info_slot)
        self.mix.info.setStyleSheet("QLabel { padding: 5px; font-style: italic; font-size: 10px; text-align: center; color: #FFFFFF; }")

        self.mix.show()