<jupyter_start><jupyter_text>Whole-tone CollectionsThere are two possible whole-tone collections, (1) that features only even numbered pitch classes, and (2) the other which only features odd numbered pitch classes. The former goes by the name of WT0, while the latter is called WT1. Messiaen called the whole-tone scale the *first mode* of limited transposition, because only two transpositions are possible (WT0 and WT1).  Required Libraries<jupyter_code>import music21
from IPython.display import Markdown, display<jupyter_output><empty_output><jupyter_text>Functions  Printing to Markdown<jupyter_code># Printing to Markdown
# ------------------------

def print_md(string):
    """
    Pretty print function to print to markdown.
    """
    display(Markdown(string))<jupyter_output><empty_output><jupyter_text>Creating Whole-tone Collections<jupyter_code># Whole-tone Collections
# ---------------------

def get_wholetone_collection(pc):
    """
    Music21 has a wholetone collection built in.
    """
    wholetone = music21.scale.WholeToneScale(pc)
    print(pc + " Wholetone Collection")
    wholetone_scale = music21.stream.Stream()
    [wholetone_scale.append(music21.note.Note(p)) for p in wholetone.pitches]

    return wholetone_scale<jupyter_output><empty_output><jupyter_text>Analyzing Whole-tone Collections<jupyter_code># Analyze a Whole-tone Collection
# ------------------------------

def analyze_wholetone_collection(wholetone_scale):
    """
    Analyzes properties of the the wholetone collection.
    """
    pitch_center = wholetone_scale[0].pitch.pitchClass
    
    if(pitch_center % 2 == 0):
        wholetone_transposition = 0
    else:
        wholetone_transposition = 1
    
    return wholetone_transposition, pitch_center<jupyter_output><empty_output><jupyter_text>Representations of a Whole-tone Collection Visual<jupyter_code># Accessing the Whole-tone Collection
wholetone_scale = get_wholetone_collection("D")
wholetone_scale.show()<jupyter_output>D Wholetone Collection<jupyter_text>Aural<jupyter_code># Listening to the Whole-tone Scale (does not show in GitHub)
wholetone_scale.show('midi')<jupyter_output><empty_output><jupyter_text>Whole-tone Collection Analysis<jupyter_code>wholetone_analysis = analyze_wholetone_collection(wholetone_scale)
wholetone_analysis<jupyter_output><empty_output><jupyter_text>The resulting tuple shows the transposition and pitch center of a whole-tone collection.  Formatting Analysis Results<jupyter_code># Pretty-printing the analysis results 
print_md("*Transposition*: WT<sub>{}</sub><br />".format(wholetone_analysis[0]) +
         "*Pitch Center*: {}".format(wholetone_analysis[1]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11358574610244988, 'fraction_numerical': 0.008537490720118782, 'mean_word_length': 5.015625, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '453925', 'license': 'MIT', 'n_tokens_mistral': 872, 'n_tokens_neox': 823, 'n_words': 193, 'path': 'Whole-tone Collections.ipynb', 'repo_name': 'musicus/Post-Tonal-vade-mecum', 'size': '2694'}