Musical notation has been around for a long time. The ancient Greeks had toyed around with the idea long before the Middle Ages. However, in the early part of the medieval period after the collapse of the Western Roman Empire (often called the Dark Ages), much of what was sung or played was not recorded. The few examples of notation that have survived come in the form of neumes, a system of notation which indicate pitch and rhythm using basic lines and strokes above words. Neumes do not dictate every detail of a piece. Instead, they were designed as a mnemonic device, helping musicians remember certain segments. There was no universal system for neumes. Each region had their own way of notating what they wanted to record. In the thirteenth century, music theorists in Paris invented a system of notation based on rhetorical metre in the study of Latin. This school of music is known as the ars antiqua. This system uses the boxes and lines we are used to seeing on medieval manuscripts. Eventually, this led to the development of ars nova in the following century, which was much more precise and similar to the staff notation we use today. It was only then that musicians had enough information on the page to sightread music!
By the late middle ages, Europe had an established manuscript culture, meaning everything which was written down in large, binded piles of pages (usually made with animal skin) that formed a thick book. We should bear in mind that making manuscripts was an expensive process, and so only the most privileged in society got to record what they wrote. In effect, this meant only clergymen (with money from the church) and nobility could afford their own collections of music.