Using [man]fgetcsv[/man] (specifying a pipe for the delimiter) could also be used for the reading.
You can build the [font=monospace]$genre_list[/font] and [font=monospace]$big_list[/font] of dalecosp's sample concurrently, since you don't need the completed genre list until you've finished reading the file (so, no rewinding). In fact, you can build [font=monospace]$genre_list[/font] from the contents of [font=monospace]$big_list[/font]; if you're using a version of PHP >= 5.5 then [font=monospace]$genre_list = array_unique(array_column($big_list, 0));[/font] will do that.
...Ah, okay.
array_multisort($big_list, SORT_ASC, SORT_STRING, array_column($big_list, 1)); // Sort by title
$genre_list = array_fill_keys(array_unique(array_column($big_list, 0)), []); // Genre list
ksort($genre_list); // Have to do this sometime, might as well be now.
foreach($big_list as $track)
{
$genre_list[$track[0]][] = $track;
}
(PS: [noparse]Mysite.com[/noparse] is a thing; Example.com exists for that sort of usage.)
(PPS: If it is a large file, then rewinding a file handle is a matter of calling [man]rewind[/man] between one read-through and the next. But if it's that large then there are other considerations, like the fact you'll need to write stuff out before you've read everything. Since you happen to want to sort the file by its first and second columns, you can just throw the whole thing through a command-line sort(1) without any special effort and it will come out right.)