Skip to content

Instantly share code, notes, and snippets.

@alanwhite
Last active December 4, 2021 16:38
Show Gist options
  • Save alanwhite/19c4c465241f28f3a3e3ee40644f8980 to your computer and use it in GitHub Desktop.
Save alanwhite/19c4c465241f28f3a3e3ee40644f8980 to your computer and use it in GitHub Desktop.
Helper class for exposing characteristics of a time signature
public class TimeSigUtil {
public static boolean isCompoundTime(TimeSigModel model) {
if ( model.getTop() == 3 )
return false;
if ( model.getTop() % 3 == 0 )
return true;
return false;
}
public static int beatsPerBar(TimeSigModel ts) {
if ( TimeSigUtil.isCompoundTime(ts) )
return ts.getTop() / 3;
return ts.getTop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment