The concept of using dynamic markings (which indicate the relative loudness of different sections in the music) in sheet music came about around the same time as the piano — for good reason. Before the invention of the piano by Bartolomeo Cristofori in 1709, most composers were confined to writing most of their pieces for either the harpsichord or the clavichord; neither instrument had the capability to play both soft and loud sounds easily.
The reason for this is that the basic internal design of both the harpsichord and the clavichord follows the design of a stringed instrument. However, instead of having one’s fingers in direct contact with the string, as with a guitar or a fiddle, harpsichords and clavichords are fitted with a plucking mechanism inside the instrument itself. When a certain key is pressed, the corresponding internal string is plucked by the mechanism. No matter how hard or soft you press the keys of either instrument, the resulting volume is pretty much the same. Therefore, clavichords were used for quiet pieces of music that required lots of vibrato (quavering quality to notes that usually comes from a stringed instrument), whereas harpsichords were used for louder, brighter-sounding pieces.
Although the piano looks a lot like these two other instruments, it’s really very different. The piano incorporates a hammer-and-lever mechanism that strikes each string with the same force as the human finger on the piano key did; this is why the piano is considered a percussive instrument. The piano made both quiet and loud sounds possible on the same instrument, and, therefore, in the same musical piece. This is why the piano was originally named the gravicèmbalo col pian e forte, or “harpsichord with soft and loud.” The name was later shortened to pianoforte and, finally, to piano.
Since its inception, the piano has been the universal tool of choice for composing music, because almost every note you would ever want to work with is present on the keyboard, right there in front of you. Most pianos have at least 7 octaves to work with, and concert pianos can have more than 12 octaves.