Repository navigation
Conversation
- Parse the 0x2028 tempo block under the unique 0x2718 container (flat
"Tempo" header + 61-byte records) and add 0x2028 to
FLAT_PTX_CONTENT_TYPES so incidental 0x5A bytes in timestamps no longer
form false sub-blocks.
- get_tempo_map() returns ordered {position_ticks, beats, bpm}; beat 0 is
the session start.
- beats_to_samples() / samples_to_beats() convert musical positions via the
session tempo map (no fixed 120 BPM).
- tests/test_tempo_map.py: constant tempo, automation, no-map and bad-header.
Refs sebedard-creator#6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6.
Adds read-only access to the session tempo map and musical-position conversion:
get_tempo_map()returns the ordered tempo changes —{position_ticks, beats, bpm}— read from the0x2028block under the unique0x2718container. A constant tempo yields one entry; tempo automation yields one entry per change (beat 0 = session start).beats_to_samples()/samples_to_beats()convert a musical position using the session's own tempo map (not a fixed 120 BPM).0x2028is added toFLAT_PTX_CONTENT_TYPES: its payload is a flat"Tempo"header plus 61-byte records, and scanning it for children produced false sub-blocks from incidental0x5Abytes in the record timestamps.Validation:
tests/test_tempo_map.py(constant tempo, ordered automation, session without a tempo container, unsupported header). Unknown geometry is refused, never guessed.693 tests,OK (skipped=145)(the skips are the usual absent native fixtures).Everything here is offered under the MIT license, which is compatible with this project's LGPL-2.1-or-later.