1) What I did was pick the smallest fraction I wanted to use ( 1/4, 1/8, 1/16, etc.) and then keep track of how many I had. The denominator doesn't change; so you only need to keep track of the numerator. The resulting fraction can be reduced later if desired -- that's only a matter of display.
I also found that using 1/32 and 1/64 took a very long time with my technique.
Here are some of my enumerations and results:
public enum Duration4
{
[System.ComponentModel.DescriptionAttribute("1/4")]
Quarter = 1,
[System.ComponentModel.DescriptionAttribute("2/4")]
Half = 2,
[System.ComponentModel.DescriptionAttribute("4/4")]
Whole = 4
}
{ 4/4 }
{ 2/4 , 2/4 }
{ 2/4 , 1/4 , 1/4 }
{ 1/4 , 2/4 , 1/4 }
{ 1/4 , 1/4 , 2/4 }
{ 1/4 , 1/4 , 1/4 , 1/4 }
6 rhythms found in 00:00:00.0057366
public enum Duration4d
{
Quarter = 1
, Half = 2
, DottedHalf = 3
, Whole = 4
}
{ Whole }
{ DottedHalf , Quarter }
{ Half , Half }
{ Half , Quarter , Quarter }
{ Quarter , DottedHalf }
{ Quarter , Half , Quarter }
{ Quarter , Quarter , Half }
{ Quarter , Quarter , Quarter , Quarter }
8 rhythms found in 00:00:00.0034388
public enum Duration8
{
[System.ComponentModel.DescriptionAttribute("1/8")]
Eighth = 1 ,
[System.ComponentModel.DescriptionAttribute("1/4")]
Quarter = 2,
[System.ComponentModel.DescriptionAttribute("1/2")]
Half = 4 ,
[System.ComponentModel.DescriptionAttribute("1")]
Whole = 8
}
{ 1 }
{ 1/2 , 1/2 }
{ 1/2 , 1/4 , 1/4 }
{ 1/2 , 1/4 , 1/8 , 1/8 }
{ 1/2 , 1/8 , 1/4 , 1/8 }
{ 1/2 , 1/8 , 1/8 , 1/4 }
{ 1/2 , 1/8 , 1/8 , 1/8 , 1/8 }
{ 1/4 , 1/2 , 1/4 }
{ 1/4 , 1/2 , 1/8 , 1/8 }
{ 1/4 , 1/4 , 1/2 }
...
{ 1/8 , 1/8 , 1/8 , 1/4 , 1/4 , 1/8 }
{ 1/8 , 1/8 , 1/8 , 1/4 , 1/8 , 1/4 }
{ 1/8 , 1/8 , 1/8 , 1/4 , 1/8 , 1/8 , 1/8 }
{ 1/8 , 1/8 , 1/8 , 1/8 , 1/2 }
{ 1/8 , 1/8 , 1/8 , 1/8 , 1/4 , 1/4 }
{ 1/8 , 1/8 , 1/8 , 1/8 , 1/4 , 1/8 , 1/8 }
{ 1/8 , 1/8 , 1/8 , 1/8 , 1/8 , 1/4 , 1/8 }
{ 1/8 , 1/8 , 1/8 , 1/8 , 1/8 , 1/8 , 1/4 }
{ 1/8 , 1/8 , 1/8 , 1/8 , 1/8 , 1/8 , 1/8 , 1/8 }
56 rhythms found in 00:00:00.0045673
|