Define an array of weights where the weight of int i is associated with the value weights[i]
next() chooses an int 0..weights.length-1, following a weighted distribution
For example, the weight array { 1.0, 1.0 } will generate values 0 and 1 with a 50/50 distribution
The weight array { 1, 2, 1 } will generate ints 0, 1, 2, with the probability of 1 being chosen twice as high
as the probability of 0 or 2 being chosen.
The duration, followed by 0xFF, followed by the type of MetaEvent,
followed by the length of the array,
followed by the array itself will be written to the file.