The Middle Ages spanned from 476 to 1400 AD. During this time, society was conservative and oriented towards the Roman Catholic Church, which was the primary patron of art, education, and culture. Music was cultivated primarily by the church, with composers being churchmen and musicians receiving their training as choirboys. Music was not notated but learned by ear, and was intended to create spiritual moods. Exceptions included troubadours, wandering musician entertainers. The church preserved culture during the Medieval Period's harsh conditions and threats. Musical notation began in this era, with Gregorian chant invented around 500 AD and polyphony developing by the end of the Middle Ages.