Beispiel #1
0
    def make_notes_durs(self, events):
        self.notes = []
        tempo_bpm = 60.0
        self.last_seconds = 0.0
        altered_seconds_sum = 0.0
        for event in events:
            tempo_details = self.get_details(event, "tempo")
            if tempo_details:
                tempo_bpm = float(tempo_details[0][0]) / 4.0
            seconds = 4.0 * (60.0 / tempo_bpm) * event.duration

            if shared.skill > 0:
                altered_seconds = utils.norm_bounded(
                    seconds,
                    TIMING_SKILL_BASE * shared.skill) + altered_seconds_sum
                altered_seconds_sum += (seconds - altered_seconds)
            else:
                altered_seconds = seconds
            #print seconds, altered_seconds

            if event.details[0][0] == 'rest':
                rest = style_base.Rest(duration=altered_seconds)
                self.notes.append(rest)
            elif event.details[0][0] == 'note':
                note = style_base.Note(duration=altered_seconds,
                                       details=event.details)
                self.notes.append(note)
            self.last_seconds += altered_seconds
Beispiel #2
0
    def make_notes_durs(self, events):
        self.notes = []
        tempo_bpm = 60.0
        self.last_seconds = 0.0
        altered_seconds_sum = 0.0
        for event in events:
            tempo_details = self.get_details(event, "tempo")
            if tempo_details:
                tempo_bpm = float(tempo_details[0][0]) / 4.0
            seconds = 4.0 * (60.0 / tempo_bpm) * event.duration

            if shared.skill > 0:
                altered_seconds = utils.norm_bounded(seconds,
                    TIMING_SKILL_BASE * shared.skill) + altered_seconds_sum
                altered_seconds_sum += (seconds-altered_seconds)
            else:
                altered_seconds = seconds
            #print seconds, altered_seconds

            if event.details[0][0] == 'rest':
                rest = style_base.Rest(duration=altered_seconds)
                self.notes.append(rest)
            elif event.details[0][0] == 'note':
                note = style_base.Note(duration=altered_seconds,
                    details=event.details)
                self.notes.append(note)
            self.last_seconds += altered_seconds
Beispiel #3
0
    def set_dynamic(self, physical, dynamic):
        physical.dynamic = dynamic
        physical.bow_bridge_distance = dynamics.get_distance(
            self.inst_type, dynamic)
        physical.bow_force = self.get_simple_force(physical.string_number,
                                                   physical.finger_position,
                                                   dynamic)
        physical.bow_velocity = dynamics.get_velocity(self.inst_type, dynamic)

        if physical.bow_force > 0:
            physical.bow_force = utils.norm_bounded(
                physical.bow_force, FORCE_SKILL_BASE * shared.skill)
Beispiel #4
0
    def set_dynamic(self, physical, dynamic):
        physical.dynamic = dynamic
        physical.bow_bridge_distance = dynamics.get_distance(
            self.inst_type, dynamic)
        physical.bow_force = self.get_simple_force(
            physical.string_number,
            physical.finger_position,
            dynamic)
        physical.bow_velocity = dynamics.get_velocity(
            self.inst_type, dynamic)

        if physical.bow_force > 0:
            physical.bow_force = utils.norm_bounded(
                physical.bow_force,
                FORCE_SKILL_BASE*shared.skill)
Beispiel #5
0
    def basic_physical_begin_end(self):
        for note in self.notes:
            if not self.is_note(note):
                continue
            note.begin = vivi_controller.NoteBeginning()
            note.begin.physical.string_number = self.get_string(note.details)
            note.begin.physical.finger_position = self.get_finger_naive(
                note.details, note.begin.physical.string_number)
            if USE_PITCH:
                note.begin.midi_target = float(note.details[0][1][0])
            else:
                note.begin.midi_target = -1
            note.end = vivi_controller.NoteEnding()

            if shared.skill > 0:
                if note.begin.physical.finger_position > 0.0:
                    bad_midi = utils.norm_bounded(
                        float(note.details[0][1][0]),
                        INTONATION_SKILL_BASE * shared.skill)
                    note.begin.physical.finger_position = self.get_finger(
                        bad_midi, note.begin.physical.string_number)
                    note.begin.midi_target = -1
Beispiel #6
0
    def basic_physical_begin_end(self):
        for note in self.notes:
            if not self.is_note(note):
                continue
            note.begin = vivi_controller.NoteBeginning()
            note.begin.physical.string_number = self.get_string(note.details)
            note.begin.physical.finger_position = self.get_finger_naive(note.details, note.begin.physical.string_number)
            if USE_PITCH:
                note.begin.midi_target = float(note.details[0][1][0])
            else:
                note.begin.midi_target = -1
            note.end = vivi_controller.NoteEnding()

            if shared.skill > 0:
                if note.begin.physical.finger_position > 0.0:
                    bad_midi = utils.norm_bounded(
                        float(note.details[0][1][0]),
                            INTONATION_SKILL_BASE*shared.skill)
                    note.begin.physical.finger_position = self.get_finger(
                        bad_midi,
                        note.begin.physical.string_number)
                    note.begin.midi_target = -1