Mixer 1.8 Preview: Advanced Constraints
The previous post in this series introduced constraints. This post will show some of the more advanced options, and provide a few more examples.
So far, we’ve seen how to use a constraint to specify extra conditions on which songs should be included in a mix. The full constraint system lets you do more than that - you can specify specific percentages of songs you would like to see satisfying certain conditions. To do this, we add two more attributes: min, and max. These specify the minimum and maximum percentages you would like to see rules satisfying the condition. Percentages are normally expressed in statistical notation, where 0 means 0% and 1 means 100% (.5 would mean 50%). If you would like to use a different scale, like 0 to 100, you can use the scale attribute to select it. By default, the minimum percentage is 100%. Naturally the maximum percentage cannot be less than the minimum percentage.
Let’s use a somewhat offbeat example to check out this feature. Suppose you want to make sure your playlist contains an equal amount of songs by men and women performers. You might recall you can express a power search like “songs by men” or “songs by women”. So, you could combine the following two rules:
<constraint min=”.5″>songs by women</constraint> <constraint min=”.5″>songs by men</constraint>
In this case, since we’ve tried to get %50 in either category, and the categories are mutually exclusive, we should end up with an equal number of songs by men and women.
As in our previous example, there’s a gotcha lurking here… artists which are not yet marked by type may creep into the mix since the engine doesn’t really read rules the way a human does - neither rule explicitly rejects songs not by men or women. To guarantee this, you could add a third rule:
<constraint>songs by men or songs by women</constraint>
Now you should get precisely the behaviour we’re interested in.
Finally, we’ll finish up with a detail. If you impose a very tight constraint, or series of constraints, you may end up with no songs to put in your mixes. To minimize this, a constraint will, by default, exclude no more than 50 songs before disabling itself in a given mix. If you would like to alter this threshold, you can specify a different one using the cutoff attribute. Specify a cutoff of 0 to mean there is no limit.
Next time, we’ll introduce a new kind of rule!
April 11th, 2007 at 4:40 pm
wow, you really did a good job thinking this out.
April 11th, 2007 at 4:46 pm
I guess you can assume you can do what i said before by saying you got a few playlists made and you want a few songs randamly from them into one based on %s. 5% of this whatever of that till equals to 100% Im glad you worked this in somehow. Im sure you can make it also based on how many mins you want it or hours or what hours to base it on. Thanks again
May 1st, 2007 at 7:13 pm
is there anyway you can put this option in menus to set up how we want or can you do a deeper beginer totorial or something on how to do this. Im not a programmer and I get lost…
May 11th, 2007 at 6:59 am
I agree with Tomas -> get lost