'Parse the duration of a note and compute timings.'

def parse_duration(self, is_in_chord, is_grace_note, duration):

    self.duration = int(duration)
    if is_in_chord:
        self.duration = self.state.previous_note.note_duration.duration
    self.midi_ticks = self.duration
    self.midi_ticks *= (constants.STANDARD_PPQ / self.state.divisions)
    self.seconds = (self.midi_ticks / constants.STANDARD_PPQ)
    self.seconds *= self.state.seconds_per_quarter
    self.time_position = self.state.time_position
    self.is_grace_note = is_grace_note
    if is_in_chord:
        self.time_position = self.state.previous_note.note_duration.time_position
    else:
        self.state.time_position += self.seconds
