from lstm.midiHandlers import midi_archive as ma
from lstm.fileHandlers import composers as cmprs
from lstm.fileHandlers import dataset as ds
import pandas as pd
ma.build_all_meta(r"C:\Users\livb1\Desktop\Yolane\2020Spring\Capstone\music-classification-deep-generation\lstm\midi")
C:\Users\livb1\Desktop\Yolane\2020Spring\Capstone\music-classification-deep-generation\lstm\midi Found 17844 files from 12 composers! Loading midi files with 3 threads... ------- Saving meta csv... Meta CSV file saved!
metadf = pd.read_csv(".\lstm\midi\meta.csv")
display(metadf)
filename | composer | type | tracks | 4per_beat | first_key_sig | predicted_key_sig | first_time_n | first_time_d | first_time_32nd | ... | D | D# | E | F | F# | G | G# | A | A# | B | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Bach | 1 | 6 | 240 | C | D# | 4.0 | 4.0 | 8.0 | ... | 57.0 | 90.0 | 14.0 | 96.0 | 0.0 | 75.0 | 89.0 | 10.0 | 105.0 | 0.0 |
1 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Beethoven | 1 | 14 | 240 | C | C | 2.0 | 4.0 | 8.0 | ... | 11.0 | 40.0 | 54.0 | 35.0 | 53.0 | 105.0 | 8.0 | 15.0 | 0.0 | 3.0 |
2 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Haydn | 1 | 12 | 192 | NaN | C | 3.0 | 4.0 | 8.0 | ... | 12.0 | 4.0 | 107.0 | 8.0 | 5.0 | 19.0 | 30.0 | 23.0 | 0.0 | 34.0 |
3 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Bach | 1 | 6 | 240 | C | D# | 4.0 | 4.0 | 8.0 | ... | 14.0 | 40.0 | 0.0 | 10.0 | 0.0 | 12.0 | 16.0 | 0.0 | 24.0 | 0.0 |
4 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Haydn | 1 | 12 | 192 | NaN | F | 3.0 | 4.0 | 8.0 | ... | 33.0 | 8.0 | 31.0 | 29.0 | 9.0 | 105.0 | 1.0 | 31.0 | 42.0 | 12.0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
10958 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Webster | 1 | 8 | 96 | D | D | 3.0 | 4.0 | 8.0 | ... | 142.0 | 0.0 | 13.0 | 0.0 | 243.0 | 19.0 | 0.0 | 89.0 | 3.0 | 3.0 |
10959 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Webster | 1 | 8 | 96 | D | D | 3.0 | 4.0 | 8.0 | ... | 114.0 | 12.0 | 17.0 | 0.0 | 188.0 | 29.0 | 0.0 | 76.0 | 4.0 | 11.0 |
10960 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Webster | 1 | 8 | 96 | D | G | 3.0 | 4.0 | 8.0 | ... | 109.0 | 30.0 | 14.0 | 0.0 | 162.0 | 24.0 | 2.0 | 83.0 | 1.0 | 7.0 |
10961 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Webster | 1 | 8 | 96 | D | D | 3.0 | 4.0 | 8.0 | ... | 140.0 | 0.0 | 13.0 | 0.0 | 243.0 | 20.0 | 1.0 | 90.0 | 3.0 | 4.0 |
10962 | C:\Users\livb1\Desktop\Yolane\2020Spring\Capst... | Webster | 1 | 8 | 96 | D | D | 3.0 | 4.0 | 8.0 | ... | 124.0 | 0.0 | 15.0 | 0.0 | 213.0 | 25.0 | 0.0 | 79.0 | 4.0 | 4.0 |
10963 rows × 27 columns
composers = cmprs.get_composer_works(metadf)
display(composers)
works | |
---|---|
composer | |
Bach | 2869 |
Beethoven | 1713 |
Chopin | 1229 |
Handel | 870 |
Haydn | 769 |
Hays | 1022 |
Thomas | 1116 |
Webster | 1375 |
dataset = ds.VectorGetterNHot(".\lstm\midi")
.\lstm\midi Found 8 composers: Bach, Beethoven, Chopin, Handel, Haydn, Hays, Thomas, Webster Found 6432 training and 2145 test MIDI files!
C:\Users\livb1\Anaconda3\lib\site-packages\sklearn\preprocessing\_encoders.py:415: FutureWarning: The handling of integer data will change in version 0.22. Currently, the categories are determined based on the range [0, max(values)], while in the future they will be determined based on the unique values. If you want the future behaviour and silence this warning, you can specify "categories='auto'". In case you used a LabelEncoder before this OneHotEncoder to convert the categories to integers, then you can now use the OneHotEncoder directly. warnings.warn(msg, FutureWarning)
dataset.get_composers()
Found 8 composers: Bach, Beethoven, Chopin, Handel, Haydn, Hays, Thomas, Webster
C:\Users\livb1\Anaconda3\lib\site-packages\sklearn\preprocessing\_encoders.py:415: FutureWarning: The handling of integer data will change in version 0.22. Currently, the categories are determined based on the range [0, max(values)], while in the future they will be determined based on the unique values. If you want the future behaviour and silence this warning, you can specify "categories='auto'". In case you used a LabelEncoder before this OneHotEncoder to convert the categories to integers, then you can now use the OneHotEncoder directly. warnings.warn(msg, FutureWarning)
array(['Bach', 'Beethoven', 'Chopin', 'Handel', 'Haydn', 'Hays', 'Thomas', 'Webster'], dtype=object)