MIDI_INSTRUMENT_DICT = {
     'Accordion': 22,
     'Acoustic Bass': 33,
     'Acoustic Grand Piano': 1,
     'Acoustic Guitar (nylon)': 25,
     'Acoustic Guitar (steel)': 26,
     'Agogo': 114,
     'Alto Sax': 66,
     'Applause': 127,
     'Bag pipe': 110,
     'Banjo': 106,
     'Baritone Sax': 68,
     'Bassoon': 71,
     'Bird Tweet': 124,
     'Blown Bottle': 77,
     'Brass Section': 62,
     'Breath Noise': 122,
     'Bright Acoustic Piano': 2,
     'Celesta': 9,
     'Cello': 43,
     'Choir Aahs': 53,
     'Church Organ': 20,
     'Clarinet': 72,
     'Clavinet': 8,
     'Contrabass': 44,
     'Distortion Guitar': 31,
     'Drawbar Organ': 17,
     'Dulcimer': 16,
     'Electric Bass (finger)': 34,
     'Electric Bass (pick)': 35,
     'Electric Grand Piano': 3,
     'Electric Guitar (clean)': 28,
     'Electric Guitar (jazz)': 27,
     'Electric Guitar (muted)': 29,
     'Electric Piano 1': 5,
     'Electric Piano 2': 6,
     'English Horn': 70,
     'FX 1 (rain)': 97,
     'FX 2 (soundtrack)': 98,
     'FX 3 (crystal)': 99,
     'FX 4 (atmosphere)': 100,
     'FX 5 (brightness)': 101,
     'FX 6 (goblins)': 102,
     'FX 7 (echoes)': 103,
     'FX 8 (sci-fi)': 104,
     'Fiddle': 111,
     'Flute': 74,
     'French Horn': 61,
     'Fretless Bass': 36,
     'Glockenspiel': 10,
     'Guitar Fret Noise': 121,
     'Guitar harmonics': 32,
     'Gunshot': 128,
     'Harmonica': 23,
     'Harpsichord': 7,
     'Helicopter': 126,
     'Honky-tonk Piano': 4,
     'Kalimba': 109,
     'Koto': 108,
     'Lead 1 (square)': 81,
     'Lead 2 (sawtooth)': 82,
     'Lead 3 (calliope)': 83,
     'Lead 4 (chiff)': 84,
     'Lead 5 (charang)': 85,
     'Lead 6 (voice)': 86,
     'Lead 7 (fifths)': 87,
     'Lead 8 (bass + lead)': 88,
     'Marimba': 13,
     'Melodic Tom': 118,
     'Music Box': 11,
     'Muted Trumpet': 60,
     'Oboe': 69,
     'Ocarina': 80,
     'Orchestra Hit': 56,
     'Orchestral Harp': 47,
     'Overdriven Guitar': 30,
     'Pad 1 (new age)': 89,
     'Pad 2 (warm)': 90,
     'Pad 3 (polysynth)': 91,
     'Pad 4 (choir)': 92,
     'Pad 5 (bowed)': 93,
     'Pad 6 (metallic)': 94,
     'Pad 7 (halo)': 95,
     'Pad 8 (sweep)': 96,
     'Pan Flute': 76,
     'Percussive Organ': 18,
     'Piccolo': 73,
     'Pizzicato Strings': 46,
     'Recorder': 75,
     'Reed Organ': 21,
     'Reverse Cymbal': 120,
     'Rock Organ': 19,
     'Seashore': 123,
     'Shakuhachi': 78,
     'Shamisen': 107,
     'Shanai': 112,
     'Sitar': 105,
     'Slap Bass 1': 37,
     'Slap Bass 2': 38,
     'Steel Drums': 115,
     'String Ensemble 1': 49,
     'String Ensemble 2': 50,
     'Synth Bass 1': 39,
     'Synth Bass 2': 40,
     'Synth Bras64 Synth Bras64 Syntano Sax': 64,
     'Synth Brass 1': 63,
     'Synth Drum': 119,
     'Synth Strings 1': 51,
     'Synth Strings 2': 52,
     'Synth Voice': 55,
     'Taiko Drum': 117,
     'Tango Accordion': 24,
     'Telephone Ring': 125,
     'Tenor Sax': 67,
     'Timpani': 48,
     'Tinkle Bell': 113,
     'Tremolo Strings': 45,
     'Trombone': 58,
     'Trumpet': 57,
     'Tuba': 59,
     'Tubular Bells': 15,
     'Vibraphone': 12,
     'Viola': 42,
     'Violin': 41,
     'Voice Oohs': 54,
     'Whistle': 79,
     'Woodblock': 116,
     'Xylophone': 14
}

MIDI_INSTRUMENTS = {val:key for key, val in MIDI_INSTRUMENT_DICT.items()}


def get_midi_program(midi_instrument):
    return MIDI_INSTRUMENT_DICT.get(midi_instrument, None)


def get_midi_instrument(midi_program):
    return MIDI_INSTRUMENTS.get(midi_program, None)
