(sequence_str, mapping_name)
return drums_sequence.SerializeToString()
Map the NoteSequence for drums.
Map the NoteSequence for drums.
Map the NoteSequence for drums .
def map_sequences(sequence_str, mapping_name):
  """Map the NoteSequence for drums."""
  mapping = HIT_MAPS[mapping_name]
  drums_sequence = music_pb2.NoteSequence.FromString(sequence_str)
  simple_mapping = {}
  for pitch_class in mapping:
    for pitch in pitch_class:
      simple_mapping[pitch] = pitch_class[0]

  for note in drums_sequence.notes:
    if note.pitch not in simple_mapping:
      tf.logging.warn('Could not find mapping for pitch %d', note.pitch)
    else:
      note.pitch = simple_mapping[note.pitch]
  return drums_sequence.SerializeToString()
def map_sequences ( sequence_str , mapping_name ) : mapping = HIT_MAPS [ mapping_name ] drums_sequence = music_pb2 . NoteSequence . FromString ( sequence_str ) simple_mapping = { } for pitch_class in mapping : for pitch in pitch_class : simple_mapping [ pitch ] = pitch_class [ 0 ] for note in drums_sequence . notes : if note . pitch not in simple_mapping : tf . logging . warn ( 'Could not find mapping for pitch %d' , note . pitch ) else : note . pitch = simple_mapping [ note . pitch ] return drums_sequence . SerializeToString ( )