This article may be too technical for most readers to understand. Please make it understandable to non-experts, without removing the technical details. (May 2017) (Learn how and when to remove this template message)to
The examples and perspective in this article deal primarily with the United States and do not represent a worldwide view of the subject. (December 2017) (Learn how and when to remove this template message)
In the United States, any musical works published before 1922, in addition to those voluntarily placed in public domain, exist in the public domain. In most other countries, music generally enters the public domain in a period of fifty to seventy-five years after the composer's death. (Public domain rights must be verified for each individual country.) It is important to note the distinction between "musical works" (sheet music and other compositions) and "sound recordings" (audio files, CDs, records), as virtually all sound recordings will not fall into public domain until 2067, unless explicitly placed into the public domain by its creators, rights holders or made by an employee or officer of the United States government acting under their official duty. (The status of copyright on sound recordings in the United States from before such copyrights were nationalized 1972 is nebulous; the copyrights were prior to that were considered a state issue, and even if no state law provided for it, some courts established an extra-legal common law copyright, the exact nature of which has been inconsistently applied over the years.) 
In the European Union and Canada, sound recordings were copyrighted for fifty years until 2013. On January 1, 2013, the Beatles' single "Love Me Do" entered the public domain. As of November 2013, European sound recordings are now protected for 70 years, which is not retroactive. In 2015, Canada changed the copyright length to 70 years.
If a piece of music does not fall within public domain and is under copyright, then it is unlawful to reproduce, perform, distribute, or create a new version of that music without a proper license. Under compulsory license laws, some of these actions may in fact be lawful, but the infringing party would then be liable for any royalty the copyright holder may charge for the use of their work.
Inherently, all historical musical works (pre-1922) are public domain. Classical sheet music, for example, is widely available for free use and reproduction. Some more current works are also available for free use through public works projects such as Internet Archive. This and similar projects aim to preserve and make readily available thousands of public domain music files, many of which have been recorded by projects dedicated to recording music for public use.
Music on the Creative Commons:
The Creative Commons is a nonprofit organization created for the purpose of housing the public domain. The Commons allows copyright owners to dedicate their works to the public domain either immediately or, with the "Founders' Copyright" (originally created in the first copyright law in 1790), can obtain an exclusive license for 14 or 28 years (if renewed) of copyright protection in exchange for selling their work to the Commons for one dollar after that protection has expired. Copyright owners can fill out an online application at https://creativecommons.org/ in order to apply.
Public domain musical works and recordings can be loaded onto the Wikimedia Commons website.
For music, the involved rights are: