Wow, that works. I don't know how, but it works.
The reason it works is that the modifiers are applied in-order, and they do this:
~limit=-1,1,[Artist]: Limits the list to one randomly-selected track from every artist currently in the list, in a shuffled order.
~expand=Artist: Expands the list to include ALL tracks from each artist. Note: ~expand works in-place on the list, so each of the randomly selected single-tracks from the first ~limit "blow up" where they are in the list to include all of the tracks by that artist, but the list overall retains the shuffled order (with all the Artists grouped together).
~seq: Saves the list order.
~sort=Random: Shuffles the list (this is actually probably not needed, but doesn't hurt).
~limit=-1,2,[Artist]: Re-limits the new list to 2 randomly-selected tracks by every artist.
~sort=[Sequence]: Puts the list back into the order saved before, which will re-group the Artist tracks together (because the ~expand works in-place, so that order had all the Artist's tracks grouped together).
is there any way to use [Artist] for multiple artists albums (or based on the [Grouping] value] and use [Album Artist (Auto)] for everything else?
Not really.
But you could make your own version of [Artist Album (Auto)] that doesn't do the Various Artists thing that the built-in one does. I, for example, don't use [Artist Album (Auto)] in my Library and have my own [Artist Album (Smart)] expression-field which does:
FirstNotEmpty([Album Artist], ListItem([Artist],0))
If you implemented that and used it, then I think that would do what you want. It outputs [Album Artist] if the track has one, and if not, it outputs the first (and only first) entry in the [Artist] field.
Also is there a way to exclude artists if I only have one song by them?
Yes. But this is a bit more complicated.
The ~expand modifier will always expand the selection to ALL matching files across your Library, and since it is a Modifier to the search, it always happens after the "limits" applied by the search. So, you can't re-limit a search to exclude files in any search that includes an ~expand (because the ~expand will "override" the limitations). To make this more clear:
If you do a search for:
[Media Type]=[Audio] [Media Sub Type]=[],[Music] -[Genre]=[Electronic]
(all music files, except those in Genre "Electronic".)
And then add an ~expand=Artist to it, the resulting list MAY include some files in Genre "Electronic" if you have some Artists which have some tracks tagged as Electronic and others that are not. If the Artist only has tracks tagged as Electronic, then it won't be in the list at all, because it will have been excluded from the ~expand. But if it has
even one non-Electronic track, then it'll still be there, and then the ~expand will expand it to all tracks.
So, to accomplish your goal, you need to be able to re-filter your search AFTER the ~expand with another, separate search, so that you can still do the ~expand but then afterwards "filter out" those tracks where you only have a single artist. You can do this with multiple smartlists which point to each other. To exclude all single-track Artists, you'll only need one extra "utility" list.
Make a separate smartlist called "One Track Artist Remover" (or whatever you want, but that's what mine is called). You won't actually use this List for anything other than "filtering" so you might want to bury it in a "utility" Playlist Group (mine are in Utility\View Filters\ under Playlists). Give it this Search:
[Media Type]=[Audio] [Media Sub Type]=[],[Music] ~limit=-1,1,[Artist] ~sort=[Artist]
That makes a list of all Artists in your Library, with one randomly-selected track per Artist. Here's the beauty part: If you only have one track for a particular Artist, then that will be the track "selected" for that Artist (the ~limit won't be random in that case, it'll select the only one there is).
Then, take that list, and filter your expanded-list with it:
[Media Type]=[Audio] [Media Sub Type]=[],[Music] -p="Utility\View Filters\One Track Artist Remover" -p="Utility\View Filters\Standard View Filters" ~limit=-1,1,[Artist] ~expand=Artist ~seq ~sort=Random ~limit=-1,2,[Artist] ~sort=[Sequence]
That way, any artists that only have a single file will be filtered out entirely before the ~expand happens. But, for any Artist in the One Track Artist Remover that do have more than one file in the Library, it won't matter that the one random file is excluded, because the ~expand will "override" that after the fact.
If you want to limit it instead to only Artists which have more than 3 or 15 tracks, you just change the ~limit on your One Track Artist Remover list to ~limit=-1,3,[Artist] or ~limit=-1,15,[Artist] or whatever.
I use this same type of "trick" extensively in my Library. I have lots of Smartlist filters like that that apply to all kinds of things. For example, I have Views that are limited to "Favorite Artists" which are defined as Artists which have at least 4 tracks rated 3 stars or better, or those that are in one of my "top hits" lists. I accomplish this by having a "Utility\View Filters\One Hit Artist Remover" that has filters to limit it to only highly-rated tracks, and then has ~limit=-1,3,[Artist]. Then, in separate lists, gets filtered out before an ~expand (much like I explained here) to eliminate Artists which have only a few highly-rated tracks, but keep those with lots.
This same idea lets you make
all kinds of cool lists.