public function isBalanced() {

		// first remove any balanced pairs of two (basically any pairs that are a tritone apart)
		// this is done using a XOR against a tritone rotation, followed by an AND with the original set
		// set            : 000101000011
		// copy           : 000011000101
		// set xor copy   : 000110000110 -> result

		// result         : 000110000110
		// set            : 000101000011
		// set and result : 000100000010   this is the set, with the tritone expunged

		$set = $this->bits;
		$copy = $set;
		$copy = \ianring\BitmaskUtils::rotateBitmask($copy, 1, 6); // a tritone
		$result = $set ^ $copy; // xor, to get rid of bits that are present in both the original and the tritone rotation
		$set = $result & $set; // and, to remove any that are not in the original set


		// then remove any balanced pairs of three (ie augmented triads). We'll just hardcode those
		foreach(array(273, 546, 1092, 2184) as $triad) {
			if (($set & $triad) == $triad) {
				$set = $set & ~$triad;
			}
		}

		// if there are any tones left, then this PCS is not balanced.
		$remaining = \ianring\BitmaskUtils::countOnBits($set);
		if ($remaining > 0) {
			return false;
		}
		return true;
		
	}
public function isBalanced() {

		// first remove any balanced pairs of two (basically any pairs that are a tritone apart)
		// this is done using a XOR against a tritone rotation, followed by an AND with the original set
		// set            : 000101000011
		// copy           : 000011000101
		// set xor copy   : 000110000110 -> result

		// result         : 000110000110
		// set            : 000101000011
		// set and result : 000100000010   this is the set, with the tritone expunged

		$set = $this->bits;
		$copy = $set;
		$copy = \ianring\BitmaskUtils::rotateBitmask($copy, 1, 6); // a tritone
		$result = $set ^ $copy; // xor, to get rid of bits that are present in both the original and the tritone rotation
		$set = $result & $set; // and, to remove any that are not in the original set


		// then remove any balanced pairs of three (ie augmented triads). We'll just hardcode those
		foreach(array(273, 546, 1092, 2184) as $triad) {
			if (($set & $triad) == $triad) {
				$set = $set & ~$triad;
			}
		}

		// if there are any tones left, then this PCS is not balanced.
		$remaining = \ianring\BitmaskUtils::countOnBits($set);
		if ($remaining > 0) {
			return false;
		}
		return true;
		
	}
public function isBalanced ( ) { // first remove any balanced pairs of two (basically any pairs that are a tritone apart) // this is done using a XOR against a tritone rotation, followed by an AND with the original set // set            : 000101000011 // copy           : 000011000101 // set xor copy   : 000110000110 -> result // result         : 000110000110 // set            : 000101000011 // set and result : 000100000010   this is the set, with the tritone expunged $ set = $ this -> bits ; $ copy = $ set ; $ copy = \ ianring \ BitmaskUtils :: rotateBitmask ( $ copy , 1 , 6 ) ; // a tritone $ result = $ set ^ $ copy ; // xor, to get rid of bits that are present in both the original and the tritone rotation $ set = $ result & $ set ; // and, to remove any that are not in the original set // then remove any balanced pairs of three (ie augmented triads). We'll just hardcode those foreach ( array ( 273 , 546 , 1092 , 2184 ) as $ triad ) { if ( ( $ set & $ triad ) == $ triad ) { $ set = $ set & ~ $ triad ; } } // if there are any tones left, then this PCS is not balanced. $ remaining = \ ianring \ BitmaskUtils :: countOnBits ( $ set ) ; if ( $ remaining > 0 ) { return false ; } return true ; }
Balance means that the distribution of pitch classes would satisfy the "centrifuge problem". ie
if you put the pitch class in a centrifuge, would it balance. For a n = 12, this can only be true
if all tones in the PCS are non-overlapping evenly-spaced groups of 2 or 3.
@see  https://www.youtube.com/watch?v=7DHE8RnsCQ8 "The Centrifuge Problem"
Balance means that the distribution of pitch classes would satisfy the centrifuge problem . ie if you put the pitch class in a centrifuge would it balance . For a n = 12 this can only be true if all tones in the PCS are non - overlapping evenly - spaced groups of 2 or 3 .