slurmulon/bach

Duration calculation is off when the lowest beat is less than 1 measure

slurmulon opened this issue · 0 comments

Problem

The resulting duration for each beat is not considering the lowest beat in the track, resulting in incorrect values.

This issue is also related to get-ms-per-beat, as it needs to be updated to consider the lowest-beat in a similar way (otherwise the duration values will not align properly).

Example

In this case, the duration of the :ED and :EP beats should be 8 instead of 4.

Once that is fixed, the ms-per-beat should be 4285.7144 instead of 2142.8572.

Bach

@Tempo = 56

:ED  = Scale('E3 dorian')
:EP  = Scale('E3 phrygian')
:DP  = Scale('D3 minorpentatonic')
:EbP = Scale('Eb3 minorpentatonic')
:EP  = Scale('E3 minorpentatonic')

!Play [
  4 -> :ED
  4 -> :EP
  1/2 -> :DP
  1/2 -> :EbP
  3 -> :EP
]

Bach.JSON

{
    "data": [
        [
            {
                "duration": 4,
                "notes": {
                    "atom": {
                        "init": {
                            "arguments": [
                                "E3 dorian"
                            ]
                        },
                        "keyword": "Scale"
                    }
                }
            },
            null
        ],
        [
            null,
            null
        ],
        [
            null,
            null
        ],
        [
            null,
            null
        ],
        [
            {
                "duration": 4,
                "notes": {
                    "atom": {
                        "init": {
                            "arguments": [
                                "E3 phrygian"
                            ]
                        },
                        "keyword": "Scale"
                    }
                }
            },
            null
        ],
        [
            null,
            null
        ],
        [
            null,
            null
        ],
        [
            null,
            null
        ],
        [
            {
                "duration": 0.5,
                "notes": {
                    "atom": {
                        "init": {
                            "arguments": [
                                "D3 minorpentatonic"
                            ]
                        },
                        "keyword": "Scale"
                    }
                }
            },
            {
                "duration": 0.5,
                "notes": {
                    "atom": {
                        "init": {
                            "arguments": [
                                "Eb3 minorpentatonic"
                            ]
                        },
                        "keyword": "Scale"
                    }
                }
            }
        ],
        [
            {
                "duration": 3,
                "notes": {
                    "atom": {
                        "init": {
                            "arguments": [
                                "E3 phrygian"
                            ]
                        },
                        "keyword": "Scale"
                    }
                }
            },
            null
        ],
        [
            null,
            null
        ],
        [
            null,
            null
        ]
    ],
    "headers": {
        "audio": "",
        "desc": "",
        "link": "",
        "lowest-beat": 0.5,
        "ms-per-beat": 2142.8572,
        "tags": [],
        "tempo": 56,
        "time": [
            4,
            4
        ],
        "title": "Cool Mellow SRV Style",
        "total-beats": 12
    }
}