Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/common/Util
diff options
context:
space:
mode:
authorOli <olivier.belanger@umontreal.ca>2007-10-09 05:42:59 (GMT)
committer Oli <olivier.belanger@umontreal.ca>2007-10-09 05:42:59 (GMT)
commit7400fb60ca6b454330996cc5b2c425b8c1e366c9 (patch)
tree00f74d6b7a4eca2245b782771296a688140dd679 /common/Util
parentd823a57aec432898701f136da37e7aecabf3ac34 (diff)
work on meta algo, amplitude scaled on transposition
Diffstat (limited to 'common/Util')
-rw-r--r--common/Util/.CSoundClient.py.swpbin0 -> 28672 bytes
-rw-r--r--common/Util/CSoundClient.py11
-rw-r--r--common/Util/InstrumentDB.py23
3 files changed, 18 insertions, 16 deletions
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 = {} # <name> -> 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()
-