def onBtnChooseSoundfont(self):
		filename = midirender_util.ask_openfile(initialfolder=gm_dir, title="Choose SoundFont", types=['.sf2|SoundFont','.sbk|SoundFont1','.pat|Patch file'])
		if not filename: return
		
		index = self.getListboxIndex()
		state = self.arCustomizationState[index]
		state['soundfont'] = filename
		self.onChangeLbProgChanges() #refresh the fields
	def menuModifyRawMidi(self, evt=None):
		if sys.platform != 'win32':
			midirender_util.alert('Only supported on windows')
			return
		
		import tempfile, os, subprocess
		
		m2t = midirender_util.bmidirenderdirectory+'\\timidity\\m2t.exe'
		t2m = midirender_util.bmidirenderdirectory+'\\timidity\\t2m.exe'
		notepadexe = 'C:\\Windows\\System32\\notepad.exe'
		if not os.path.exists(m2t) or not os.path.exists(t2m) or not os.path.exists(notepadexe):
			midirender_util.alert('Could not find %s or %s or %s.'%(m2t, t2m, notepadexe))
			return
		
		filenameMidInput = midirender_util.ask_openfile(title="Choose Midi File to modify", types=['.mid|Mid file'])
		if not filenameMidInput: return
		
		
		filenameText = tempfile.gettempdir() + os.sep + 'tmpout.txt'
		try:
			if os.path.exists(filenameText):
				os.unlink(filenameText)
		except:
			pass
		if os.path.exists(filenameText):
			midirender_util.alert('Could not clear temporary file')
			return
		
		args = [m2t, filenameMidInput, filenameText]
		retcode = subprocess.call(args)
		if retcode:
			midirender_util.alert('Midi to text returned failure')
			return
		if not os.path.exists(filenameText):
			midirender_util.alert('Midi to text did not write text file')
			return
		
		midirender_util.alert("You'll see the text file in notepad. Save and close when done editing.")
		modtimebefore = os.path.getmtime(filenameText)
		args = [notepadexe, filenameText]
		retcode = subprocess.call(args)
		if modtimebefore == os.path.getmtime(filenameText):
			# looks like the user cancelled before making any edits
			return
			
		filenameMidOutput = midirender_util.ask_savefile(title="Choose destination for Midi File", types=['.mid|Mid file'])
		if not filenameMidOutput: return
		
		args = [t2m, filenameText, filenameMidOutput]
		retcode = subprocess.call(args)
		if retcode:
			midirender_util.alert('text to midi returned failure')
			return
		if not os.path.exists(filenameMidOutput):
			midirender_util.alert('text to midi did not write midi file')
			return
		midirender_util.alert('Complete.')
	def setGlobalSoundfont(self):
		filename = midirender_util.ask_openfile(initialfolder=gm_dir, title='Choose SoundFont',
			types=['.sf2 .sbk .cfg|SoundFont or cfg'])
		
		if not filename:
			return
		
		self.main_soundfont_reference[0] = filename
		self.lblAbove['text'] ='Current soundfont:%s' % filename
    def menu_soundFontInfoTool(self):
        filename = midirender_util.ask_openfile(
            initialfolder=midirender_soundfont.gm_dir,
            title='Choose SoundFont',
            types=['.sf2 .sbk .pat|SoundFont or Patch'])
        if not filename:
            return

        dlg = midirender_soundfont_info.BSoundFontInformation(
            self.top, filename, bSelectMode=False)
    def setGlobalSoundfont(self):
        filename = midirender_util.ask_openfile(
            initialfolder=gm_dir,
            title='Choose SoundFont',
            types=['.sf2 .sbk .cfg|SoundFont or cfg'])

        if not filename:
            return

        self.main_soundfont_reference[0] = filename
        self.lblAbove['text'] = 'Current soundfont:%s' % filename
    def onBtnChooseSoundfont(self):
        filename = midirender_util.ask_openfile(
            initialfolder=gm_dir,
            title='Choose SoundFont',
            types=['.sf2 .sbk .cfg|SoundFont or cfg'])
        if not filename:
            return

        index = self.getListboxIndex()
        state = self.arCustomizationState[index]
        state['soundfont'] = filename
        self.onChangeLbProgChanges()  #refresh the fields
Beispiel #7
0
	def menu_openMidi(self, evt=None):
		filename = midirender_util.ask_openfile(title="Open Midi File", types=['.mid|Mid file'])
		if not filename: return

		#first, see if it loads successfully.
		try:
			newmidi = bmidilib.BMidiFile()
			newmidi.open(filename, 'rb')
			newmidi.read()
			newmidi.close()
		except:
			e=''
			midirender_util.alert('Could not load midi: exception %s'%str(e), title='Could not load midi',icon='error')
			return
		self.lblFilename['text'] = filename
		self.loadMidiObj(newmidi)
    def menu_openMidi(self, evt=None):
        filename = midirender_util.ask_openfile(title='Open Midi File',
                                                types=['.mid|Mid file'])
        if not filename:
            return

        # first, see if it loads successfully.
        try:
            newmidi = bmidilib.BMidiFile()
            newmidi.open(filename, 'rb')
            newmidi.read()
            newmidi.close()
        except:
            e = sys.exc_info()[1]
            midirender_util.alert('Could not load midi: exception %s' % str(e),
                                  title='Could not load midi',
                                  icon='error')
            return

        self.lblFilename['text'] = filename
        self.loadMidiObj(newmidi)
	def loadMid(self):
		filename = midirender_util.ask_openfile(title="Choose midi song", types=['.mid|Midi'], initialfolder=sampleMidiPath)
		if not filename: return
		self.lblMidi['text'] = filename
		self.currentMidi = filename
	def setGlobalSoundfont(self):
		filename = midirender_util.ask_openfile(initialfolder=gm_dir, title="Choose SoundFont", types=['.sf2|SoundFont','.sbk|SoundFont1','.cfg|Timidity Configuration file'])
		if not filename: return
		
		self.main_soundfont_reference[0] = filename
		self.lblAbove['text'] ='Current soundfont:%s'%filename
Beispiel #11
0
	def menu_soundFontInfoTool(self):
		filename = midirender_util.ask_openfile(initialfolder=midirender_soundfont.gm_dir, title='Choose SoundFont', types=['.sf2 .sbk .pat|SoundFont or Patch'])
		if not filename:
			return
		
		dlg = midirender_soundfont_info.BSoundFontInformation(self.top, filename, bSelectMode=False)
    def menuModifyRawMidi(self, evt=None):
        if sys.platform != 'win32':
            midirender_util.alert('Only supported on windows')
            return

        import tempfile, os, subprocess
        m2t = midirender_util.bmidirenderdirectory + '\\timidity\\m2t.exe'
        t2m = midirender_util.bmidirenderdirectory + '\\timidity\\t2m.exe'
        notepadexe = 'C:\\Windows\\System32\\notepad.exe'
        if not os.path.exists(m2t) or not os.path.exists(
                t2m) or not os.path.exists(notepadexe):
            midirender_util.alert('Could not find %s or %s or %s.' %
                                  (m2t, t2m, notepadexe))
            return

        filenameMidInput = midirender_util.ask_openfile(
            title='Choose Midi File to modify', types=['.mid|Mid file'])
        if not filenameMidInput:
            return

        filenameText = tempfile.gettempdir() + os.sep + 'tmpout.txt'
        try:
            if os.path.exists(filenameText):
                os.unlink(filenameText)
        except:
            pass
        if os.path.exists(filenameText):
            midirender_util.alert('Could not clear temporary file')
            return

        args = [m2t, filenameMidInput, filenameText]
        retcode = subprocess.call(args, creationflags=0x08000000)
        if retcode:
            midirender_util.alert('Midi to text returned failure')
            return
        if not os.path.exists(filenameText):
            midirender_util.alert('Midi to text did not write text file')
            return

        midirender_util.alert(
            "You'll see the text file in notepad. Save and close when done editing."
        )
        modtimebefore = os.path.getmtime(filenameText)
        args = [notepadexe, filenameText]
        retcode = subprocess.call(args)
        if modtimebefore == os.path.getmtime(filenameText):
            # looks like the user cancelled before making any edits
            return

        filenameMidOutput = midirender_util.ask_savefile(
            title="Choose destination for Midi File", types=['.mid|Mid file'])
        if not filenameMidOutput: return

        args = [t2m, filenameText, filenameMidOutput]
        retcode = subprocess.call(args, creationflags=0x08000000)
        if retcode:
            midirender_util.alert('text to midi returned failure')
            return
        if not os.path.exists(filenameMidOutput):
            midirender_util.alert('text to midi did not write midi file')
            return
        midirender_util.alert('Complete.')