In case of Android 4.0.4 / 4.1 you should do the following steps:

Settings -> Apps -> All
Locate the following:

ProtectedMediaScanner -> Clear data & Force stop

ProtectedMediaScannerTrigger -> Clear data & Force stop

Media Storage -> Clear data & Force stop

Restart your Android phone. Turn it off, then on again.
Let it rest for 10-15 minutes. Afterwards your media files should be available by Gallery and Music player.