slurmulon / bach

:musical_score: Semantic music notation
http://codebach.tech
MIT License
8 stars 0 forks source link

Ensure that beat notes are always provided as a collection #20

Open slurmulon opened 5 years ago

slurmulon commented 5 years ago

Right now if you have a pair that only contains a single element:

2 -> Chord('Fm')

When you compile the track into Bach.JSON (via back.track/compile-track) you will receive the following:

{
  "duration": 2,
  "notes": {
    "atom": {
      "init": {
        "arguments": [
          "Fm"
        ]
      },
      "keyword": "Chord"
    }
  }
}

This makes high-level parsing more complicated because you have to determine whether or not notes is a collection before you can interpret it.

Instead, we should always receive a collection regardless of how many notes/elements are in a beat pair:

{
  "duration": 2,
  "notes": [
    {
      "atom": {
        "init": {
          "arguments": [
            "Fm"
          ]
        },
        "keyword": "Chord"
      }
    }
  ]
}