The Buddha advised us to follow the 5 precepts. These are
1- Not to kill
2- Not to steal
3- Not to comit adultery
4- Not to lie
5- Not to take intoxicants
These are the basic precepts which support meditation. Now, if you're in a meditation retreat, you are advised to follow the 8 precepts, which are the first 5 except that the 3rd changes to no sexual activity, and 3 more:
6- Not eating after noon
7- Not (intentionaly) listen to music, dance or wear garlands and perfumes
8- Not to sleep on high or luxurious beds
So the abstaining from hearing music makes sense in a retreat environment, or on special days dedicated to meditation alone, but in regular lay life, you can hear music.
Just as a further clarification. We come from a christian culture, with a chritian moral conscience, even if we don't realise it. Buddhist morality is different in the following sense: not only it includes the (general) christian morality, but also includes things that we don't see as imoral, in the western sense of the word. Smoking cannabis seems, from a western point of view, as harmless since you're not doing anybody else any harm. This is the centre of the divergence. Buddhist morality is about cultivating wholesome states of mind and avoid unwholesome states of mind. It's true that hurting others creates an unwholesome state of mind. But so does smoking cannabis.
The atitude towards music is the same. When you hear it, and delight on it, you are fueling unwholesome desire. You're not hurting anyone, obviously. Just yourself. I listen to music everyday because I'm a lay person and I don't follow every single thing the Buddha advised us to do. As laymen we must find balance.
Last, but not the least, there's no God, or other exterior entity, judging you. It's not mandatory to follow anything. The teaching is there for you to practice it if you want the bennefits. You are of course advised to follow the Buddha's teachings, but there is no dogma.
He turns his mind away from those phenomena, and having done so, inclines his mind to the property of deathlessness: 'This is peace, this is exquisite — the resolution of all fabrications; the relinquishment of all acquisitions; the ending of craving; dispassion; cessation; Unbinding.'
(Jhana Sutta - Thanissaro Bhikkhu translation)