I am writing a midi generator using python and the mido library. I am just struggling to understand the point of the key_signature and time_signature meta messages. I have kept these in my data but if I remove them from the songs messages and play it, they sound identical. I previously thought that key_signature messages were important in defining which notes where sharp etc however on consulting https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies I see that the note_on messages already specify whether it is sharp or flat. Equally I thought the time_signature messages were important in setting overall timing ( I know little about music theory) but then discovered mid.ticks_per_beat seems to do this instead.
All I am trying to ascertain is whether these messages are important to keep if generating new music that looks at patterns between many songs. Equally if someone could elaborate on the importance of mid.ticks_per_beat and how I should combine these values across multiple songs when generating new music, this would be thoroughly appreciated.