Skip to content

Instantly share code, notes, and snippets.

@alanwhite
Last active December 4, 2021 18:41
Show Gist options
  • Save alanwhite/f81a12861a7bbd8be8a863ee8ecfb20d to your computer and use it in GitHub Desktop.
Save alanwhite/f81a12861a7bbd8be8a863ee8ecfb20d to your computer and use it in GitHub Desktop.
public class Divisions {
public static int divisionsPerBeat(MusicalContext mcx) {
var div = mcx.getDivisions() * 4;
var top = mcx.getTimeSig().getTop();
var bot = mcx.getTimeSig().getBottom();
var bpb = TimeSigUtil.beatsPerBar(mcx.getTimeSig());
return (div * top) / bot / bpb;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment