From 7400fb60ca6b454330996cc5b2c425b8c1e366c9 Mon Sep 17 00:00:00 2001 From: Oli Date: Tue, 09 Oct 2007 05:42:59 +0000 Subject: work on meta algo, amplitude scaled on transposition --- (limited to 'common') diff --git a/common/Config.py b/common/Config.py index 3ea32cb..73bd3f8 100644 --- a/common/Config.py +++ b/common/Config.py @@ -78,19 +78,17 @@ for i in range(0,13): KIT_ELEMENT = tuple(KIT_ELEMENT) class Instrument: - def __init__( self, name, instrumentId, csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, ampScale = 1, kit = None ): + def __init__( self, name, instrumentId, csoundInstrumentId, instrumentRegister, category, loopStart, loopEnd, crossDur, ampScale = 1, kit = None ): self.name = name self.instrumentId = instrumentId self.csoundInstrumentId = csoundInstrumentId self.instrumentRegister = instrumentRegister - self.soundClass = soundClass self.category = category self.loopStart = loopStart self.loopEnd = loopEnd self.crossDur = crossDur self.ampScale = ampScale self.kit = kit - #print (self.name, self.instrumentId, self.csoundInstrumentId, self.instrumentRegister, self.soundClass, self.category, self.loopStart, self.loopEnd, self.crossDur) LOW, MID, HIGH, PUNCH = range( 4 ) @@ -108,147 +106,147 @@ instrumentDB = InstrumentDB.getRef() _nextInstrumentId = [0] INSTRUMENTS = {} -def _addInstrument( name, csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, ampScale = 1, kit = None ): +def _addInstrument( name, csoundInstrumentId, instrumentRegister, category, loopStart, loopEnd, crossDur, ampScale = 1, kit = None ): if not QUICKLOAD or name[0:4] == "drum" or name in ["flute", "kalimba"]: # quick load - INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], csoundInstrumentId, instrumentRegister, soundClass, category, loopStart, loopEnd, crossDur, ampScale, kit ) - instrumentDB.addInstrumentFromArgs( name, name, instrumentRegister, loopStart, loopEnd, crossDur, name, LIB_DIR+"/Images/"+name+".png", [ category ] ) + INSTRUMENTS[name] = Instrument( name, _nextInstrumentId[0], csoundInstrumentId, instrumentRegister, category, loopStart, loopEnd, crossDur, ampScale, kit ) + instrumentDB.addInstrumentFromArgs( name, csoundInstrumentId, instrumentRegister, loopStart, loopEnd, crossDur, ampScale, name, LIB_DIR+"/Images/"+name+".png", [ category ] ) _nextInstrumentId[0] += 1 -_addInstrument( "mic1", INST_TIED, MID, 'melo', 'mysounds', .01, 1.99, .01, 1 ) -_addInstrument( "mic2", INST_TIED, MID, 'melo', 'mysounds', .01, 1.99, .01, 1 ) -_addInstrument( "mic3", INST_TIED, MID, 'melo', 'mysounds', .01, 1.99, .01, 1 ) -_addInstrument( "mic4", INST_TIED, MID, 'melo', 'mysounds', .01, 1.99, .01, 1 ) -_addInstrument( "lab1", INST_SIMP, MID, 'melo', 'mysounds', 0, 0, 0, 1 ) -_addInstrument( "lab2", INST_SIMP, MID, 'melo', 'mysounds', 0, 0, 0, 1 ) -_addInstrument( "lab3", INST_SIMP, MID, 'melo', 'mysounds', 0, 0, 0, 1 ) -_addInstrument( "lab4", INST_SIMP, MID, 'melo', 'mysounds', 0, 0, 0, 1 ) -_addInstrument( "lab5", INST_SIMP, MID, 'melo', 'mysounds', 0, 0, 0, 1 ) -_addInstrument( "lab6", INST_SIMP, MID, 'melo', 'mysounds', 0, 0, 0, 1 ) -_addInstrument( "ounk", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "gam", INST_TIED, HIGH, 'melo', 'percussions', .69388, .7536, .02922, 1 ) -_addInstrument( "guit", INST_TIED, MID, 'melo', 'strings', .08592, .75126, .33571, 1 ) -_addInstrument( "koto", INST_TIED, HIGH, 'melo', 'strings', .56523, .70075, .05954, 1 ) -_addInstrument( "clarinette", INST_TIED, MID, 'melo', 'winds', .57905, .73319, .04934, 1 ) -_addInstrument( "flute", INST_TIED, MID, 'melo', 'winds', .47169, .53693, .02481, 1 ) -_addInstrument( "drum1hatpedal", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1hatshoulder", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1hardride", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1ridebell", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1snare", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1snaresidestick", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1crash", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1splash", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1tom", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1floortom", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1) -_addInstrument( "drum1chine", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum1kick", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "piano", INST_TIED, MID, 'melo', 'keyboard', 0.8883, 1.420524, .13575, 1 ) -_addInstrument( "dog", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "duck", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "drum2darbukadoom", INST_SIMP, LOW, 'drum', 'percussions', 0, 0 ,0, 1 ) -_addInstrument( "drum2darbukapied", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2darbukapiedsoft", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2hatflanger", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2darbukatak", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2darbukafinger", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2darbukaroll", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2darbukaslap", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2hatpied", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2tambourinepied", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2hatpied2", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum2tambourinepiedsoft", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3cowbell", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3cowbelltip", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1) -_addInstrument( "drum3cup", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3djembelow", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3djembemid", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3djembesidestick", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3djembeslap", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3djembestickmid", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3metalstand", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3pedalperc", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3rainstick", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3tambourinehigh", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum3tambourinelow", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "harmonica", INST_TIED, MID, 'melo', 'winds', .1531, .19188, .01792, 1 ) -_addInstrument( "alarm", INST_TIED, MID, 'melo', 'concret', 1.37555859375, 2.0286015625, .0675, 1 ) -_addInstrument( "bird", INST_TIED, MID, 'melo', 'animals', .1, 1, .05, 1 ) -_addInstrument( "cat", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "duck2", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "bottle", INST_TIED, MID, 'melo', 'concret', .20532, .41064, .05292, 1 ) -_addInstrument( "clang", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "ow", INST_SIMP, MID, 'melo', 'people', 0, 0, 0, 1 ) -_addInstrument( "sheep", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "water", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "zap", INST_TIED, MID, 'melo', 'keyboard', .299, .7323, .09895, 1 ) -_addInstrument( "trumpet", INST_TIED, MID, 'melo', 'winds', .39934, .45537, .02729, 1) +_addInstrument( "mic1", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 ) +_addInstrument( "mic2", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 ) +_addInstrument( "mic3", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 ) +_addInstrument( "mic4", INST_TIED, MID, 'mysounds', .01, 1.99, .01, 1 ) +_addInstrument( "lab1", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 ) +_addInstrument( "lab2", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 ) +_addInstrument( "lab3", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 ) +_addInstrument( "lab4", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 ) +_addInstrument( "lab5", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 ) +_addInstrument( "lab6", INST_SIMP, MID, 'mysounds', 0, 0, 0, 1 ) +_addInstrument( "ounk", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "gam", INST_TIED, HIGH, 'percussions', .69388, .7536, .02922, 1 ) +_addInstrument( "guit", INST_TIED, MID, 'strings', .08592, .75126, .33571, 1 ) +_addInstrument( "koto", INST_TIED, HIGH, 'strings', .56523, .70075, .05954, 1 ) +_addInstrument( "clarinette", INST_TIED, MID, 'winds', .57905, .73319, .04934, 1 ) +_addInstrument( "flute", INST_TIED, MID, 'winds', .47169, .53693, .02481, 1 ) +_addInstrument( "drum1hatpedal", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1hatshoulder", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1hardride", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1ridebell", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1snare", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1snaresidestick", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1crash", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1splash", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1tom", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1floortom", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1) +_addInstrument( "drum1chine", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum1kick", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "piano", INST_TIED, MID, 'keyboard', 0.8883, 1.420524, .13575, 1 ) +_addInstrument( "dog", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "duck", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "drum2darbukadoom", INST_SIMP, LOW, 'percussions', 0, 0 ,0, 1 ) +_addInstrument( "drum2darbukapied", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2darbukapiedsoft", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2hatflanger", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2darbukatak", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2darbukafinger", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2darbukaroll", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2darbukaslap", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2hatpied", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2tambourinepied", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2hatpied2", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum2tambourinepiedsoft", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3cowbell", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3cowbelltip", INST_SIMP, MID, 'percussions', 0, 0, 0, 1) +_addInstrument( "drum3cup", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3djembelow", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3djembemid", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3djembesidestick", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3djembeslap", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3djembestickmid", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3metalstand", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3pedalperc", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3rainstick", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3tambourinehigh", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum3tambourinelow", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "harmonica", INST_TIED, MID, 'winds', .1531, .19188, .01792, 1 ) +_addInstrument( "alarm", INST_TIED, MID, 'concret', 1.37555859375, 2.0286015625, .0675, 1 ) +_addInstrument( "bird", INST_TIED, MID, 'animals', .1, 1, .05, 1 ) +_addInstrument( "cat", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "duck2", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "bottle", INST_TIED, MID, 'concret', .20532, .41064, .05292, 1 ) +_addInstrument( "clang", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "ow", INST_SIMP, MID, 'people', 0, 0, 0, 1 ) +_addInstrument( "sheep", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "water", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "zap", INST_TIED, MID, 'keyboard', .299, .7323, .09895, 1 ) +_addInstrument( "trumpet", INST_TIED, MID, 'winds', .39934, .45537, .02729, 1) _addInstrument( "bubbles", INST_TIED, MID, "melo", 'concret', 0.02, 1.177, 0.02, 1) _addInstrument( "marimba", INST_TIED, MID, "melo", 'percussions', .26545, .33098, .03087, 1) _addInstrument( "triangle", INST_TIED, MID, "melo", 'percussions', 1.21002, 1.31805, .01268, 1) -_addInstrument( "laugh", INST_SIMP, MID, 'melo', 'people', 0, 0, 0, 1 ) -_addInstrument( "voix", INST_TIED, MID, 'melo', 'people', .89608, .96092, .02343, 1 ) -_addInstrument( "cling", INST_TIED, MID, 'melo', 'keyboard', .09096, .7878, .18026, 1 ) -_addInstrument( "byke", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "door", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "basse", INST_TIED, MID, 'melo', 'strings', 0.50470875, 0.833315, 0.09375, 1 ) -_addInstrument( "acguit", INST_TIED, MID, 'melo', 'strings', 1.4037, 1.84235625, 0.2, 1 ) -_addInstrument( "diceinst", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "didjeridu", INST_TIED, LOW, 'melo', 'winds', .55669, 1.73704, .09178, 4. ) -_addInstrument( "harmonium", INST_TIED, MID, 'melo', 'keyboard', .04674, .41073, .18384, 1 ) -_addInstrument( "horse", INST_SIMP, MID, 'melo', 'animals', 0, 0, 0, 1 ) -_addInstrument( "kalimba", INST_TIED, MID, 'melo', 'percussions', .20751, .30161, .04658, 1 ) -_addInstrument( "mando", INST_TIED, MID, 'melo', 'strings', 0.316548, 0.532008, 0.02875, 1 ) -_addInstrument( "ocarina", INST_TIED, MID, 'melo', 'winds', .06612, .19033, .01776, 1 ) -_addInstrument( "rhodes", INST_TIED, MID, 'melo', 'keyboard', 0.58100625, 0.821625, 0.067, 1 ) -_addInstrument( "saxo", INST_TIED, MID, 'melo', 'winds', .53722, .6583, .05264, 1 ) -_addInstrument( "shenai", INST_TIED, MID, 'melo', 'winds', .29003, .33072, .00634, 1 ) -_addInstrument( "sitar", INST_TIED, MID, 'melo', 'strings', .63187, .67882, .01654, 1 ) -_addInstrument( "tuba", INST_TIED, LOW, 'melo', 'winds', .51063, .58384, .035, 1 ) -_addInstrument( "violin", INST_TIED, MID, 'melo', 'strings', .105, .30656, .028, 1 ) -_addInstrument( "guidice1", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice2", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice3", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice4", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice5", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice6", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice7", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice8", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice9", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guidice10", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "drum4afrofeet", INST_SIMP, LOW, 'drum', 'percussions', 0, 0 ,0, 1 ) -_addInstrument( "drum4fingersn", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4mutecuic", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4stompbass", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tambouri", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr707clap", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr707open", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr808closed", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr808sn", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr909bass", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr909kick", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum4tr909sn", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5timablesslap", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5congagraveouvert", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5timablesaiguslap", INST_SIMP, LOW, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5congagraveferme", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5guiroretour", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5vibraslap", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5congaaiguouvert", INST_SIMP, MID, 'drum', 'percussions', 0, 0 ,0, 1 ) -_addInstrument( "drum5quicamedium", INST_SIMP, PUNCH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5quicaaigu", INST_SIMP, MID, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5agogograve", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5bongoaiguouvert", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5agogoaigu", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "drum5bongograveouvert", INST_SIMP, HIGH, 'drum', 'percussions', 0, 0, 0, 1 ) -_addInstrument( "camera", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "car", INST_TIED, MID, 'melo', 'concret', .67, 1.05761, .01, 1 ) -_addInstrument( "cello", INST_TIED, MID, 'melo', 'strings', 0.4761, 0.92244375, 0.19125, .5 ) -_addInstrument( "chimes", INST_TIED, MID, 'melo', 'percussions', .09, 2.97633, .01, 1 ) -_addInstrument( "crash", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "guit2", INST_TIED, MID, 'melo', 'strings', .33, 1.1583, .02, 1 ) -_addInstrument( "plane", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) -_addInstrument( "slap", INST_SIMP, MID, 'melo', 'concret', 0, 0, 0, 1 ) +_addInstrument( "laugh", INST_SIMP, MID, 'people', 0, 0, 0, 1 ) +_addInstrument( "voix", INST_TIED, MID, 'people', .89608, .96092, .02343, 1 ) +_addInstrument( "cling", INST_TIED, MID, 'keyboard', .09096, .7878, .18026, 1 ) +_addInstrument( "byke", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "door", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "basse", INST_TIED, MID, 'strings', 0.50470875, 0.833315, 0.09375, 1 ) +_addInstrument( "acguit", INST_TIED, MID, 'strings', 1.4037, 1.84235625, 0.2, 1 ) +_addInstrument( "diceinst", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "didjeridu", INST_TIED, LOW, 'winds', .55669, 1.73704, .09178, 4. ) +_addInstrument( "harmonium", INST_TIED, MID, 'keyboard', .04674, .41073, .18384, 1 ) +_addInstrument( "horse", INST_SIMP, MID, 'animals', 0, 0, 0, 1 ) +_addInstrument( "kalimba", INST_TIED, MID, 'percussions', .20751, .30161, .04658, 1 ) +_addInstrument( "mando", INST_TIED, MID, 'strings', 0.316548, 0.532008, 0.02875, 1 ) +_addInstrument( "ocarina", INST_TIED, MID, 'winds', .06612, .19033, .01776, 1 ) +_addInstrument( "rhodes", INST_TIED, MID, 'keyboard', 0.58100625, 0.821625, 0.067, 1 ) +_addInstrument( "saxo", INST_TIED, MID, 'winds', .53722, .6583, .05264, 1 ) +_addInstrument( "shenai", INST_TIED, MID, 'winds', .29003, .33072, .00634, 1 ) +_addInstrument( "sitar", INST_TIED, MID, 'strings', .63187, .67882, .01654, 1 ) +_addInstrument( "tuba", INST_TIED, LOW, 'winds', .51063, .58384, .035, 1 ) +_addInstrument( "violin", INST_TIED, MID, 'strings', .105, .30656, .028, 1 ) +_addInstrument( "guidice1", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice2", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice3", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice4", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice5", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice6", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice7", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice8", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice9", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guidice10", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "drum4afrofeet", INST_SIMP, LOW, 'percussions', 0, 0 ,0, 1 ) +_addInstrument( "drum4fingersn", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4mutecuic", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4stompbass", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tambouri", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr707clap", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr707open", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr808closed", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr808sn", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr909bass", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr909kick", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum4tr909sn", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5timablesslap", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5congagraveouvert", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5timablesaiguslap", INST_SIMP, LOW, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5congagraveferme", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5guiroretour", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5vibraslap", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5congaaiguouvert", INST_SIMP, MID, 'percussions', 0, 0 ,0, 1 ) +_addInstrument( "drum5quicamedium", INST_SIMP, PUNCH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5quicaaigu", INST_SIMP, MID, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5agogograve", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5bongoaiguouvert", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5agogoaigu", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "drum5bongograveouvert", INST_SIMP, HIGH, 'percussions', 0, 0, 0, 1 ) +_addInstrument( "camera", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "car", INST_TIED, MID, 'concret', .67, 1.05761, .01, 1 ) +_addInstrument( "cello", INST_TIED, MID, 'strings', 0.4761, 0.92244375, 0.19125, .75 ) +_addInstrument( "chimes", INST_TIED, MID, 'percussions', .09, 2.97633, .01, 1 ) +_addInstrument( "crash", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "guit2", INST_TIED, MID, 'strings', .33, 1.1583, .02, 1 ) +_addInstrument( "plane", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) +_addInstrument( "slap", INST_SIMP, MID, 'concret', 0, 0, 0, 1 ) try: ifile = open(PREF_DIR + '/sounds_settings', 'r') @@ -329,11 +327,11 @@ DRUM5KIT = { 24 : INSTRUMENTS["drum5timablesslap"], 46 : INSTRUMENTS["drum5agogograve"], 48 : INSTRUMENTS["drum5bongoaiguouvert"] } -_addInstrument( "drum1kit", 0, 0, 0, "percussions", 0, 0, 0, 1, DRUM1KIT ) -_addInstrument( "drum2kit", 0, 0, 0, "percussions", 0, 0, 0, 1, DRUM2KIT ) -_addInstrument( "drum3kit", 0, 0, 0, "percussions", 0, 0, 0, 1, DRUM3KIT ) -_addInstrument( "drum4kit", 0, 0, 0, "percussions", 0, 0, 0, 1, DRUM4KIT ) -_addInstrument( "drum5kit", 0, 0, 0, "percussions", 0, 0, 0, 1, DRUM5KIT ) +_addInstrument( "drum1kit", 0, 0, "percussions", 0, 0, 0, 1, DRUM1KIT ) +_addInstrument( "drum2kit", 0, 0, "percussions", 0, 0, 0, 1, DRUM2KIT ) +_addInstrument( "drum3kit", 0, 0, "percussions", 0, 0, 0, 1, DRUM3KIT ) +_addInstrument( "drum4kit", 0, 0, "percussions", 0, 0, 0, 1, DRUM4KIT ) +_addInstrument( "drum5kit", 0, 0, "percussions", 0, 0, 0, 1, DRUM5KIT ) INSTRUMENTSID = {} for i in INSTRUMENTS: diff --git a/common/Generation/Drunk.py b/common/Generation/Drunk.py index 1bc3bbb..fb7b765 100755 --- a/common/Generation/Drunk.py +++ b/common/Generation/Drunk.py @@ -84,7 +84,7 @@ class Repeter( Drunk ): return self.lastValue def getStepSize( self, direction, maxStepSize, maxValue ): - if random.randint( 0, 100 ) < 20: + if random.randint( 0, 100 ) < 35: return Drunk.getStepSize( self, direction, maxStepSize, maxValue ) else: return Drunk.getStepSize( self, direction, 0, maxValue ) diff --git a/common/Generation/GenerationConstants.py b/common/Generation/GenerationConstants.py index b961f4b..55b9527 100755 --- a/common/Generation/GenerationConstants.py +++ b/common/Generation/GenerationConstants.py @@ -31,12 +31,13 @@ class GenerationConstants: # Default parameters for algorithmic generation - RYTHM_DENSITY_BANK = [.25, .88, .72, 1, .25] - RYTHM_REGU_BANK = [.75, .8, .85, .4, .5] - PITCH_REGU_BANK = [.5, .8, 0, .85, .9] - PITCH_STEP_BANK = [.5, .3, 1, .22, .85] - DURATION_BANK = [.8, 1, .8, 1, 1] - SILENCE_BANK = [.2, .5, .25, .55, .12] + RYTHM_DENSITY_BANK = [.38, .26, .82, 1, 1, .91, 1, .91, .91, .32, 1, 1, .83, .6] + RYTHM_REGU_BANK = [.94, .95, .89, 1, 1, .75, 1, .75, .84, .93, 1, 1, .87, .62] + PITCH_REGU_BANK = [.04, 0, 0, .36, .35, .57, 0, 0, 0, 0, .28, .77, 0, 0] + PITCH_STEP_BANK = [.28, .48, .39, .4, 1, .55, .29, .15, .4, .26, .25, 1, .33, .22] + DURATION_BANK = [1, 1, 1, 1, 1, 1, 1, 1, .65, .86, 1, 1, .82, 1] + SILENCE_BANK = [.07, 0, .17, 0, .17, .17, .2, .32, .33, .08, .06, .11, .11, .06] + PATTERN_BANK = [0,0,0,1,1,1,2,2,2,2,3,3,3,3] SCALE_BANK = [MAJOR, NATURAL_MINOR, LYDIEN, HARMONIC_MINOR, MYXOLYDIEN] chooseDefault = random.randint(0,4) diff --git a/common/Generation/Generator.py b/common/Generation/Generator.py index acc605c..8e92780 100755 --- a/common/Generation/Generator.py +++ b/common/Generation/Generator.py @@ -67,7 +67,7 @@ def generator1( def makeDurationSequence( onsetList, parameters, table_duration, barLength, currentInstrument ): durationSequence = [] - if Config.INSTRUMENTS[currentInstrument].soundClass == 'drum': + if Config.INSTRUMENTS[currentInstrument].name[0:4] == 'drum': duration = GenerationConstants.DOUBLE_TICK_DUR / 2 durationSequence = [duration] * len(onsetList) return durationSequence diff --git a/common/Util/.CSoundClient.py.swp b/common/Util/.CSoundClient.py.swp new file mode 100644 index 0000000..b062a0b --- /dev/null +++ b/common/Util/.CSoundClient.py.swp Binary files differ diff --git a/common/Util/CSoundClient.py b/common/Util/CSoundClient.py index 7a9e6e3..969ee55 100644 --- a/common/Util/CSoundClient.py +++ b/common/Util/CSoundClient.py @@ -5,6 +5,7 @@ import sys import threading import time import array +from math import sqrt import common.Config as Config @@ -301,19 +302,19 @@ class _CSoundClientPlugin: instrument_id_offset = 0 elif mode == 'edit': instrument_id_offset = 100 - + if instrument.csoundInstrumentId == Config.INST_SIMP: if mode == 'mini': instrument_id_offset = 0 elif mode == 'edit': - if instrument.soundClass == 'drum': + if instrument.name[0:4] == 'drum': instrument_id_offset = 0 else: instrument_id_offset = 100 - amplitude = amplitude * instrument.ampScale - print "%f * %f = %f" % (amplitude, instrument.ampScale, amplitude * instrument.ampScale) - print "instrument %s final amplitude: %f" % (instrument.name, amplitude) + amplitude = amplitude / sqrt(pitch) #instrument.ampScale + #print "%f * %f = %f" % (amplitude, instrument.ampScale, amplitude * instrument.ampScale) + #print "instrument %s final amplitude: %f" % (instrument.name, amplitude) rval[0] = (instrument.csoundInstrumentId + \ (trackId+1) + instrument_id_offset) + trackId * 0.01 rval[1] = onset diff --git a/common/Util/InstrumentDB.py b/common/Util/InstrumentDB.py index ca1e0ef..900dd86 100644 --- a/common/Util/InstrumentDB.py +++ b/common/Util/InstrumentDB.py @@ -10,14 +10,15 @@ class Instrument: self.id = id # build an Instrument instance from argument list - def loadFromArgs( self, name, csoundInstrumentName, register, loopStart, - loopEnd, crossDur, wav, img, labels ): + def loadFromArgs( self, name, csoundInstrumentId, register, loopStart, + loopEnd, crossDur, ampScale, wav, img, labels ): self.name = name - self.csoundInstrumentName = csoundInstrumentName + self.csoundInstrumentId = csoundInstrumentId self.register = register self.loopStart = loopStart self.loopEnd = loopEnd self.crossDur = crossDur + self.ampScale = ampScale self.wav = wav self.img = img self.labels = labels @@ -29,11 +30,12 @@ class Instrument: if (magic != 'TamTam idf v1'): raise 'given file has wrong header' self.name = f.readline() - self.csoundInstrumentName = f.readline() + self.csoundInstrumentId = f.readline() self.register = f.readline() self.loopStart = float( f.readline()) self.loopEnd = float( f.readline()) self.crossDur = float( f.readline()) + self.ampScale = float( f.readline()) self.wav = f.readline() self.img = f.readline() self.labels = f.readline().split() @@ -50,12 +52,12 @@ class InstrumentDB: self.kitNamed = {} # -> kit with that name # TEMP? add instrument from args - def addInstrumentFromArgs( self, name, csoundInstrumentName, register, loopStart, - loopEnd, crossDur, wav, img, labels ): - i = Instrument(len(self.inst)) + def addInstrumentFromArgs( self, name, csoundInstrumentId, register, loopStart, + loopEnd, crossDur, ampScale, wav, img, labels ): + i = Instrument(len(self.inst)) self.inst += [ i ] - i.loadFromArgs( name, csoundInstrumentName, register, loopStart, loopEnd, crossDur, wav, img, labels ) - #print 'labelSet... ', self.labelSet + i.loadFromArgs( name, csoundInstrumentId, register, loopStart, loopEnd, crossDur, ampScale, wav, img, labels ) + #print 'labelSet... ', self.labelSet self.labelSet['All'].add(i) for l in i.labels: if l not in self.labelSet: @@ -65,7 +67,7 @@ class InstrumentDB: # add an instrument to the DB by reading from an instrument definition file def addInstrument( self, path ): - i = Instrument(len(self.inst)) + i = Instrument(len(self.inst)) self.inst += [ i ] i.loadFromPath( path ) self.instNamed[ i.name ] = i @@ -140,4 +142,3 @@ if __name__ == "__main__": i1.scanInstrumentDir( sys.argv[1] ) i1.debug_summarize() - -- cgit v0.9.1