# Path: expremigen/musicalmappings/constants.py
# REST = 128
# 
# Path: expremigen/patterns/pchord.py
# class Pchord(Pattern):
#     """
#     special pattern that is never flattened; interpreted as a chord by the rest of the system
#     """
# 
#     def __init__(self, notes=0):
#         super().__init__()
#         self.notes = notes
# 
#     def __str__(self):
#         return "{0}({1})".format(self.__class__.__name__, self.notes)
# 
#     def __iter__(self):
#         yield Pchord(self.notes)
# 
#     def __repr__(self):
#         return self.__str__()
# 
#     def __eq__(self, other):
#         return self.notes == other.notes


from expremigen.musicalmappings.constants import REST
from expremigen.patterns.pchord import Pchord
        from functools import cmp_to_key
            self.all_drum_notes.add(d[0])
            self.all_drum_notes.add(d[1])

    def get_drumnotes_for_grammar(self):
        """
        internal helper function
        :return: list of drumnotes for inclusion in the textX grammar
        """
        def mycmp(s1, s2):
            if len(s1) < len(s2):
                return 1
            if len(s1) > len(s2):
                return -1
            if s1 < s2:
                return 1
            if s1 > s2:
                return -1
            return 0

        strng = "|".join(sorted(["'" + d.strip() + "'" for d in self.all_drum_notes], key=cmp_to_key(mycmp)))
        return strng

    def lookup(self, note):
        """

        :param note: lookup simple note or Pchord
        :return: midi number corresponding to the note name or the notes in the Pchord
        """
        try:
            if isinstance(note, Pchord):

# Path: expremigen/musicalmappings/constants.py
# REST = 128
# 
# Path: expremigen/patterns/pchord.py
# class Pchord(Pattern):
#     """
#     special pattern that is never flattened; interpreted as a chord by the rest of the system
#     """
# 
#     def __init__(self, notes=0):
#         super().__init__()
#         self.notes = notes
# 
#     def __str__(self):
#         return "{0}({1})".format(self.__class__.__name__, self.notes)
# 
#     def __iter__(self):
#         yield Pchord(self.notes)
# 
#     def __repr__(self):
#         return self.__str__()
# 
#     def __eq__(self, other):
#         return self.notes == other.notes


# Path: expremigen/musicalmappings/note2midi.py
from expremigen.musicalmappings.constants import REST
from expremigen.patterns.pchord import Pchord
        from functools import cmp_to_key

            self.all_drum_notes.add(d[0])
            self.all_drum_notes.add(d[1])

    def get_drumnotes_for_grammar(self):
        """
        internal helper function
        :return: list of drumnotes for inclusion in the textX grammar
        """
        def mycmp(s1, s2):
            if len(s1) < len(s2):
                return 1
            if len(s1) > len(s2):
                return -1
            if s1 < s2:
                return 1
            if s1 > s2:
                return -1
            return 0

        strng = "|".join(sorted(["'" + d.strip() + "'" for d in self.all_drum_notes], key=cmp_to_key(mycmp)))
        return strng

    def lookup(self, note):
        """

        :param note: lookup simple note or Pchord
        :return: midi number corresponding to the note name or the notes in the Pchord
        """
        try:
            if isinstance(note, Pchord):

                return Pchord([self.note_to_midi[n.lower()] for n in note.notes])