{ "cells": [ { "cell_type": "markdown", "id": "ff432e27-898c-4aa4-a04a-5eeb7bad9c38", "metadata": {}, "source": [ "# ScoreStruct\n", "\n", "In **maelzel.core** there is a division of concerns between music data (notes, chords, lines, voices, etc) and a score structure. The score structure (the `ScoreStruct` class) consists of a set of measure definitions (time signature, tempo). \n", "\n", "* [Defining a score structure](#Defining-a-score-structure)\n", "* [Content / Structure](#Content-/-Structure)\n", "* [Creating a click track from a ScoreStruct](#Creating-a-click-track-from-a-ScoreStruct)\n", "* [Exporting](#Exporting)\n", "* [Musical time vs Real time](#Musical-time-vs-Real-time)\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "694102bd-2f43-4422-a88b-364e0c9bfae7", "metadata": {}, "outputs": [], "source": [ "from maelzel.core import *\n", "from IPython.display import display" ] }, { "cell_type": "markdown", "id": "40ae4401-fd8f-472b-981a-4d538f93f39d", "metadata": {}, "source": [ "## Defining a score structure\n", "\n", "A `ScoreStruct` can be defined by adding measure definitions or from a string.\n", "\n", "Notice at the html representation of the ScoreStruct that there are time signatures which appear between parenthesis: these are inherited time signatures. The same applies to tempo: **if the measure does not define an explicit time signature or tempo, then these attributes are inherited from the previous measure** with an explicit tempo" ] }, { "cell_type": "code", "execution_count": 2, "id": "831525c4-6c49-41dc-b12b-c3d121f8ed73", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
ScoreStruct
| Meas. Index | Timesig | Tempo (quarter note) | Label | Rehearsal | Barline |
|---|---|---|---|---|---|
| 0 | 4/4 | 70 | |||
| 1 | 5/8 | ||||
| 2 | 3/4 | 140 | Section B | ||
| 3 | 3/8 | ||||
| 4 | (3/8) | ||||
| 5 | (3/8) | ||||
| 6 | (3/8) | ||||
| 7 | (3/8) | ||||
| 8 | (3/8) | ||||
| 9 | (3/8) | ||||
| 10 | 4/4 | 60 | |||
| 11 | 5/16 | ||||
| 12 | (5/16) | ||||
| 13 | 7/16 | ||||
| 14 | 3/8 | ||||
| ... |
4A#:1.2♩\"/home/em/.local/share/maelzel/recordings/rec-2024-01-21T19:01:58.548.wav\", 1 channels, 12.02 secs, 44100 Hz)\"/home/em/.local/share/maelzel/recordings/rec-2024-01-21T19:02:00.907.wav\", 1 channels, 8.20 secs, 44100 Hz)\"/home/em/.local/share/maelzel/recordings/rec-2024-01-21T19:02:06.746.wav\", 1 channels, 12.02 secs, 44100 Hz)\"/home/em/.local/share/maelzel/recordings/rec-2024-01-21T20:27:51.160.wav\", 1 channels, 12.02 secs, 44100 Hz)Score(1 voices)\"/home/em/.local/share/maelzel/recordings/rec-2024-01-20T19:12:31.084.wav\", 1 channels, 17.35 secs, 44100 Hz)4G:2♩:offset=84G:1.5♩:offset=6