Music Piece Generator

This course generator is used to create courses that progressively teach mastery of a musical piece, starting at the smallest fragments and gradually building up to the entire piece. The course author must divide up the piece into fragments and write them down in the configuration of the course.

Specification

The specification for the music asset containing the music sheet of the piece:

#![allow(unused)]
fn main() {
/// Represents a music asset to be practiced.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum MusicAsset {
    /// A link to a SoundSlice.
    SoundSlice(String),

    /// The path to a local file. For example, the path to a PDF of the sheet music.
    LocalFile(String),
}
}

The specification for how musical passages are declared and divided up:

#![allow(unused)]
fn main() {
/// Represents a music passage to be practiced.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct MusicPassage {
    /// The start of the passage.
    pub start: String,

    /// The end of the passage.
    pub end: String,

    /// The sub-passages that must be mastered before this passage can be mastered. Each
    /// sub-passage should be given a unique index which will be used to generate the lesson ID.
    /// Those values should not change once they are defined or progress for this lesson will be
    /// lost. This value is a map instead of a list because rearranging the order of the
    /// passages in a list would also change the IDs of the generated lessons.
    pub sub_passages: HashMap<usize, MusicPassage>,
}
}

The specification for the course configuration for music piece courses:

#![allow(unused)]
fn main() {
/// The config to create a course that teaches a piece of music.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct MusicPieceConfig {
    /// The asset containing the music to be practiced.
    pub music_asset: MusicAsset,

    /// The passages in which the music is divided for practice.
    pub passages: MusicPassage,
}
}

The top musical passage should always ask the student to play the entire piece. Each of the dependencies asks the student to play a smaller fragment of the piece. There can be an arbitrary number of nested passages, which allow pieces to be divided into arbitrarily small fragments. To allow more flexibility, the start and end values of each passage are specified as a string.

The musical asset specifies where the music sheet for the piece is located. It can be specified as a link to a SoundSlice or as the path to a local file.

Example configuration

Below is an example course generator config for this type of course.

{
  "id": "trane::example::knowledge_base",
  "name": "Example Knowledge Base Course",
  "dependencies": [],
  "description": "An example knowledge base course.",
  "authors": [
    "The Trane Project"
  ],
  "metadata": null,
  "course_material": null,
  "course_instructions": null,
  "generator_config": {
    "MusicPiece": {
      "music_asset": {
        "LocalFile": "music_sheet.pdf"
      },
      "passages": {
        "start": "start of the piece",
        "end": "end of the piece",
        "sub_passages": [
          {
            "start": "start of bar 1",
            "end": "end of bar 10",
            "sub_passages": []
          },
          {
            "start": "start of bar 10",
            "end": "end of bar 20",
            "sub_passages": []
          }
        ]
      }
    }
  }
}

Example course

TODO: This section is under construction.