diff options
author | Oli <olivier.belanger@umontreal.ca> | 2007-07-20 23:29:53 (GMT) |
---|---|---|
committer | Oli <olivier.belanger@umontreal.ca> | 2007-07-20 23:29:53 (GMT) |
commit | 88cd0106879984d484bdb711dfe2e1f9616beebf (patch) | |
tree | 27edef4ed7e363ddf427e6d9e1727d12ad7fadc7 | |
parent | 6feac855a14b2843580296b6fa6c0d0a5f1975a0 (diff) |
loop settings
-rw-r--r-- | Config.py | 16 | ||||
-rw-r--r-- | Util/CSoundClient.py | 2 | ||||
-rw-r--r-- | Util/Instrument.py | 7 | ||||
-rw-r--r-- | Util/InstrumentPanel.py | 73 | ||||
-rw-r--r-- | Util/LoopSettings.py | 84 | ||||
-rw-r--r-- | miniTamTam/KeyboardStandAlone.py | 57 |
6 files changed, 137 insertions, 102 deletions
@@ -92,7 +92,7 @@ INST_TIED = 5001 INST_SIMP = 5011 INST_PERC = 5021 -CATEGORIES = ['all','animals','concret','electronic','keyboard','people','percussions','strings','winds'] +CATEGORIES = ['all','animals','concret','keyboard','people','percussions','strings','winds', 'mysounds'] _nextInstrumentId = [0] INSTRUMENTS = {} @@ -101,6 +101,7 @@ def _addInstrument( name, csoundInstrumentId, instrumentRegister, soundClass, ca INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, kit ) _nextInstrumentId[0] += 1 + _addInstrument( "mic1", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 ) _addInstrument( "mic2", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 ) _addInstrument( "mic3", INST_TIED, MID, 'melo', 'mic', .01, 1.99, .01 ) @@ -167,14 +168,14 @@ _addInstrument( "clang", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ) _addInstrument( "ow", INST_SIMP, MID, 'melo', 'people', 0, 0, 0 ) _addInstrument( "sheep", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ) _addInstrument( "water", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ) -_addInstrument( "zap", INST_TIED, MID, 'melo', 'electronic', .299, .7323, .09895 ) +_addInstrument( "zap", INST_TIED, MID, 'melo', 'keyboard', .299, .7323, .09895 ) _addInstrument( "trumpet", INST_TIED, MID, 'melo', 'winds', .39934, .45537, .02729) _addInstrument( "bubbles", INST_TIED, MID, "melo", 'concret', 0.02, 1.177, 0.02) _addInstrument( "marimba", INST_TIED, MID, "melo", 'percussions', .26545, .33098, .03087) _addInstrument( "triangle", INST_TIED, MID, "melo", 'percussions', 1.21002, 1.31805, .01268) _addInstrument( "laugh", INST_SIMP, MID, 'melo', 'people', 0, 0, 0 ) _addInstrument( "voix", INST_TIED, MID, 'melo', 'people', .89608, .96092, .02343 ) -_addInstrument( "cling", INST_TIED, MID, 'melo', 'electronic', .09096, .7878, .18026 ) +_addInstrument( "cling", INST_TIED, MID, 'melo', 'keyboard', .09096, .7878, .18026 ) _addInstrument( "byke", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ) _addInstrument( "door", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ) _addInstrument( "basse", INST_TIED, MID, 'melo', 'strings', .58455, .67433, .03638 ) @@ -236,6 +237,15 @@ _addInstrument( "guit2", INST_TIED, MID, 'melo', 'strings', .33, 1.1583, .02 ) _addInstrument( "plane", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ) _addInstrument( "slap", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ) +try: + ifile = open(PREF_DIR + '/sounds_settings', 'r') + for line in ifile.readlines(): + list = line.split() + _addInstrument(list[0], int(list[1]), int(list[2]), list[3], list[4], float(list[5]), float(list[6]), float(list[7])) +except: + pass + + DRUM1KIT = { 24 : INSTRUMENTS["drum1kick"], 26 : INSTRUMENTS["drum1floortom"], 28 : INSTRUMENTS["drum1tom"], diff --git a/Util/CSoundClient.py b/Util/CSoundClient.py index c52cad1..0a10d21 100644 --- a/Util/CSoundClient.py +++ b/Util/CSoundClient.py @@ -81,7 +81,7 @@ class _CSoundClientPlugin: def load_instruments( self ): for instrumentSoundFile in Config.INSTRUMENTS.keys(): - if instrumentSoundFile[0:3] == 'mic' or instrumentSoundFile[0:3] == 'lab': + if instrumentSoundFile[0:3] == 'mic' or instrumentSoundFile[0:3] == 'lab' or Config.INSTRUMENTS[instrumentSoundFile].category == 'mysounds': fileName = Config.SNDS_DIR + '/' + instrumentSoundFile else: fileName = Config.SOUNDS_DIR + "/" + instrumentSoundFile diff --git a/Util/Instrument.py b/Util/Instrument.py index f3d835d..5bc74b3 100644 --- a/Util/Instrument.py +++ b/Util/Instrument.py @@ -187,9 +187,9 @@ if drum_load_dynamic: else: KIT = { 'drum1kit' : [ 'drum1kick', 'drum1floortom', 'drum1tom', - 'drum1chine', 'drum1splash', 'drum1crash', + 'drum1chine', 'drum1splash', 'drum1crash', 'drum1snaresidestick', 'drum1snaresidestick', 'drum1snare', - 'drum1ridebell', 'drum1hardride', 'drum1hatshoulder', + 'drum1ridebell', 'drum1hardride', 'drum1hatshoulder', 'drum1hatpedal'], 'drum2kit' : [ "drum2darbukadoom", "drum2darbukapied", "drum2darbukapiedsoft", "drum2hatflanger", "drum2darbukatak", "drum2darbukatak", @@ -343,7 +343,7 @@ if 0: for kitpath in kitpaths: kitidx = int( kitpath[4] ) print kitpath, kitidx - exec "DRUM%iKIT = {} ; curkit = DRUM%iKIT" % (kitidx,kitidx) + exec "DRUM%iKIT = {} ; curkit = DRUM%iKIT" % (kitidx,kitidx) name = kitpath[0:-4] kitfile = file('snd/'+ kitpath, 'r') line = kitfile.readline() @@ -390,4 +390,3 @@ if 0: "mic2" : 8, "mic3" : 9, "mic4" : 10 } - diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py index 5a14a0c..a3a95fe 100644 --- a/Util/InstrumentPanel.py +++ b/Util/InstrumentPanel.py @@ -13,7 +13,7 @@ Tooltips = Config.Tooltips class InstrumentPanel( gtk.EventBox ): def __init__(self,setInstrument = None, playInstrument = None, enterMode = False, micRec = None, synthRec = None, rowLen = 8, _instDic = None, force_load = True ): gtk.EventBox.__init__(self) - + self.setInstrument = setInstrument self.playInstrument = playInstrument self.micRec = micRec @@ -29,12 +29,12 @@ class InstrumentPanel( gtk.EventBox ): if force_load: self.load() def configure( self, setInstrument = None, playInstrument = None, enterMode = False, micRec = None, synthRec = None, rowLen = 8 ): - + self.setInstrument = setInstrument self.playInstrument = playInstrument self.enterMode = enterMode self.micRec = micRec - + if self.rowLen != rowLen: self.rowLen = rowLen self.prepareInstrumentTable( self.category ) @@ -83,23 +83,23 @@ class InstrumentPanel( gtk.EventBox ): self.loadStage[0] = 5.1 else: self.loadStage[0] = 6 - + if self.loadStage[0] == 5.1: if not self.loadInstDic( self.instDic, timeout, self.loadStage ): return False self.loadStage[0] = 6 if timeout >= 0 and time.time() > timeout: return False - + if self.loadStage[0] == 6: self.loadInstrumentViewport() self.loadStage[0] = 7 if timeout >= 0 and time.time() > timeout: return False - + if self.loadStage[0] == 7: self.prepareInstrumentTable() self.loadStage[0] = 8 if timeout >= 0 and time.time() > timeout: return False - + self.add(self.mainVBox) self.show_all() @@ -107,7 +107,7 @@ class InstrumentPanel( gtk.EventBox ): return True def loadInstrumentList( self, timeout = -1, loadStage = [0,0,0] ): - + if loadStage[1] == 0: self.instrumentList = { "all": [], "all.enterMode": [], "percussions.enterMode": [], "lab": [], "mic": [], "kit": [] } for category in Config.CATEGORIES: @@ -143,11 +143,11 @@ class InstrumentPanel( gtk.EventBox ): self.instrumentList["all.enterMode"] += self.instrumentList["mic"] + self.instrumentList["lab"] self.instrumentList["percussions"] += self.instrumentList["kit"] self.instrumentList["people"] += self.instrumentList["mic"] - self.instrumentList["electronic"] += self.instrumentList["lab"] + self.instrumentList["keyboard"] += self.instrumentList["lab"] loadStage[1] = 0 return True - + def loadToolbar( self, timeout = -1, loadStage = [0,0,0] ): if loadStage[1] == 0: self.loadData["toolbarBox"] = gtk.HBox() @@ -177,7 +177,7 @@ class InstrumentPanel( gtk.EventBox ): loadStage[2] = 0 loadStage[1] += 1 if timeout >= 0 and time.time() > timeout: return False - + self.mainVBox.pack_start(self.loadData["toolbarBox"],False,False) self.loadData.pop("btn") @@ -194,7 +194,7 @@ class InstrumentPanel( gtk.EventBox ): loadStage[1] = 1 if timeout >= 0 and time.time() > timeout: return False - + for i in range( loadStage[1]-1, self.loadData["len"] ): instrument = self.instrumentList["all"][i] if loadStage[2] == 0: @@ -204,7 +204,10 @@ class InstrumentPanel( gtk.EventBox ): if timeout >= 0 and time.time() > timeout: return False if loadStage[2] == 1: - self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png') + try: + self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png') + except: + self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + 'generic.png' , Config.IMAGE_ROOT + 'genericsel.png', Config.IMAGE_ROOT + 'genericsel.png') loadStage[2] = 2 if timeout >= 0 and time.time() > timeout: return False @@ -228,7 +231,7 @@ class InstrumentPanel( gtk.EventBox ): self.loadData.pop("len") loadStage[1] = 0 return True - + def loadInstrumentViewport( self ): self.instrumentBox = RoundHBox(fillcolor = Config.INSTRUMENT_GRID_COLOR, bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS) @@ -244,10 +247,10 @@ class InstrumentPanel( gtk.EventBox ): self.instrumentBox.pack_start(self.scrollWin,True,True,0) self.mainVBox.pack_start(self.instrumentBox) self.show_all() - + def prepareInstrumentTable(self,category = 'all'): - - self.category = category + + self.category = category if self.enterMode: if category == "all": category = "all.enterMode" @@ -261,14 +264,14 @@ class InstrumentPanel( gtk.EventBox ): instrumentNum = len(self.instrumentList[category]) instruments = self.instrumentList[category] - + cols = self.rowLen if instrumentNum < cols: cols = instrumentNum rows = (instrumentNum // cols) if instrumentNum % cols is not 0: #S'il y a un reste rows = rows + 1 - + self.instTable = gtk.Table(rows,cols,True) self.instTable.set_row_spacings(0) self.instTable.set_col_spacings(0) @@ -279,35 +282,35 @@ class InstrumentPanel( gtk.EventBox ): break instBox = self.instDic[instruments[row*cols+col]] self.instTable.attach(instBox, col, col+1, row, row+1, gtk.SHRINK, gtk.SHRINK, 0, 0) - + self.tableEventBox.add(self.instTable) self.instTable.show_all() - + def selectFirstCat(self): self.firstTbBtn.set_active(True) - + def handleToolbarBtnPress(self, widget, category): - if widget.get_active(): + if widget.get_active(): self.prepareInstrumentTable(category) def handleInstrumentButtonClick(self,widget,instrument): if widget.get_active() is True and self.recstate == False: - if self.setInstrument: + if self.setInstrument: widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event self.setInstrument(instrument) if self.playInstrument: self.playInstrument(instrument) if self.enterMode: pass #Close the window - + def handleInstrumentButtonEnter(self,widget,instrument): - if self.enterMode and self.playInstrument: + if self.enterMode and self.playInstrument: self.playInstrument(instrument) - + def handleMicRecButtonClick(self,widget,mic): self.recstate = False self.setInstrument(mic) if self.micRec: self.micRec(mic) - + def handleRecButtonPress(self,widget,btn): self.recstate = True btn.set_active(True) @@ -320,14 +323,14 @@ class InstrumentPanel( gtk.EventBox ): btn.handler_block(btn.clickedHandler) btn.set_active(state) btn.handler_unblock(btn.clickedHandler) - - + + class DrumPanel( gtk.EventBox ): def __init__(self, setDrum = None): gtk.EventBox.__init__(self) color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR) self.modify_bg(gtk.STATE_NORMAL, color) - + self.setDrum = setDrum self.instrumentList = [] keys = Config.INSTRUMENTS.keys() @@ -336,7 +339,7 @@ class DrumPanel( gtk.EventBox ): self.instrumentList.append( key ) self.instrumentList.sort() self.drawDrums() - + def drawDrums(self): firstBtn = None btnBox = RoundHBox(fillcolor = '#6F947B', bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS) @@ -353,10 +356,10 @@ class DrumPanel( gtk.EventBox ): btnBox.pack_start(instBox, False, False, 0) self.add(btnBox) self.show_all() - + def setDrums(self,widget,data): if widget.get_active(): - if self.setDrum: + if self.setDrum: widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event self.setDrum(data) @@ -367,7 +370,7 @@ class DrumPanel( gtk.EventBox ): btn.set_active(state) btn.handler_unblock(btn.clickedHandler) -if __name__ == "__main__": +if __name__ == "__main__": win = gtk.Window() wc = DrumPanel(None) win.add(wc) diff --git a/Util/LoopSettings.py b/Util/LoopSettings.py index ce92708..f90966e 100644 --- a/Util/LoopSettings.py +++ b/Util/LoopSettings.py @@ -21,22 +21,22 @@ class LoopSettings( gtk.VBox ): self.settingsBox = gtk.HBox() self.pack_start(self.settingsBox) - + self.fixed = gtk.Fixed() self.settingsBox.pack_start(self.fixed) - + self.mainBox = gtk.VBox() - + self.controlsBox = gtk.HBox() self.GUI = {} - + nameBox = gtk.VBox() self.nameEntry = gtk.Entry() self.nameEntry.set_text("name_of_the_sound") nameBox.pack_start(self.nameEntry) self.mainBox.pack_start(nameBox, False, False, 5) - + loopedBox = gtk.HBox() loopedLabel = gtk.Label("Looped sound: ") loopedBox.pack_start(loopedLabel) @@ -44,8 +44,8 @@ class LoopSettings( gtk.VBox ): loopedToggle.connect('button-press-event', self.handleLooped ) loopedBox.pack_start(loopedToggle) self.mainBox.pack_start(loopedBox, False, False, 5) - - categoryBox = gtk.HBox() + + categoryBox = gtk.HBox() categoryMenu = gtk.MenuBar() cmenu = gtk.Menu() for cat in Config.CATEGORIES: @@ -58,8 +58,8 @@ class LoopSettings( gtk.VBox ): self.categoryButton.connect_object("event", self.categoryBtnPress, cmenu) categoryBox.pack_end(self.categoryButton) self.mainBox.pack_start(categoryBox, False, False, 5) - - registerBox = gtk.HBox() + + registerBox = gtk.HBox() registerMenu = gtk.MenuBar() rmenu = gtk.Menu() self.registerList = ['LOW', 'MID', 'HIGH', 'PUNCH'] @@ -71,8 +71,8 @@ class LoopSettings( gtk.VBox ): self.registerButton = gtk.Button("Register") self.registerButton.connect_object("event", self.registerBtnPress, rmenu) registerBox.pack_end(self.registerButton) - self.mainBox.pack_start(registerBox, False, False, 5) - + self.mainBox.pack_start(registerBox, False, False, 5) + startBox = gtk.VBox() self.startAdjust = gtk.Adjustment( 0.01, 0, 1., .001, .001, 0) self.GUI['startSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.startAdjust, 7 ) @@ -81,11 +81,11 @@ class LoopSettings( gtk.VBox ): self.GUI['startSlider'].set_size_request(50, 200) self.startEntry = gtk.Entry() self.startEntry.set_width_chars(5) - self.handleStart( self.startAdjust ) + self.handleStart( self.startAdjust ) startBox.pack_start(self.GUI['startSlider'], True, True, 5) startBox.pack_start(self.startEntry, True, True, 5) self.controlsBox.pack_start(startBox) - + endBox = gtk.VBox() self.endAdjust = gtk.Adjustment( 0.9, 0, 1, .001, .001, 0) self.GUI['endSlider'] = ImageVScale( Config.TAM_TAM_ROOT + "/Resources/Images/sliderEditVolume.png", self.endAdjust, 7 ) @@ -97,7 +97,7 @@ class LoopSettings( gtk.VBox ): self.handleEnd( self.endAdjust ) endBox.pack_start(self.GUI['endSlider'], True, True, 5) endBox.pack_start(self.endEntry, True, True, 5) - self.controlsBox.pack_start(endBox) + self.controlsBox.pack_start(endBox) durBox = gtk.VBox() self.durAdjust = gtk.Adjustment( 0.01, 0, 0.2, .001, .001, 0) @@ -111,59 +111,83 @@ class LoopSettings( gtk.VBox ): durBox.pack_start(self.GUI['durSlider'], True, True, 5) durBox.pack_start(self.durEntry, True, True, 5) self.controlsBox.pack_start(durBox) - + self.mainBox.pack_start(self.controlsBox, False, False, 5) - + previewBox = gtk.VBox() self.playStopButton = ImageToggleButton(Config.IMAGE_ROOT + 'miniplay.png', Config.IMAGE_ROOT + 'stop.png') self.playStopButton.connect('button-press-event' , self.handlePlayButton) previewBox.pack_start(self.playStopButton) self.mainBox.pack_start(previewBox, False, False, 5) - + + checkBox = gtk.VBox() + checkButton = ImageButton(Config.IMAGE_ROOT + 'check.png') + checkButton.connect('clicked' , self.handleCheck) + checkBox.pack_start(checkButton) + self.mainBox.pack_start(checkBox, False, False, 5) + self.fixed.put( self.mainBox, 0, 0 ) - + self.show_all() - + + def handleCheck(self, widget): + ofile = open(Config.PREF_DIR + "/sounds_settings", 'a') + name = self.nameEntry.get_text() + if self.loopedSound: + tied = str(Config.INST_TIED) + else: + tied = str(Config.INST_SIMP) + register = str(self.register) + melo = 'melo' + category = 'mysounds' + start = str(self.start) + end = str(self.end) + dur = str(self.dur) + + ofile.write(name + ' ' + tied + ' ' + register + ' ' + melo + ' ' + category + ' ' + start + ' ' + end + ' ' + dur + '\n') + + ofile.close() + def set_values(self, name, soundLength): self.nameEntry.set_text(name) self.soundLength = soundLength self.handleStart(self.GUI['startSlider']) self.handleEnd(self.GUI['endSlider']) - + def handleLooped(self, widget, data=None): if widget.get_active() == True: self.loopedSound = False else: self.loopedSound = True - + def categoryBtnPress(self, widget, event): if event.type == gtk.gdk.BUTTON_PRESS: widget.popup(None, None, None, event.button, event.time) return True return False - + def handleCategory(self, widget, category): self.category = category self.categoryButton.set_label(self.category) - + def registerBtnPress(self, widget, event): if event.type == gtk.gdk.BUTTON_PRESS: widget.popup(None, None, None, event.button, event.time) return True - return False + return False def handleRegister(self, widget, register): self.register = register self.registerButton.set_label(self.registerList[self.register]) - + def handleStart(self, widget, data=None): self.startSlider = self.startAdjust.value self.start = self.startSlider * self.soundLength if self.start > self.end: - self.start = self.end + self.start = self.end self.startEntry.set_text(str(self.start)) self.setChannel('lstart', self.start) - + def handleEnd(self, widget, data=None): self.endSlider = self.endAdjust.value self.end = self.endSlider * self.soundLength @@ -171,17 +195,17 @@ class LoopSettings( gtk.VBox ): self.end = self.start self.endEntry.set_text(str(self.end)) self.setChannel('lend', self.end) - + def handleDur(self, widget, data=None): self.dur = self.durAdjust.value self.durEntry.set_text(str(self.dur)) self.setChannel('ldur', self.dur) - + def handlePlayButton(self, widget, data=None): self.playFunction(widget.get_active(), self.loopedSound) if self.loopedSound == False and widget.get_active() == False: self.timeoutStop = gobject.timeout_add(int(self.soundLength * 1000), self.playButtonState) - + def playButtonState(self): # something's weird here self.playStopButton.set_active(True) diff --git a/miniTamTam/KeyboardStandAlone.py b/miniTamTam/KeyboardStandAlone.py index eb4ea7f..a420a80 100644 --- a/miniTamTam/KeyboardStandAlone.py +++ b/miniTamTam/KeyboardStandAlone.py @@ -15,7 +15,7 @@ KEY_MAP_PIANO = Config.KEY_MAP_PIANO class KeyboardStandAlone: def __init__( self, recordingFunction, adjustDurationFunction, getCurrentTick, getPlayState, loop ): - self.csnd = new_csound_client() + self.csnd = new_csound_client() self.recording = recordingFunction self.adjustDuration = adjustDurationFunction self.getPlayState = getPlayState @@ -27,18 +27,18 @@ class KeyboardStandAlone: self.loop = loop self.loopSustain = False self.sustainedLoop = [] - + def setInstrument( self , instrument ): self.instrument = instrument - + def setReverb(self , reverb): self.reverb = reverb - + def onKeyPress(self,widget,event, volume): key = event.hardware_keycode - if key == 50: #Left Shift + if key == 50 or key == 62: #Left Shift self.loopSustain = True - + # If the key is already in the dictionnary, exit function (to avoir key repeats) if self.key_dict.has_key(key): return @@ -54,7 +54,7 @@ class KeyboardStandAlone: self.loop.start(key, self.instrument, self.reverb) return - # Assign on which track the note will be created according to the number of keys pressed + # Assign on which track the note will be created according to the number of keys pressed if self.trackCount >= 9: self.trackCount = 1 track = self.trackCount @@ -63,29 +63,29 @@ class KeyboardStandAlone: if KEY_MAP_PIANO.has_key(key): def playkey(pitch,duration,instrument): # Create and play the note - self.key_dict[key] = CSoundNote(onset = 0, - pitch = pitch, - amplitude = volume, - pan = 0.5, - duration = duration, - trackId = track, - instrumentId = instrument.instrumentId, + self.key_dict[key] = CSoundNote(onset = 0, + pitch = pitch, + amplitude = volume, + pan = 0.5, + duration = duration, + trackId = track, + instrumentId = instrument.instrumentId, reverbSend = self.reverb, tied = True, - mode = 'mini') + mode = 'mini') self.csnd.play(self.key_dict[key], 0.3) if self.getPlayState(): recOnset = int(self.csnd.loopGetTick()) self.onset_dict[key] = recOnset self.recording( CSoundNote( - onset = recOnset, - pitch = pitch, - amplitude = volume, - pan = 0.5, - duration = 100, + onset = recOnset, + pitch = pitch, + amplitude = volume, + pan = 0.5, + duration = 100, trackId = 0, - decay = .1, - instrumentId = instrument.instrumentId, + decay = .1, + instrumentId = instrument.instrumentId, reverbSend = self.reverb, tied = False, mode = 'mini')) @@ -94,8 +94,8 @@ class KeyboardStandAlone: #print >>log, 'instrumentName:', instrumentName pitch = KEY_MAP_PIANO[key] - if instrumentName in Instrument.KIT: - #print >>log, 'kit_element: ', Config.KIT_ELEMENT[pitch] + if instrumentName in Instrument.KIT: + #print >>log, 'kit_element: ', Config.KIT_ELEMENT[pitch] playkey(36,100, Instrument.KIT[instrumentName][ Config.KIT_ELEMENT[pitch] ] ) else: @@ -108,19 +108,19 @@ class KeyboardStandAlone: else: playkey( pitch, -1, instrument) - + def onKeyRelease(self,widget,event): key = event.hardware_keycode if key == 50: self.loopSustain = False - + if key in Config.LOOP_KEYS: if key in self.sustainedLoop: return else: self.loop.stop(key) return - + if KEY_MAP_PIANO.has_key(key): csnote = self.key_dict[key] if Instrument.INST_byId[ csnote.instrumentId ].csoundInstrumentName == 'inst_tied': @@ -136,7 +136,6 @@ class KeyboardStandAlone: if self.getPlayState(): if self.onset_dict.has_key(key): del self.onset_dict[key] - + def onButtonPress( self, widget, event ): pass - |