def generateScore(self, note, instrumentNum, space): dur = float(note.duration) #print("Dur: " + str(dur)) shortDur = dur / 8 upperPch = pchAdd(note.pitch, self.upperInterval) lowerPch = pchAdd(note.pitch, self.lowerInterval) currentTime = note.startTime returnScore = "" notePitches = [upperPch, note.pitch, lowerPch, note.pitch, upperPch, note.pitch, upperPch, note.pitch] for pch in notePitches: tempPFields = [instrumentNum, currentTime, shortDur] tempPFields += [pch, pch, note.amp, space, note.envType] tempPFields += note.extraPFields tempPFields = [str(i).ljust(15) for i in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" currentTime += shortDur return returnScore
def generateScore(self, note, instrumentNum, space): dur = float(note.duration) #print("Dur: " + str(dur)) shortDur = dur / 8 upperPch = pchAdd(note.pitch, self.upperInterval) lowerPch = pchAdd(note.pitch, self.lowerInterval) currentTime = note.startTime returnScore = "" notePitches = [upperPch, note.pitch, upperPch, note.pitch, upperPch, note.pitch, lowerPch, note.pitch] for pch in notePitches: tempPFields = [instrumentNum, currentTime, shortDur] tempPFields += [pch, pch, note.amp, space, note.envType] tempPFields += note.extraPFields tempPFields = [str(i).ljust(15) for i in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" currentTime += shortDur return returnScore
def performSurface(self, amp, envType, time1a, pch1a, time1b, pch1b, time2a, pch2a, time2b, pch2b): """ using y = mx + b to calculate the start and end points of the two surface edges y maps to pch, x maps to time note: currently does not check if the second set of point starts before the first and may cause unwanted results""" returnScore = "" line1Dur = float(time1b) - time1a line2Dur = float(time2b) - time2a m1 = pchDiff(pch1a, pch1b) / float(len(self) - 1) m2 = pchDiff(pch2a, pch2b) / float(len(self) - 1) b1 = pch1a b2 = pch2a for i in range(len(self)): x = i / float(len(self) - 1) startTime = float(x * line1Dur) + time1a endTime = float(x * line2Dur) + time2a duration = endTime - startTime pch1 = pchAdd(pch1a, m1 * i) pch2 = pchAdd(pch2a, m2 * i) tempNoteList = [Note(startTime, duration, pch1, pch2, amp, envType)] returnScore += self[i].perform(tempNoteList) return returnScore
def transpose(self, interval): """Returns a transposed copy of this NoteList""" if len(self) == 0: return NoteList() temp = copy.deepcopy(self) for note in temp: note.pitch = pchAdd(note.pitch, interval) note.pitch2 = pchAdd(note.pitch2, interval) return temp
def generateScore(self, note, instrumentNum, space): dur = float(note.duration) #print("Dur: " + str(dur)) lowerPch = pchAdd(note.pitch, self.interval) currentTime = note.startTime returnScore = "" notePitches = [lowerPch, note.pitch, lowerPch, note.pitch] durations = [ dur / 2, dur / 8, dur /8, dur / 4] for i in range(4): tempPFields = [instrumentNum, currentTime, durations[i]] tempPFields += [notePitches[i], notePitches[i], note.amp, space, note.envType] tempPFields += note.extraPFields tempPFields = [str(j).ljust(15) for j in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" currentTime += durations[i] return returnScore
def generateScore(self, note, instrumentNum, space): dur = float(note.duration) #print("Dur: " + str(dur)) upperPch = pchAdd(note.pitch, self.interval) currentTime = note.startTime returnScore = "" notePitches = [ upperPch, note.pitch, upperPch, note.pitch, upperPch, note.pitch ] durations = [dur / 2, dur / 16, dur / 16, dur / 16, dur / 16, dur / 4] for i in range(6): tempPFields = [instrumentNum, currentTime, durations[i]] tempPFields += [ notePitches[i], notePitches[i], note.amp, space, note.envType ] tempPFields += note.extraPFields tempPFields = [str(j).ljust(15) for j in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" currentTime += durations[i] return returnScore
def generateScore(self, note, instrumentNum, space): dur = float(note.duration) #print("Dur: " + str(dur)) shortDur = dur / 8 longDur = dur - (5 * shortDur) trillPch = pchAdd(note.pitch, self.interval) currentTime = note.startTime returnScore = "" for i in range(5): tempPFields = [instrumentNum, currentTime, shortDur] if (i % 2) == 1 : tempPFields += [note.pitch, note.pitch2, note.amp, space, note.envType] else: tempPFields += [trillPch, trillPch, note.amp, space, note.envType] tempPFields += note.extraPFields tempPFields = [str(i).ljust(15) for i in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" currentTime += shortDur tempPFields = [instrumentNum, currentTime, longDur] tempPFields += [note.pitch, note.pitch2, note.amp, space, note.envType] tempPFields += note.extraPFields tempPFields = [str(i).ljust(15) for i in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" return returnScore
def generateScore(self, note, instrumentNum, space): dur = float(note.duration) #print("Dur: " + str(dur)) shortDur = dur / 8 longDur = dur - (5 * shortDur) trillPch = pchAdd(note.pitch, self.interval) currentTime = note.startTime returnScore = "" for i in range(5): tempPFields = [instrumentNum, currentTime, shortDur] if (i % 2) == 1: tempPFields += [ note.pitch, note.pitch2, note.amp, space, note.envType ] else: tempPFields += [ trillPch, trillPch, note.amp, space, note.envType ] tempPFields += note.extraPFields tempPFields = [str(i).ljust(15) for i in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" currentTime += shortDur tempPFields = [instrumentNum, currentTime, longDur] tempPFields += [note.pitch, note.pitch2, note.amp, space, note.envType] tempPFields += note.extraPFields tempPFields = [str(i).ljust(15) for i in tempPFields] returnScore += "i " + " ".join(tempPFields) + "\n" return returnScore