from collections.__init__ import namedtuple


SongGenerationParams = namedtuple('SongGenerationParams', ['xml', 'back_track', 'outf'])

# parameters for each standard to generate over:
# xml: path to xml file with standard notes and chords
# back_track: path to mp3 file with backing track with the same xml chords and tempo
# outf: saving name for output
song_params_dict = {'fly': SongGenerationParams('Fly_me_to_the_moon.xml',
                                                'Fly_me_to_the_moon_v2.mp3',
                                                'Fly_me_to_the_moon'),
                    'giant': SongGenerationParams('Giant_Steps_200.xml',
                                                  'Giant_Steps_200_BT.mp3',
                                                  'Giant_steps'),
                    'blue': SongGenerationParams('Blue_Bossa.xml',
                                                 'blue_bossa.mp3',
                                                 'Blue_bossa'),
                    'it': SongGenerationParams('It_dont_mean_a_thing.xml',
                                               'It_dont_mean_a_thing.mp3',
                                               'It_dont_mean_a_thing'),
                    'well': SongGenerationParams('Well_You_Neednt.xml',
                                                 'Well_You_Neednt.mp3',
                                                 'Well_you_neednt'),
                    'over': SongGenerationParams('Over_The_Rainbow_with_chords.xml',
                                                 'Over_the_Rainbow.mp3',
                                                 'Over_the_rainbow'),
                    'just': SongGenerationParams('just_friends.xml',
                                                 'Just_Friends.mp3',
                                                 'Just_friends'),
                    'there': SongGenerationParams('There_Will_Never_Be_Another_You.xml',
                                                  'anotheru.mp3',
                                                  'There_Will_Never_Be_Another_You'),
                    'all': SongGenerationParams('All_The_Things_You_Are.xml',
                                                'all.mp3',
                                                'All_The_Things_You_Are'),
                    'moose': SongGenerationParams('moose.xml',
                                                  'moose.mp3',
                                                  'Moose_The_Mooche'),
                    'summertime': SongGenerationParams('summertime.xml',
                                                       'summertime.mp3',
                                                       'Summertime'),
                    'rhythm': SongGenerationParams('I_Got_Rhythm.xml',
                                                   'i_got_rhythm.mp3',
                                                   'Ive_Got_Rhythm'),
                    'billie': SongGenerationParams('Billies_Bounce.xml',
                                                   'billie.mp3',
                                                   'Billies_Bounce'),
                    'monk': SongGenerationParams('Blue_Monk.xml',
                                                 'bluemonk.mp3',
                                                 'BlueMonk'),
                    'cheese': SongGenerationParams('Cheese_Cake.xml',
                                                   'cheesecake.mp3',
                                                   'Cheese_Cake'),
                    'black': SongGenerationParams('Black_Orpheus.xml',
                                                  'black_orpheus.mp3',
                                                  'Black_Orpheus'),
                    'dvarim': SongGenerationParams('things_you_see.xml',
                                                   'things_you_see.mp3',
                                                   'Dvarim'),
                    'green': SongGenerationParams('greendol.xml',
                                                  'green_dolphin.mp3',
                                                  'Green_Dolphin'),
                    'confirmation': SongGenerationParams('Confirmation.xml',
                                                         'Confirmation.mp3',
                                                         'Confirmation'),
                    'mylove': SongGenerationParams('my_love.xml',
                                                   'my_love.mp3',
                                                   'My_Love'),
                    'simple': SongGenerationParams('simple_songs_120.xml',
                                                   'simple_songs.mp3',
                                                   'Simple_Songs'),
                    'four': SongGenerationParams('Four_Brothers.xml',
                                                 'four_brothers.mp3',
                                                 'Four_Brothers'),
                    'how': SongGenerationParams('How_high.xml',
                                                'how_high_the_moon.mp3',
                                                'How_High_The_Moon'),
                    'chega': SongGenerationParams('chega.xml',
                                                  'chega.mp3',
                                                  'Chega_De_Saudade'),
                    'recordame': SongGenerationParams('recordame.xml',
                                                      'recordame.mp3',
                                                      'Recorda_Me'),
                    'foggy': SongGenerationParams('A_Foggy_Day.xml',
                                                  'A_Foggy_Day.mp3',
                                                  'A_Foggy_Day'),
                    'despacito': SongGenerationParams('Despacito.xml',
                                                      'despacito48.mp3',
                                                      'Despacito'),
                    'donna': SongGenerationParams('Donna_Lee.xml',
                                                  'Donna_Lee.mp3',
                                                  'Donna_Lee'),
                    'dance': SongGenerationParams('Dance_Monkey.xml',
                                                  'dance_monkeyS48.mp3',
                                                  'Dance_Monkey'),
                    'juice': SongGenerationParams('Juice.xml',
                                                  'juiceS48.mp3',
                                                  'Juice'),
                    'despacitoS': SongGenerationParams('DespacitoS.xml',
                                                       'despacitoS48.mp3',
                                                       'Despacito'),
                    'never': SongGenerationParams('Never_Gonna_Give_You_Up.xml',
                                                  'Never_Gonna48.mp3',
                                                  'Never_Gonna_Give_You_Up')
                    }

# if the song has a few seconds of opening, you need to add a silence track to be concatenated to the
# improvisation in order to shift it
pop_bt2silence = {'despacito48.mp3': './resources/backing_tracks/silenceDespacito.mp3',
                  'despacitoS48.mp3': './resources/backing_tracks/silenceDespacitoS48.mp3',
                  'juiceS48.mp3': './resources/backing_tracks/silenceJuice48.mp3',
                  'dance_monkeyS48.mp3': './resources/backing_tracks/silenceDance48.mp3',
                  'Never_Gonna48.mp3': './resources/backing_tracks/silenceNever48.mp3'}


MAX_POSSIBLE_NOTES_IN_MEASURE = 32 * 4
LOG_PROB_IDX_IN_RES = 2
NOTE_LENGTH = 5
RES_LENGTH = 3

# if the standard ends with an empty measure you can start the improvisation in that measure.
# just add the xml without the last measure here:
early_start_song_dict = {'fly': './resources/xmls/short/Fly_me_to_the_moon_short.xml',
                         'blue': './resources/xmls/short/Blue_Bossa_short.xml',
                         'just': './resources/xmls/short/just_friends_short.xml',
                         'there': './resources/xmls/short/There_Will_Never_Be_Another_You_short.xml',
                         'all': './resources/xmls/short/All_The_Things_You_Are_short.xml',
                         'summertime': './resources/xmls/short/summertime_short.xml',
                         'cheese': './resources/xmls/short/Cheese_Cake_short.xml',
                         'black': './resources/xmls/short/Black_Orpheus_short.xml',
                         'green': './resources/xmls/short/greendol_short.xml',
                         'four': './resources/xmls/short/Four_Brothers_short.xml',
                         'how': './resources/xmls/short/How_high_short.xml',
                         'chega': './resources/xmls/short/chega_short.xml',
                         'recordame': './resources/xmls/short/recordame_short.xml',
                         'foggy': './resources/xmls/short/A_Foggy_Day_short.xml',
                         'donna': './resources/xmls/short/Donna_Lee_short.xml'
                         }
