If your hard drive has failed or become broken recently and you have not backed up your music collection, you have probably lost all of it. Luckily, there is a free way to recover your music off of your iPod Touch, iPad or iPhone. Follow these steps below:
Step 1) Download iExplorer from here and install the correct version (Mac/PC).
Step 2) Open iExplorer and iTunes and plug in your device.
Step 3) On iExplorer, find the device that you want to download your music from. Click the arrow next to iPod or whatever your device is named. Then click the arrow next to Media > iTunes_Control > Music.
Step 4) Select the Music folder and copy it to your desktop.
Step 5) Now drag the Music folder from your desktop to iTunes to get your music back!