示例#1
0
    def send_tied_note_off(self, inst, pitch, duration, decay, vol):
        if not hasCSound:
            return

        tid = self.query_pitch_and_recycle_tid(pitch)
        if tid == -1:
            return
        #print "pitch(" + str(pitch) + ") removed from track " + str(tid)
        pitch = self.shift_pitch(inst, pitch)

        csnote = CSoundNote(0, pitch, vol * self.global_vol, 0.5, duration,
                            tid, inst)
        csnote.decay = decay
        csnote.tied = False
        csnote.mode = "mini"

        self.csound.play(csnote, 1)
示例#2
0
    def send_tied_note_on(
        self, inst, pitch, vol
    ):  # tied note generates a pair of note_on/off event, in note_on, duration = -1 (open note)
        if not hasCSound:
            return

        tid = self.get_available_track()
        self.track_map[pitch] = tid
        #print "pitch(" + str(pitch) + ") on track " + str(tid)
        pitch = self.shift_pitch(inst, pitch)

        csnote = CSoundNote(0, pitch, vol * self.global_vol, 0.5, -1, tid,
                            inst)
        csnote.tied = True
        csnote.mode = "mini"

        self.csound.play(csnote, 1)