sul-cidr/josquin-ribbon

Encode pitch variation (windowed standard deviation) of as ribbon width

Closed this issue · 4 comments

Encode pitch variation (windowed standard deviation) of as ribbon width

My understanding so far is that we need to take a "window", meaning a fixed interval of a certain number of beats, and move it along the work at a certain increment, say every beat. This gives us a set of notes for each time increment. For that set of notes, we can compute the mean and standard deviation of pitches

image
The standard deviation graphic from Wikipedia: Standard deviation

For the ribbons, I believe the top and bottom points for every time increment corresponds to the mean + standard deviation and mean - standard deviation.

In summary, we have a few parameters that we need to fix in order to compute the windowed standard deviation:

  • interval - The interval size for the sliding window, in units of beats. Let's try 6 as a first pass (arbitrary), then iterate on the value.
  • step - How much to slide the window for each iteration. Let's try 1 beat as the first value here - so the window will "slide along" in increments of 1 beat.
  • bandwidth - The scaling factor multiplied by the standard deviation before adding/subtracting from the mean. In the above figure, the shades of blue would correspond to bandwidth integers. Let's try 1 as a first pass.

This is coming along nicely in #71. Thankfully D3 actually has mean and standard deviation functions built-in, so we can use those once we iron out the remaining bug with NaNs appearing in the paths.

I feel like once we cross this hurdle, the other encodings will be fairly straightforward (#10, #11). We could also do windowed (min, max), which is what I'm using for now as a proxy for the standard deviation.

Finally working! Here's what windowed standard deviation looks like.

image