Skip to content
This repository was archived by the owner on Aug 11, 2026. It is now read-only.

Commit a3e0b44

Browse files
authored
Implement musical time conversion functionality (#25)
* spec: add comprehensive musical time conversion specification - Define getMusicalTime() interface for converting real time to musical time - Support arbitrary hierarchical depth with clear level naming - Add optional referenceLevel parameter for fractional calculation at any hierarchy level - Use pulse-based fractional calculation to handle rubato and irregular timing - Include comprehensive test cases and edge case handling - Designed for identical implementation across Python and TypeScript * feat: implement musical time conversion functionality - Add MusicalTime dataclass with cycle, hierarchical position, and fractional beat - Add Meter.get_musical_time() method with optional reference level support - Support arbitrary hierarchical depth (beat, subdivision, sub-subdivision, etc.) - Use pulse-based fractional calculation to handle rubato and irregular timing - Add comprehensive test suite with 18 test cases covering all functionality - Update package exports for MusicalTime class - Implement specification from docs/musical-time-spec.md Features: - Convert real time to musical position within meter boundaries - Reference levels allow fractional calculation at any hierarchy level - Handles complex meters like [3, 2, 4] with proper level naming - Returns False for out-of-bounds times, MusicalTime for valid times - String representations: compact (C0:2.1+0.500) and readable formats * fix: remove duplicate Claude workflow to prevent multiple PR comments - Removed claude.yml which was triggering alongside claude-code-review.yml - Now only claude-code-review.yml handles @claude review comments - This prevents duplicate comments on PR reviews * fix: address Copilot review comment on array handling - Fixed _calculate_level_start_time to properly handle truncated positions array - Now correctly extends with zeros rather than potentially accessing out of bounds indices - All tests still pass * test: add comprehensive edge case tests for musical time conversion - Added test for multi-level hierarchy overflow scenarios - Added test for truncated positions array handling with reference levels - Added test for recursive overflow at reference level boundaries - Added test for complex list-based hierarchy overflow - These tests specifically cover the edge cases Copilot's review identified - All 22 tests pass, increasing confidence in robustness
1 parent c249ebe commit a3e0b44

7 files changed

Lines changed: 1411 additions & 65 deletions

File tree

.github/workflows/claude.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)