Exemplo n.º 1
0
 def getPitch(self, format='fq', maxCount=None):
     """read frequencies from the list
     format is standard Pitch object formats
     macCount will be used, if supplied, otherwise use value
     given at init, or from default"""
     if maxCount == None:
         maxCount = self.maxCount # use value set at init
     maxLen = len(self.dataEval)
     if maxCount > 0: # get top portion of sorted list
         if maxCount > maxLen: maxCount = maxLen
         posList = range(maxCount)
     elif maxCount < 0: # get bottom portion of sorted list
         if maxCount < -maxLen: maxCount = -maxLen
         posList = range(len(self.dataEval) + maxCount, len(self.dataEval))
     else: return [] # empty range
     pitchList = []
     assert format in ['fq', 'psReal']
     for i in posList:
         # fq is always second
         if i >= len(self.dataEval): break
         fq = self.dataEval[i][1]
         if format == 'fq': # do nothing
             pitchList.append(fq)
         elif format == 'psReal':
             pitchList.append(pitchTools.fqToPs(fq))
     return pitchList
Exemplo n.º 2
0
 def _parseFq(self, usrStr):
     """conver midi values to psInt values"""
     usrStr = drawer.strStripAlpha(usrStr)
     usrList = drawer.strToListFlat(usrStr, 'L')
     #usrList = usrStr.split(',')
     psList = []
     for elem in usrList:  # may be int or float
         elem = drawer.strToNum(elem.strip(), 'num')
         if elem == None: continue
         else: psList.append(pitchTools.fqToPs(elem))
     return psList
Exemplo n.º 3
0
 def _parseFq(self, usrStr):
     """conver midi values to psInt values"""
     usrStr = drawer.strStripAlpha(usrStr)
     usrList = drawer.strToListFlat(usrStr, 'L')
     #usrList = usrStr.split(',')
     psList = []
     for elem in usrList: # may be int or float
         elem = drawer.strToNum(elem.strip(), 'num')
         if elem == None: continue
         else: psList.append(pitchTools.fqToPs(elem))
     return psList