i think with mp3's, if you just chop the data, you can then play the chopped file.
ie if a song is 3 mins 20 secs and 4.1MB, you can get the first 2.05MB and save it as a new mp3 file, and it will play for 1 min 40.
so if you used a function to get the bit rate and quality of encoding of an mp3, you could work out how many bites would give you 30 seconds worth of music.
i think the id3 tags are placed at the front of the data, and may even be fixed length. a bit of trial and error involved, but that should get you started.
also have a look at http://sourceforge.net/projects/php-mp3/