<jupyter_start><jupyter_text>Doing a look into 'I got it bad' But first, I need to make sure I've got it...<jupyter_code># Songs
query = "SELECT * FROM composition_info WHERE compid IS 6"
song_info = pd.read_sql_query(query, conn)
song_info.head()<jupyter_output><empty_output><jupyter_text>Okay, so there's 2 versions of "stardust" before this. comp_id drops the doubl, so index for "I got it bad is 6"Is it the same for melid?<jupyter_code># Melody db
query = "SELECT * FROM melody WHERE melid IS 6"
song_melody = pd.read_sql_query(query, conn)
# Check the first few notes
print song_melody.pitch.head().apply(pretty_midi.note_number_to_name)<jupyter_output>0    A#3
1    A#4
2    A#3
3    A#4
4    G#4
Name: pitch, dtype: object<jupyter_text>Nope. Song goes G, Ab, G, Bb, Ab<jupyter_code># Melody db
query = "SELECT * FROM melody WHERE melid IS 7"
song_melody = pd.read_sql_query(query, conn)
# Check the first few notes
print song_melody.pitch.head().apply(pretty_midi.note_number_to_name)<jupyter_output>0     G3
1    G#3
2     G4
3    A#4
4    G#4
Name: pitch, dtype: object<jupyter_text>That's it, so melid doesn't have the other one dropped.<jupyter_code>pitch_range = song_melody.pitch.max()-song_melody.pitch.min()
ax= song_melody.pitch.hist(bins=int(pitch_range))
ax.grid(False)
# Probably a better way to do this?
pitches = song_melody.pitch.value_counts().nlargest(5).index
counts = song_melody.pitch.value_counts().nlargest(5).values
for i, c in zip(pitches, counts):
    print pretty_midi.note_number_to_name(i), " occurs ", c, " times"<jupyter_output>C#4  occurs  71  times
F4  occurs  61  times
G#4  occurs  52  times
A#3  occurs  50  times
D#4  occurs  40  times<jupyter_text>Looking at the sheet music, key is Dbmaj.Root, Db4 occurs the most (71)Third, F4 occurs second most (61)Fifth, Ab4 occurs third most (52)bSeven, Bb3 occurs fourth most (50)Second/ninth, Eb4 occurs fifth most (40)This all makes a lot of sense. Would be nice to write a function to get these all in the same range<jupyter_code>def same_range(value):
    while (value > 12): value -=12
    return int(value)
song_melody['normalized_pitch'] = song_melody.pitch.apply(same_range)
song_melody.head()<jupyter_output><empty_output><jupyter_text>That worked well. Let's reevaluate.<jupyter_code>pitch_range = song_melody.normalized_pitch.max()-song_melody.normalized_pitch.min()
ax= song_melody.normalized_pitch.hist(bins=int(pitch_range))
pitches = song_melody.normalized_pitch.value_counts().nlargest(5).index
counts = song_melody.normalized_pitch.value_counts().nlargest(5).values
for i, c in zip(pitches, counts):
    print pretty_midi.note_number_to_name(i), " occurs ", c, " times"<jupyter_output>C#-1  occurs  83  times
A#-1  occurs  79  times
G#-1  occurs  79  times
F-1  occurs  71  times
F#-1  occurs  52  times
{'fraction_non_alphanumeric': 0.10584461867426942, 'fraction_numerical': 0.027797576621525304, 'mean_word_length': 5.12882096069869, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '265337', 'license': 'MIT', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1059, 'n_words': 289, 'path': 'notebooks/single_song.ipynb', 'repo_name': 'tjburch/jazz', 'size': '2806'}