diff options
author | James <olpc@localhost.localdomain> | 2007-02-19 06:46:31 (GMT) |
---|---|---|
committer | James <olpc@localhost.localdomain> | 2007-02-19 06:46:31 (GMT) |
commit | 85619d4504d98ee44a08ef0a1ae3a8c74dcaf9c8 (patch) | |
tree | 5621dc50a256cc77669a08ad6c4da46a6a45c979 /Util/CSoundNote.py | |
parent | 6205108acf91e48f7ea9c193ffc4a537afb976e0 (diff) |
slightly better notes playback
Diffstat (limited to 'Util/CSoundNote.py')
-rw-r--r-- | Util/CSoundNote.py | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/Util/CSoundNote.py b/Util/CSoundNote.py index 6e3424d..ddebdf4 100644 --- a/Util/CSoundNote.py +++ b/Util/CSoundNote.py @@ -13,91 +13,6 @@ def CSound_loadInstruments( ): instrumentId = Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ instrumentSoundFile ].instrumentId sc_instrumentLoad(instrumentId, fileName) -def CSound_playNote( loopMode, secs_per_tick, - onset, - pitch, - amplitude, - pan, - duration, - trackId, - fullDuration = False, - attack = 0.002, - decay = 0.098, - reverbSend = 0.1, - filterType = 0, - filterCutoff = 1000, - tied = False, - overlap = False, - instr = Config.FLUTE ): - - if not loopMode: duration = secs_per_tick * duration - - if instr[0:4] == 'drum': - if pitch in GenerationConstants.DRUMPITCH: - key = GenerationConstants.DRUMPITCH[ pitch ] - else: - key = pitch - - if instr == 'drum1kit': - instr = Config.DRUM1INSTRUMENTS[ key ] - if instr == 'drum2kit': - instr = Config.DRUM2INSTRUMENTS[ key ] - if instr == 'drum3kit': - instr = Config.DRUM3INSTRUMENTS[ key ] - pitch = 1 - time_in_ticks = 0 - else: - pitch = GenerationConstants.TRANSPOSE[ pitch - 24 ] - - # condition for tied notes - if Config.INSTRUMENTS[ instr ].csoundInstrumentId == 101 and tied and fullDuration: - duration= -1.0 - # condition for overlaped notes - if Config.INSTRUMENTS[ instr ].csoundInstrumentId == 102 and overlap: - duration += 1.0 - time_in_ticks = 1 - - # condition for tied notes - if Config.INSTRUMENTS[ instr].csoundInstrumentId == Config.INST_TIED and tied and fullDuration: - duration = -1 - # condition for overlaped notes - if Config.INSTRUMENTS[ instr ].csoundInstrumentId == Config.INST_PERC and overlap: - duration = duration + 1.0 - if loopMode : - sc_loop_addScoreEvent15( time_in_ticks, 'i', - Config.INSTRUMENTS[ instr ].csoundInstrumentId + trackId * 0.01, - onset, - duration, - pitch, - reverbSend, - amplitude, - pan, - Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[instr].instrumentId, - attack, - decay, - filterType, - filterCutoff, - Config.INSTRUMENTS[ instr ].loopStart, - Config.INSTRUMENTS[ instr ].loopEnd, - Config.INSTRUMENTS[ instr ].crossDur ) - else: - sc_scoreEvent15( 'i', - Config.INSTRUMENTS[ instr ].csoundInstrumentId + trackId * 0.01, - onset * secs_per_tick, - duration, - pitch, - reverbSend, - amplitude, - pan, - Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[instr].instrumentId, - max(attack*duration, 0.002), - max(decay *duration, 0.002), - filterType, - filterCutoff, - Config.INSTRUMENTS[ instr ].loopStart, - Config.INSTRUMENTS[ instr ].loopEnd, - Config.INSTRUMENTS[ instr ].crossDur ) - class CSoundNote : NOTE_ID_COUNTER = 0 #----------------------------------- @@ -236,38 +151,3 @@ class CSoundNote : Config.INSTRUMENTS[ self.instrumentFlag ].loopEnd, Config.INSTRUMENTS[ self.instrumentFlag ].crossDur ) - def playNow(self, secs_per_tick): - CSound_playNote( False, secs_per_tick, - self.onset, - self.pitch, - self.amplitude, - self.pan, - self.duration, - self.trackId, - self.fullDuration, - self.attack, - self.decay, - self.reverbSend, - self.filterType, - self.filterCutoff, - self.tied, - self.overlap, - self.instrumentFlag) - def playLoop(self): - CSound_playNote( True, 1.0, - self.onset, - self.pitch, - self.amplitude, - self.pan, - self.duration, - self.trackId, - self.fullDuration, - self.attack, - self.decay, - self.reverbSend, - self.filterType, - self.filterCutoff, - self.tied, - self.overlap, - self.instrumentFlag) - |