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.
You should also check for the existance of a ".nomedia" (hidden) file in any directory. This file is placed there by system for some operations where media availability should be prohibited. Sometimes it is left there by unexpected interruption. Usually while connected to USB, or incomming call. Remove/delete/rename it, and you should be on track again.