You are right on track there, just don't need foreach for album there.
function sortSongs($artist){
$count = count($artist);
if($count == 2){
foreach($artist as $album=>$trackListing){
sortSongs($artist[$album]);
}
}else{
usort($artist, 'arraySort');
print_r($artist);
}
}