# Path: note_seq/drums_encoder_decoder.py
# DEFAULT_DRUM_TYPE_PITCHES = [
#     # kick drum
#     [36, 35],
# 
#     # snare drum
#     [38, 27, 28, 31, 32, 33, 34, 37, 39, 40, 56, 65, 66, 75, 85],
# 
#     # closed hi-hat
#     [42, 44, 54, 68, 69, 70, 71, 73, 78, 80, 22],
# 
#     # open hi-hat
#     [46, 67, 72, 74, 79, 81, 26],
# 
#     # low tom
#     [45, 29, 41, 43, 61, 64, 84],
# 
#     # mid tom
#     [48, 47, 60, 63, 77, 86, 87],
# 
#     # high tom
#     [50, 30, 62, 76, 83],
# 
#     # crash cymbal
#     [49, 52, 55, 57, 58],
# 
#     # ride cymbal
#     [51, 53, 59, 82]
# ]
# class DrumsEncodingError(Exception):
# class MultiDrumOneHotEncoding(encoder_decoder.OneHotEncoding):
#   def __init__(self, drum_type_pitches=None, ignore_unknown_drums=True):
#   def num_classes(self):
#   def default_event(self):
#   def encode_event(self, event):
#   def decode_event(self, index):


from absl.testing import absltest
from note_seq import drums_encoder_decoder

  def testEncode(self):
    # No drums should encode to zero.
    index = self.enc.encode_event(NO_DRUMS)
    self.assertEqual(0, index)

    # Single drum should encode to single bit active, different for different
    # drum types.
    index1 = self.enc.encode_event(DRUMS(35))
    index2 = self.enc.encode_event(DRUMS(44))
    self.assertEqual(1, _index_to_binary(index1).count('1'))
    self.assertEqual(1, _index_to_binary(index2).count('1'))
    self.assertNotEqual(index1, index2)

    # Multiple drums should encode to multiple bits active, one for each drum
    # type.
    index = self.enc.encode_event(DRUMS(40, 44))
    self.assertEqual(2, _index_to_binary(index).count('1'))
    index = self.enc.encode_event(DRUMS(35, 51, 59))
    self.assertEqual(2, _index_to_binary(index).count('1'))

  def testDecode(self):
    # Zero should decode to no drums.
    event = self.enc.decode_event(0)
    self.assertEqual(NO_DRUMS, event)

    # Single bit active should encode to single drum, different for different
    # bits.
    event1 = self.enc.decode_event(1)
    event2 = self.enc.decode_event(

# Path: note_seq/drums_encoder_decoder.py
# DEFAULT_DRUM_TYPE_PITCHES = [
#     # kick drum
#     [36, 35],
# 
#     # snare drum
#     [38, 27, 28, 31, 32, 33, 34, 37, 39, 40, 56, 65, 66, 75, 85],
# 
#     # closed hi-hat
#     [42, 44, 54, 68, 69, 70, 71, 73, 78, 80, 22],
# 
#     # open hi-hat
#     [46, 67, 72, 74, 79, 81, 26],
# 
#     # low tom
#     [45, 29, 41, 43, 61, 64, 84],
# 
#     # mid tom
#     [48, 47, 60, 63, 77, 86, 87],
# 
#     # high tom
#     [50, 30, 62, 76, 83],
# 
#     # crash cymbal
#     [49, 52, 55, 57, 58],
# 
#     # ride cymbal
#     [51, 53, 59, 82]
# ]
# class DrumsEncodingError(Exception):
# class MultiDrumOneHotEncoding(encoder_decoder.OneHotEncoding):
#   def __init__(self, drum_type_pitches=None, ignore_unknown_drums=True):
#   def num_classes(self):
#   def default_event(self):
#   def encode_event(self, event):
#   def decode_event(self, index):


# Path: note_seq/drums_encoder_decoder_test.py
from absl.testing import absltest
from note_seq import drums_encoder_decoder


  def testEncode(self):
    # No drums should encode to zero.
    index = self.enc.encode_event(NO_DRUMS)
    self.assertEqual(0, index)

    # Single drum should encode to single bit active, different for different
    # drum types.
    index1 = self.enc.encode_event(DRUMS(35))
    index2 = self.enc.encode_event(DRUMS(44))
    self.assertEqual(1, _index_to_binary(index1).count('1'))
    self.assertEqual(1, _index_to_binary(index2).count('1'))
    self.assertNotEqual(index1, index2)

    # Multiple drums should encode to multiple bits active, one for each drum
    # type.
    index = self.enc.encode_event(DRUMS(40, 44))
    self.assertEqual(2, _index_to_binary(index).count('1'))
    index = self.enc.encode_event(DRUMS(35, 51, 59))
    self.assertEqual(2, _index_to_binary(index).count('1'))

  def testDecode(self):
    # Zero should decode to no drums.
    event = self.enc.decode_event(0)
    self.assertEqual(NO_DRUMS, event)

    # Single bit active should encode to single drum, different for different
    # bits.
    event1 = self.enc.decode_event(1)
    event2 = self.enc.decode_event(

        2 ** (len(drums_encoder_decoder.DEFAULT_DRUM_TYPE_PITCHES) // 2))