(root_dir, sub_dir, full_file_path)
return sequence
Converts a midi file to a sequence proto.

  Args:
    root_dir: A string specifying the root directory for the files being
        converted.
    sub_dir: The directory being converted currently.
    full_file_path: the full path to the file to convert.

  Returns:
    Either a NoteSequence proto or None if the file could not be converted.
Converts a midi file to a sequence proto.
Converts a midi file to a sequence proto .
def convert_midi(root_dir, sub_dir, full_file_path):
  """Converts a midi file to a sequence proto.

  Args:
    root_dir: A string specifying the root directory for the files being
        converted.
    sub_dir: The directory being converted currently.
    full_file_path: the full path to the file to convert.

  Returns:
    Either a NoteSequence proto or None if the file could not be converted.
  """
  try:
    sequence = midi_io.midi_to_sequence_proto(
        tf.gfile.GFile(full_file_path, 'rb').read())
  except midi_io.MIDIConversionError as e:
    tf.logging.warning(
        'Could not parse MIDI file %s. It will be skipped. Error was: %s',
        full_file_path, e)
    return None
  sequence.collection_name = os.path.basename(root_dir)
  sequence.filename = os.path.join(sub_dir, os.path.basename(full_file_path))
  sequence.id = generate_note_sequence_id(
      sequence.filename, sequence.collection_name, 'midi')
  tf.logging.info('Converted MIDI file %s.', full_file_path)
  return sequence
def convert_midi ( root_dir , sub_dir , full_file_path ) : try : sequence = midi_io . midi_to_sequence_proto ( tf . gfile . GFile ( full_file_path , 'rb' ) . read ( ) ) except midi_io . MIDIConversionError as e : tf . logging . warning ( 'Could not parse MIDI file %s. It will be skipped. Error was: %s' , full_file_path , e ) return None sequence . collection_name = os . path . basename ( root_dir ) sequence . filename = os . path . join ( sub_dir , os . path . basename ( full_file_path ) ) sequence . id = generate_note_sequence_id ( sequence . filename , sequence . collection_name , 'midi' ) tf . logging . info ( 'Converted MIDI file %s.' , full_file_path ) return sequence