Esempio n. 1
0
class PredefinidoMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.label = tk.Label(self,
                              height=1,
                              width=44,
                              text="Sonido predefinido",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, controller, 400)
        self.populate()

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(self,
                                      height=1,
                                      width=44,
                                      text="Volver",
                                      font=config.LARGE_FONT,
                                      background="#ffbaae",
                                      command=self.goBack)

        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)

    def goBack(self):
        from Menus.StartMenu import StartMenu
        self.controller.showFrame(StartMenu)

    def populate(self):
        for mode in getPredefined():
            mode.setAction(self.enterPredefined)
            self.recyclerView.addElement(mode)

    def enterPredefined(self, mode):
        getEffectsInterface().runCommands(mode.content)
        from Menus.RealtimeOrFilenameMenu import RealtimeOrFilenameMenu

        self.controller.showFrame(RealtimeOrFilenameMenu)
Esempio n. 2
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.parent = parent

        self.title = tk.Label(self,
                              height=1,
                              text="Generando canción",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.title.pack(side=tk.TOP, fill=tk.BOTH)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, self.controller,
                                         390)
        self.recyclerView.setStart(50)
        self.recyclerView.configureSeparation(50)

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)

        tk.Frame(self.halfContainer).grid(column=2, row=0)

        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.loadingModel = LoadingModel(value=0, maxValue=100)

        self.loadingContainer = LoadingContainer(self, self.loadingModel)
        self.loadingModel.setContainer(self.loadingContainer)

        self.loadingContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonProcess = tk.Button(self,
                                       height=1,
                                       width=50,
                                       text="Cancelar",
                                       font=config.SMALL_FONT,
                                       background="#ff644f")

        self.buttonProcess.pack(side=tk.TOP, fill=tk.BOTH)
        self.loaded = False
Esempio n. 3
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.parent = parent

        self.title = tk.Label(
            self,
            height=1,
            text="Configuración de canales",
            font=config.LARGE_FONT,
            background="#ccffd5"
        )

        self.title.pack(side=tk.TOP, fill=BOTH)

        self.selectMidiMenu = MidiFileSelector(
            self,
            self.controller
        )
        self.selectMidiMenu.pack(side=tk.TOP, fill=BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, self.controller)

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)

        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=BOTH)

        self.buttonProcess = tk.Button(
            self,
            height=1,
            width=50,
            text="Generar música",
            font=config.SMALL_FONT,
            background="#ccffd5",
            command=self.generateMusic
        )
        self.buttonProcess.pack(side=tk.TOP, fill=BOTH)
        self.filename = None
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.mode = getEffectsInterface().getCompleteMode()

        self.label = tk.Label(
            self,
            height=1,
            width=44,
            text="Configuracion de parametros - " + self.mode,
            font=config.LARGE_FONT,
            background="#ccffd5"
        )

        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(
            self.halfContainer,
            controller,
            400
        )

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(
            self,
            height=1,
            width=44,
            text="Volver",
            font=config.LARGE_FONT,
            background="#ffbaae",
            command=self.goBack
        )
        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)
Esempio n. 5
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.label = tk.Label(self,
                              height=1,
                              width=44,
                              text="Reverberador",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, controller, 400)

        self.recyclerView.addElement(SimpleButtonModel(self.goToEco, "Eco"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToPlano, "Reverberador plano"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToPB, "Reverberador pasa bajos"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToCompleto, "Reverberador completo"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToConvolucion,
                              "Reverberador de convolución"))
        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(self,
                                      height=1,
                                      width=44,
                                      text="Volver",
                                      font=config.LARGE_FONT,
                                      background="#ffbaae",
                                      command=self.goBack)
        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.label = tk.Label(self,
                              height=1,
                              width=44,
                              text="Efecto personalizado",
                              font=config.LARGE_FONT,
                              background="#ccffd5")
        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, controller, 400)

        self.recyclerView.addElement(
            SimpleButtonModel(self.goToReverberador, "Reverberador"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToRobotizacion, "Robotización"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToFlanger, "Flanger"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToVibrato, "Vibrato"))
        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(self,
                                      height=1,
                                      width=44,
                                      text="Volver",
                                      font=config.LARGE_FONT,
                                      background="#ffbaae",
                                      command=self.goBack)
        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)
Esempio n. 7
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.label = tk.Label(self,
                              height=1,
                              width=44,
                              text="Sonido predefinido",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, controller, 400)
        self.populate()

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(self,
                                      height=1,
                                      width=44,
                                      text="Volver",
                                      font=config.LARGE_FONT,
                                      background="#ffbaae",
                                      command=self.goBack)

        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)
Esempio n. 8
0
class MidiConfigMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.parent = parent

        self.title = tk.Label(
            self,
            height=1,
            text="Configuración de canales",
            font=config.LARGE_FONT,
            background="#ccffd5"
        )

        self.title.pack(side=tk.TOP, fill=BOTH)

        self.selectMidiMenu = MidiFileSelector(
            self,
            self.controller
        )
        self.selectMidiMenu.pack(side=tk.TOP, fill=BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, self.controller)

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)

        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=BOTH)

        self.buttonProcess = tk.Button(
            self,
            height=1,
            width=50,
            text="Generar música",
            font=config.SMALL_FONT,
            background="#ccffd5",
            command=self.generateMusic
        )
        self.buttonProcess.pack(side=tk.TOP, fill=BOTH)
        self.filename = None

    def AddChannel(self):
        pass

    def removeChannel(self, channelName):
        pass

    def setFilename(self, filename):
        self.recyclerView.clear()

        self.filename = filename
        data = getMidiMetadata(filename)

        for channel in data:
            channelModel = ChannelModel(
                channel["id"],
                channel["name"]
            )
            channelModel.setOnConfigureListener(
                Listener(self.configureChannel, channelModel)
            )
            self.recyclerView.addElement(
                channelModel
            )

    def getFilename(self):
        return self.filename

    def configureChannel(self, channel):

        self.controller.showFrame(ConfigureChannelMenu)
        self.controller.getCurrentFrame().configureChannel(channel)

    def generateMusic(self):
        if self.filename:
            self.controller.showFrame(ProcessMidiMenu)
            self.controller.getCurrentFrame().startLoading(
                SyntetizeConfig(
                    channels=self.recyclerView.getElements(),
                    midiFilename=self.filename
                )
            )
class ParametersConfigMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.mode = getEffectsInterface().getCompleteMode()

        self.label = tk.Label(
            self,
            height=1,
            width=44,
            text="Configuracion de parametros - " + self.mode,
            font=config.LARGE_FONT,
            background="#ccffd5"
        )

        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(
            self.halfContainer,
            controller,
            400
        )

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(
            self,
            height=1,
            width=44,
            text="Volver",
            font=config.LARGE_FONT,
            background="#ffbaae",
            command=self.goBack
        )
        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)

    def configReverbEcoSimple(self):
        self.ganancia = SliderModel(0, 1, 0.001, 0.999, "Ganancia (g)")
        self.recyclerView.addElement(
            self.ganancia
        )
        self.delay = SliderModel(5, 8000, 1, 5000, "Delay (m)")
        self.recyclerView.addElement(
            self.delay
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def configureReverbPlano(self):
        self.ganancia = SliderModel(0, 1, 0.01, 0.5, "Ganancia (g)")
        self.recyclerView.addElement(
            self.ganancia
        )
        self.delay = SliderModel(5, 8000, 1, 500, "Delay (m)")
        self.recyclerView.addElement(
            self.delay
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def configReverbPB(self):
        self.ganancia = SliderModel(0, 1, 0.01, 0.5, "Ganancia (g)")
        self.recyclerView.addElement(
            self.ganancia
        )
        self.delay = SliderModel(5, 8000, 1, 500, "Delay (m)")
        self.recyclerView.addElement(
            self.delay
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def configureReverbCompleto(self):
        self.pFilter = SliderModel(1, 15, 1, 12, "Cantidad de Filtros en paralelo")
        self.recyclerView.addElement(
            self.pFilter
        )
        self.combCount = SliderModel(1, 4, 1, 2, "Cantidad de Filtros en serie")
        self.recyclerView.addElement(
            self.combCount
        )
        self.combDelay = SliderModel(100, 1000, 1, 500, "Delay filtros en serie")
        self.recyclerView.addElement(
            self.combDelay
        )
        self.combGain = SliderModel(0, 1, 0.01, 0.5, "Ganancia filtros en serie")
        self.recyclerView.addElement(
            self.combGain
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def configureReverbConvolucion(self):
        self.fileImpulse = AskFilenameModel()
        self.recyclerView.addElement(
            self.fileImpulse
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def configureRobotization(self):
        self.windowWidth = SliderModel(2, 12, 1, 6, "Tamaño de la ventana")
        self.recyclerView.addElement(
            self.windowWidth
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def configureFlangerOrVibrato(self):
        self.fm = SliderModel(0, 5, 0.01, 2.5, "Frecuencia de modulación (hz)")
        self.recyclerView.addElement(
            self.fm
        )

        self.pm = SliderModel(0, 0.02, 0.001, 0.01, "Profundidad de modulación (s)")
        self.recyclerView.addElement(
            self.pm
        )
        self.recyclerView.addElement(
            SimpleButtonModel(self.sendParams, "Aceptar")
        )

    def focus(self):
        self.recyclerView.clear()

        self.mode = getEffectsInterface().getCompleteMode()
        #print(self.mode)
        if self.mode == "Reverb Eco-simple":
            self.configReverbEcoSimple()
        elif self.mode == "Reverb Reverberador-plano":
            self.configureReverbPlano()
        elif self.mode == "Reverb Reverberador-pasa-bajos":
            self.configReverbPB()
        elif self.mode == "Reverb Reverberador-completo":
            self.configureReverbCompleto()
        elif self.mode == "Reverb Reverberador-convolucion":
            self.configureReverbConvolucion()
        elif self.mode == "Vibrato":
            self.configureFlangerOrVibrato()
        elif self.mode == "Flanger":
            self.configureFlangerOrVibrato()
        elif self.mode == "Robot":
            self.configureRobotization()


        self.label.configure(
            text=self.mode
        )

    def goBack(self):
        getEffectsInterface().sendData("-1\n")
        getEffectsInterface().restart()
        from Menus.StartMenu import StartMenu
        self.controller.showFrame(StartMenu)

    def sendParams(self):

        if self.mode == "Reverb Eco-simple" or \
                self.mode == "Reverb Reverberador-plano" or \
                self.mode == "Reverb Reverberador-pasa-bajos":

            #print("sending ...")
            getEffectsInterface().sendParam("g", self.ganancia.getValue())
            getEffectsInterface().sendParam("d", self.delay.getValue())

        elif self.mode == "Reverb Reverberador-completo":
            getEffectsInterface().sendParam("pf", self.pFilter.getValue())
            getEffectsInterface().sendParam("cc", self.combCount.getValue())
            getEffectsInterface().sendParam("dc", self.combDelay.getValue())
            getEffectsInterface().sendParam("gc", self.combGain.getValue())

        elif self.mode == "Reverb Reverberador-convolucion":
            getEffectsInterface().sendData(self.fileImpulse.getFilename())
        elif self.mode == "Robot":
            getEffectsInterface().sendParam("Ventana",self.windowWidth.getValue())
        elif self.mode == "Flanger" or self.mode == "Vibrato":
            getEffectsInterface().sendParam("fm", self.fm.getValue())
            getEffectsInterface().sendParam("pm", self.pm.getValue())


        from Menus.RealtimeOrFilenameMenu import RealtimeOrFilenameMenu
        self.controller.showFrame(RealtimeOrFilenameMenu)
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.parent = parent
        self.channel = None

        self.title = tk.Label(self,
                              height=1,
                              text="Configuración del canal X",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.title.pack(side=tk.TOP, fill=tk.BOTH)

        self.selectedText = tk.Label(self,
                                     height=1,
                                     text="Ningún instrumento seleccionado",
                                     font=config.SMALL_FONT,
                                     background="#80aaff")

        self.selectedText.pack(side=tk.TOP, fill=tk.BOTH)

        self.halfContainer = tk.Frame(self)
        self.recyclerView = RecyclerView(self.halfContainer,
                                         self.controller,
                                         height=360)

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)

        self.recyclerView.configureSeparation(70)

        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.sliderModel = SliderModel(start=0,
                                       end=100,
                                       step=1,
                                       startValue=0,
                                       title="Volumen",
                                       callOnChange=self.callOnChanged)

        self.volumeBar = SliderContainer(self, self.sliderModel)
        self.volumeBar.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonAceptar = tk.Button(self,
                                       height=1,
                                       width=50,
                                       text="Aceptar",
                                       font=config.LARGE_FONT,
                                       background="#ccffd5",
                                       command=self.aceptar)

        self.buttonAceptar.pack(side=tk.TOP, fill=tk.BOTH)

        self.updateInstruments()
        self.selectedInstrument = None
class ConfigureChannelMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.parent = parent
        self.channel = None

        self.title = tk.Label(self,
                              height=1,
                              text="Configuración del canal X",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.title.pack(side=tk.TOP, fill=tk.BOTH)

        self.selectedText = tk.Label(self,
                                     height=1,
                                     text="Ningún instrumento seleccionado",
                                     font=config.SMALL_FONT,
                                     background="#80aaff")

        self.selectedText.pack(side=tk.TOP, fill=tk.BOTH)

        self.halfContainer = tk.Frame(self)
        self.recyclerView = RecyclerView(self.halfContainer,
                                         self.controller,
                                         height=360)

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)

        self.recyclerView.configureSeparation(70)

        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.sliderModel = SliderModel(start=0,
                                       end=100,
                                       step=1,
                                       startValue=0,
                                       title="Volumen",
                                       callOnChange=self.callOnChanged)

        self.volumeBar = SliderContainer(self, self.sliderModel)
        self.volumeBar.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonAceptar = tk.Button(self,
                                       height=1,
                                       width=50,
                                       text="Aceptar",
                                       font=config.LARGE_FONT,
                                       background="#ccffd5",
                                       command=self.aceptar)

        self.buttonAceptar.pack(side=tk.TOP, fill=tk.BOTH)

        self.updateInstruments()
        self.selectedInstrument = None

    def callOnChanged(self, value):
        for element in self.recyclerView.getElements():
            element.setVolume(value)

    def configureChannel(self, channel):
        self.title.configure(text="Configuración del canal " +
                             channel.getName())
        self.sliderModel.setValue(channel.getVolume())
        self.instrumentSelected(channel.getInstrumento())
        self.channel = channel

    def updateInstruments(self):
        self.recyclerView.clear()

        for instrument in getInstruments().instrumentos:
            instrumentModel = InstrumentModel(instrument.getName())
            instrumentModel.setInstrumentData(instrument)
            instrumentModel.setOnSelectedListener(
                Listener(self.instrumentSelected, instrumentModel))

            self.recyclerView.addElement(instrumentModel)

    def instrumentSelected(self, instrumentModel):
        #print("Instrumento seleccionado ", instrumentModel)
        if instrumentModel:
            self.selectedText.configure(text="El instrumento " +
                                        instrumentModel.getInstrumentName() +
                                        " ha sido seleccionado")
        else:
            self.selectedText.configure(text="Ningún instrumento seleccionado")

        for instrument in self.recyclerView.getElements():
            if instrument == instrumentModel:
                instrument.enable()
                self.selectedInstrument = instrument
            else:
                instrument.disable()

    def aceptar(self):
        self.channel.setVolume(self.sliderModel.getValue())
        if self.selectedInstrument:
            self.channel.setInstrumento(self.selectedInstrument)
            self.channel.setVolume(self.sliderModel.getValue())

        from Menus.MidiConfigMenu import MidiConfigMenu

        self.controller.showFrame(MidiConfigMenu)
Esempio n. 12
0
class ProcessMidiMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.parent = parent

        self.title = tk.Label(self,
                              height=1,
                              text="Generando canción",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.title.pack(side=tk.TOP, fill=tk.BOTH)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, self.controller,
                                         390)
        self.recyclerView.setStart(50)
        self.recyclerView.configureSeparation(50)

        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)

        tk.Frame(self.halfContainer).grid(column=2, row=0)

        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.loadingModel = LoadingModel(value=0, maxValue=100)

        self.loadingContainer = LoadingContainer(self, self.loadingModel)
        self.loadingModel.setContainer(self.loadingContainer)

        self.loadingContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonProcess = tk.Button(self,
                                       height=1,
                                       width=50,
                                       text="Cancelar",
                                       font=config.SMALL_FONT,
                                       background="#ff644f")

        self.buttonProcess.pack(side=tk.TOP, fill=tk.BOTH)
        self.loaded = False

    def startLoading(self, configuration):
        self.loaded = False

        self.title.configure(text="Generando canción - " +
                             os.path.basename(configuration.getMidiFilename()))
        getProcessMidiInterface().setOnMsgArrived(self.onMsg)
        getProcessMidiInterface().setOnLoadUpdate(self.onLoadUpdate)
        getProcessMidiInterface().setOnComplete(self.onComplete)
        getProcessMidiInterface().start(configuration)

    def onMsg(self, message):
        self.recyclerView.addElement(InfoModel(message))
        #print("channel configuration: ", configuration)

    def onLoadUpdate(self, percentaje):
        #print("percentaje ", percentaje)
        self.loadingModel.setValue(percentaje)

    def onComplete(self, result):

        self.buttonProcess.configure(text="Guardar",
                                     height=1,
                                     width=50,
                                     font=config.SMALL_FONT,
                                     background="#91ff7e",
                                     command=lambda: self.save(result))

        self.loaded = True

    def save(self, result):
        #filename = filedialog.asksaveasfile(mode='w', defaultextension=".mp3").name
        filename = filedialog.asksaveasfile(mode='w',
                                            defaultextension=".wav").name
        if filename:
            self.onMsg("Escribiendo " + os.path.basename(filename))
            soundUtils.write(filename, config.fs, result
                             # result,
                             # normalized=True
                             )
            self.goToSpectogramMenu(filename, result)
        else:
            self.onMsg("Nompre de archivo invalido")

    def goToSpectogramMenu(self, filename, data):
        from Menus.SpectogramMenu import SpectogramMenu
        self.controller.showFrame(SpectogramMenu)

        self.controller.getCurrentFrame().setFilename(
            os.path.basename(filename))
        self.controller.getCurrentFrame().setMusicData(data)
Esempio n. 13
0
class ReverbMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.label = tk.Label(self,
                              height=1,
                              width=44,
                              text="Reverberador",
                              font=config.LARGE_FONT,
                              background="#ccffd5")

        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, controller, 400)

        self.recyclerView.addElement(SimpleButtonModel(self.goToEco, "Eco"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToPlano, "Reverberador plano"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToPB, "Reverberador pasa bajos"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToCompleto, "Reverberador completo"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToConvolucion,
                              "Reverberador de convolución"))
        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(self,
                                      height=1,
                                      width=44,
                                      text="Volver",
                                      font=config.LARGE_FONT,
                                      background="#ffbaae",
                                      command=self.goBack)
        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)

    def goToEco(self):
        getEffectsInterface().setReverbMode("Eco-simple")
        self.goToConfigMenu()

    def goToPlano(self):
        getEffectsInterface().setReverbMode("Reverberador-plano")
        self.goToConfigMenu()

    def goToPB(self):
        getEffectsInterface().setReverbMode("Reverberador-pasa-bajos")
        self.goToConfigMenu()

    def goToCompleto(self):
        getEffectsInterface().setReverbMode("Reverberador-completo")
        self.goToConfigMenu()

    def goToConvolucion(self):
        getEffectsInterface().setReverbMode("Reverberador-convolucion")
        self.goToConfigMenu()

    def goBack(self):
        getEffectsInterface().restart()
        from Menus.StartMenu import StartMenu
        self.controller.showFrame(StartMenu)

    def goToConfigMenu(self):
        from Menus.ParametersConfigMenu import ParametersConfigMenu
        self.controller.showFrame(ParametersConfigMenu)
Esempio n. 14
0
class PersonalizadoMenu(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent

        self.label = tk.Label(self,
                              height=1,
                              width=44,
                              text="Efecto personalizado",
                              font=config.LARGE_FONT,
                              background="#ccffd5")
        self.label.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.halfContainer = tk.Frame(self)

        self.recyclerView = RecyclerView(self.halfContainer, controller, 400)

        self.recyclerView.addElement(
            SimpleButtonModel(self.goToReverberador, "Reverberador"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToRobotizacion, "Robotización"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToFlanger, "Flanger"))
        self.recyclerView.addElement(
            SimpleButtonModel(self.goToVibrato, "Vibrato"))
        tk.Frame(self.halfContainer).grid(column=0, row=0)
        self.recyclerView.grid(column=1, row=0)
        tk.Frame(self.halfContainer).grid(column=2, row=0)
        self.halfContainer.grid_columnconfigure(0, weight=1)
        self.halfContainer.grid_columnconfigure(1, weight=10)
        self.halfContainer.grid_columnconfigure(2, weight=1)

        self.halfContainer.pack(side=tk.TOP, fill=tk.BOTH)

        self.buttonVolver = tk.Button(self,
                                      height=1,
                                      width=44,
                                      text="Volver",
                                      font=config.LARGE_FONT,
                                      background="#ffbaae",
                                      command=self.goBack)
        self.buttonVolver.pack(side=tk.TOP, expand=1, fill=tk.BOTH)

    def focus(self):
        pass

    def goToReverberador(self):
        getEffectsInterface().setMode("Reverb")
        from Menus.ReverbMenu import ReverbMenu
        self.controller.showFrame(ReverbMenu)

    def goToRobotizacion(self):
        getEffectsInterface().setMode("Robot")
        from Menus.ParametersConfigMenu import ParametersConfigMenu
        self.controller.showFrame(ParametersConfigMenu)

    def goToVibrato(self):
        getEffectsInterface().setMode("Vibrato")
        from Menus.ParametersConfigMenu import ParametersConfigMenu
        self.controller.showFrame(ParametersConfigMenu)

    def goToFlanger(self):
        getEffectsInterface().setMode("Flanger")
        from Menus.ParametersConfigMenu import ParametersConfigMenu
        self.controller.showFrame(ParametersConfigMenu)

    def goBack(self):
        getEffectsInterface().restart()
        from Menus.StartMenu import StartMenu
        self.controller.showFrame(StartMenu)