diff options
author | amartin <olpc@localhost.localdomain> | 2007-03-04 19:09:56 (GMT) |
---|---|---|
committer | amartin <olpc@localhost.localdomain> | 2007-03-04 19:09:56 (GMT) |
commit | 44ae765f4727196c4455148efc0849511e1e4aeb (patch) | |
tree | 4a31d69f7b5d4cda003d1df5936608c5bd3598f7 | |
parent | 39da26fa4a371868e21c6e3e0083161cf7b9efbe (diff) | |
parent | 90fd4e1f17ea44f5886c8714cc085f69ea068695 (diff) |
Merge branch 'master' of git+ssh://amartin@dev.laptop.org/git/projects/tamtam
-rw-r--r-- | Resources/univorc.csd | 41 | ||||
-rw-r--r-- | Util/CSoundClient.py | 29 | ||||
-rw-r--r-- | Util/CSoundNote.py | 99 | ||||
-rw-r--r-- | miniTamTam/KeyboardStandAlone.py | 6 | ||||
-rw-r--r-- | miniTamTam/miniTamTamMain.py | 4 |
5 files changed, 110 insertions, 69 deletions
diff --git a/Resources/univorc.csd b/Resources/univorc.csd index 2037cb1..900e6ba 100644 --- a/Resources/univorc.csd +++ b/Resources/univorc.csd @@ -642,7 +642,7 @@ endin /**************************************************************** -Soundfile player with tied notes +Soundfile player with miniTamTam's tied notes ****************************************************************/ instr 5999 @@ -719,7 +719,7 @@ kcd portk p15, igliss, p15 kpitchBend port gkTrackpadX, .03, i(gkTrackpadX) kampBend port gkTrackpadY, .03, i(gkTrackpadY) -a1 flooper2 1*(1+kampBend)+ktremolo, kpitch*(1+kpitchBend)+kvibrato, kls, kle, kcd, p8, 0, 0, 0, iskip +a1 flooper2 (1+kampBend)+ktremolo, kpitch*(1+kpitchBend)+kvibrato, kls, kle, kcd, p8, 0, 0, 0, iskip if (p11-1) != -1 then acomp = a1 @@ -737,6 +737,42 @@ gainrev = a1*krg+gainrev tieskip: endin + +/************************* +Soundfile player with edit's looped notes +*************************/ +instr 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110 + +iTrackId = int(p1-5101) +SvolTrackName2 sprintf "trackVolume%0d", iTrackId +kvol chnget SvolTrackName2 +kvol = kvol * 0.01 +kvol port kvol, .01, i(kvol) + +itreRand random 4, 6 +ivibRand random 4.1, 5.7 + +ktremolo oscil .15, itreRand, 1 +kvibrato oscil .006, ivibRand, 1 + +a1 flooper2 1+ktremolo, p4+kvibrato, p13, p14, p15, p8, 0, 0, 0 + +if (p11-1) != -1 then +acomp = a1 +a1 bqrez a1, p12, 6, p11-1 +a1 balance a1, acomp +endif + +kenv adsr p9, 0.05, p6, p10 +a1 = a1*kenv*kvol + +gaoutL = a1*(1-p7)+gaoutL +gaoutR = a1*p7+gaoutR + +gainrev = a1*p5+gainrev + +endin + /************************************************************** Simple soundfile player **************************************************************/ @@ -754,6 +790,7 @@ event_i "i", p4, i2, p6, p7, p8, p9, p10, p11, p12, p13, p14 endin instr 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020 + iTrackId = int(p1-5011) SvolTrackName1 sprintf "trackVolume%0d", iTrackId kvol chnget SvolTrackName1 diff --git a/Util/CSoundClient.py b/Util/CSoundClient.py index d50235a..8a99e1b 100644 --- a/Util/CSoundClient.py +++ b/Util/CSoundClient.py @@ -157,6 +157,7 @@ class _CSoundClientPlugin: def loopPlay(self, dbnote, active): qid = (dbnote.page << 16) + dbnote.id sc_loop_addScoreEvent( qid, 1, active, 'i', self.csnote_to_array(dbnote.cs)) + def play(self, csnote, secs_per_tick): a = self.csnote_to_array(csnote) a[self.DURATION] = a[self.DURATION] * secs_per_tick @@ -179,8 +180,8 @@ class _CSoundClientPlugin: csnote.filterType, csnote.filterCutoff, csnote.tied, - csnote.overlap, - csnote.instrumentId) + csnote.instrumentId, + csnote.mode) INSTR_TRACK=0 ONSET=1 @@ -202,8 +203,8 @@ class _CSoundClientPlugin: filterType = 0, filterCutoff = 1000, tied = False, - overlap = False, - instrumentId = Config.INSTRUMENTS["flute"].instrumentId ): + instrumentId = Config.INSTRUMENTS["flute"].instrumentId, + mode = 'edit' ): instrument = Config.INSTRUMENTSID[instrumentId] if instrument.kit != None: @@ -212,25 +213,21 @@ class _CSoundClientPlugin: time_in_ticks = 0 else: pitch = GenerationConstants.TRANSPOSE[ pitch - 24 ] - - # condition for tied notes - if instrument.csoundInstrumentId == 101 and tied and fullDuration: - duration= -1.0 - # condition for overlaped notes - if instrument.csoundInstrumentId == 102 and overlap: - duration += 1.0 time_in_ticks = 1 + instrument_offset = 0 # condition for tied notes - if instrument.csoundInstrumentId == Config.INST_TIED and tied and fullDuration: + if instrument.csoundInstrumentId == Config.INST_TIED and tied and mode == 'mini': duration = -1 - # condition for overlaped notes - if instrument.csoundInstrumentId == Config.INST_PERC and overlap: - duration = duration + 1.0 + instrument_offset = 0 + elif instrument.csoundInstrumentId == Config.INST_TIED and not tied and mode == 'mini': + instrument_offset = 0 + elif instrument.csoundInstrumentId == Config.INST_TIED and mode == 'edit': + instrument_offset = 100 a = array.array('f') a.extend( [ - (instrument.csoundInstrumentId + trackId) + trackId * 0.01, + (instrument.csoundInstrumentId + trackId + instrument_offset) + trackId * 0.01, onset, duration, pitch, diff --git a/Util/CSoundNote.py b/Util/CSoundNote.py index 226ed51..f1c9d85 100644 --- a/Util/CSoundNote.py +++ b/Util/CSoundNote.py @@ -21,7 +21,7 @@ class CSoundNote : filterType = 0, filterCutoff = 1000, tied = False, - overlap = False ): + mode = 'edit' ): self.onset = onset self.pitch = pitch @@ -39,7 +39,7 @@ class CSoundNote : self.filterType = filterType self.filterCutoff = filterCutoff self.tied = tied - self.overlap = overlap + self.mode = mode self.nchanges = 0 self.noteId = self.NOTE_ID_COUNTER self.NOTE_ID_COUNTER += 1 @@ -59,7 +59,7 @@ class CSoundNote : 'filterType': self.filterType, 'filterCutoff': self.filterCutoff, 'tied': self.tied, - 'overlap': self.overlap } + 'mode': self.mode } def __setstate__(self,dict): self.onset = dict['onset'] @@ -76,58 +76,59 @@ class CSoundNote : self.filterType = dict['filterType'] self.filterCutoff = dict['filterCutoff'] self.tied = dict['tied'] - self.overlap = dict['overlap'] + self.mode = dict['mode'] self.nchanges = 0 def clone( self ): return CSoundNote( self.onset, self.pitch, self.amplitude, self.pan, self.duration, self.trackId, self.fullDuration, self.instrumentId, - self.attack, self.decay, self.reverbSend, self.filterType, self.filterCutoff, self.tied, self.overlap ) + self.attack, self.decay, self.reverbSend, self.filterType, self.filterCutoff, self.tied, self.mode ) - def getText( self, secs_per_tick, delay ): - if secs_per_tick > 1 : raise 'invalid secs_per_tick' - if Config.INSTRUMENTSID[self.instrumentId].kit != None: - instr = Config.INSTRUMENTSID[self.instrumentId].key[self.pitch] - newPitch = 1 - else: - instr = self.INSTRUMENTSID[self.instrumentId] - newPitch = pow( GenerationConstants.TWO_ROOT_TWELVE, self.pitch - 36 ) - newDuration = secs_per_tick * self.duration +# def getText( self, secs_per_tick, delay ): +# if secs_per_tick > 1 : raise 'invalid secs_per_tick' +# if Config.INSTRUMENTSID[self.instrumentId].kit != None: +# instr = Config.INSTRUMENTSID[self.instrumentId].key[self.pitch] +# newPitch = 1 +# else: +# instr = self.INSTRUMENTSID[self.instrumentId] +# newPitch = pow( GenerationConstants.TWO_ROOT_TWELVE, self.pitch - 36 ) +# +# newDuration = secs_per_tick * self.duration +# +# # condition for tied notes +# if instr.csoundInstrumentId == 101 and self.tied and self.fullDuration: +# newDuration = -1 +# # condition for overlaped notes +# if instr.csoundInstrumentId == 102 and self.overlap: +# newDuration = oneTickDuration * self.duration + 1. +# +# if True: newAmplitude = self.amplitude * 0.8 +# else : newAmplitude = self.amplitude * music_volume_get( self.trackId ) +# +# newAttack = newDuration * self.attack +# if newAttack <= 0.002: +# newAttack = 0.002 +# +# newDecay = newDuration * self.decay +# if newDecay <= 0.002: +# newDecay = 0.002 - # condition for tied notes - if instr.csoundInstrumentId == 101 and self.tied and self.fullDuration: - newDuration = -1 - # condition for overlaped notes - if instr.csoundInstrumentId == 102 and self.overlap: - newDuration = oneTickDuration * self.duration + 1. - - if True: newAmplitude = self.amplitude * 0.8 - else : newAmplitude = self.amplitude * music_volume_get( self.trackId ) - - newAttack = newDuration * self.attack - if newAttack <= 0.002: - newAttack = 0.002 - - newDecay = newDuration * self.decay - if newDecay <= 0.002: - newDecay = 0.002 - - return Config.PLAY_NOTE_COMMAND % ( \ - instr.csoundInstrumentId, - self.trackId, - delay, - newDuration, - newPitch, - self.reverbSend, - newAmplitude, - self.pan, - Config.INSTRUMENT_TABLE_OFFSET+instr.instrumentId, - newAttack, - newDecay, - self.filterType, - self.filterCutoff, - instr.loopStart, - instr.loopEnd, - instr.crossDur ) +# return Config.PLAY_NOTE_COMMAND % ( \ +# instr.csoundInstrumentId, +# self.trackId, +# delay, +# newDuration, +# newPitch, +# self.reverbSend, +# newAmplitude, + # self.pan, +# Config.INSTRUMENT_TABLE_OFFSET+instr.instrumentId, +# newAttack, +# newDecay, +# self.filterType, +# self.filterCutoff, +# instr.loopStart, +# instr.loopEnd, +# instr.crossDur ) diff --git a/miniTamTam/KeyboardStandAlone.py b/miniTamTam/KeyboardStandAlone.py index 2a146cf..e418d69 100644 --- a/miniTamTam/KeyboardStandAlone.py +++ b/miniTamTam/KeyboardStandAlone.py @@ -71,7 +71,9 @@ class KeyboardStandAlone: trackId = track, fullDuration = False, instrumentId = Config.INSTRUMENTS[instrument].instrumentId, - reverbSend = self.reverb) + reverbSend = self.reverb, + tied = True, + mode = 'mini') self.csnd.play(self.key_dict[key], 0.3) #self.key_dict[key].playNow(0.3) if self.getPlayState(): @@ -99,6 +101,8 @@ class KeyboardStandAlone: csnote.duration = .5 csnote.decay = 0.7 csnote.amplitude = 1 + csnote.tied = False + csnote.mode = 'mini' self.csnd.play(csnote, 0.3) if self.getPlayState(): self.adjustDuration(csnote.pitch, self.onset_dict[key]) diff --git a/miniTamTam/miniTamTamMain.py b/miniTamTam/miniTamTamMain.py index 40e0756..4dfb4f9 100644 --- a/miniTamTam/miniTamTamMain.py +++ b/miniTamTam/miniTamTamMain.py @@ -367,7 +367,9 @@ class miniTamTamMain(SubActivity): trackId = 1, fullDuration = False, instrumentId = Config.INSTRUMENTS[instrument].instrumentId, - reverbSend = 0), + reverbSend = 0, + tied = False, + mode = 'mini'), secs_per_tick) def onKeyPress(self, widget, event): |