Skip to content

Conversation

emuell
Copy link
Member

@emuell emuell commented Jun 13, 2025

  • renamed rust core structs and traits for clarity:

    • Pattern to Rhythm
    • Rhythm to Pattern
    • EventIter to Emitter
    • PulseIterItem to RhythmEvent
    • EventIterItem to EmitterEvent
  • cleaned up public Rust interfaces

  • updated crate docs accordingly

  • renamed Lua API properties and classes:

    • rhythm to pattern
    • pattern to pulse
    • emit to event
    • inputs to parameter
  • updated API guides and docs accordingly

fixes #61

Copy link

Benchmark for 542b41e

Click to view benchmark
Test Base PR %
Cycle/Generate 48.4±0.57µs 48.7±0.87µs +0.62%
Cycle/Parse 367.0±7.37µs 354.9±5.61µs -3.30%
Rust Phrase/Clone 445.1±6.35ns 432.0±5.40ns -2.94%
Rust Phrase/Create 73.1±1.25µs 72.2±0.68µs -1.23%
Rust Phrase/Run 630.3±5.54µs 637.1±5.57µs +1.08%
Rust Phrase/Seek 139.1±256.76µs 140.8±260.16µs +1.22%
Scripted Phrase/Clone 665.8±5.50ns 650.3±5.61ns -2.33%
Scripted Phrase/Create 956.4±7.29µs 940.5±14.94µs -1.66%
Scripted Phrase/Run 1663.3±9.50µs 1661.7±12.30µs -0.10%
Scripted Phrase/Seek 213.7±432.30µs 215.1±435.58µs +0.66%

@emuell
Copy link
Member Author

emuell commented Jun 13, 2025

This obviously is a huge change, nearly impossible to diff but I've been quite careful. Also took the chance to update and clear the crate docs a bit.

@unlessgames Implemented as discussed, except I've decided to use event instead of value in the Lua API for the emitter because:

  • value works but is super duper generic
  • event is how the thing is called in the Rust backend too
  • if we add helper modules similar to pulse also for gate and event, event is a better name than value

Such helper libraries could contain functions to create common event patterns (arp and stuff) and common gate impls later on similar to pulse:

return pattern {
  unit = "1/4".
  pulse = pulse.euclidean(3, 8),
  event = event.arp({"c4", "d#4", "g4"}, "up-down")
}

I'll read through the whole thing again and then merge it later today.

Unfortunately the changes can't be made backwards compatible because the old pattern lib definition would clash with the new pattern constructor function - there no such overload resolution in Lua. But I'll create a little script to update existing scripts to the new format to ease the transition. Actually better to get rid of all the old stuff now than never...

- renamed rust core structs and traits for clarity:
  - Pattern to Rhythm
  - Rhythm to Pattern
  - EventIter to Emitter
  - PulseIterItem to RhythmEvent
  - EventIterItem to EmitterEvent
- cleaned up public Rust interfaces
- updated crate docs accordingly

- renamed Lua API properties and classes:
  - rhythm to pattern
  - pattern to pulse
  - emit to event
  - inputs to parameter

- updated API guides and docs accordingly
@emuell emuell force-pushed the feature/new-component-names branch from 68724ef to 60df018 Compare June 13, 2025 18:44
Copy link

Benchmark for bb9ef2a

Click to view benchmark
Test Base PR %
Cycle/Generate 48.6±0.76µs 48.4±0.52µs -0.41%
Cycle/Parse 362.6±6.12µs 357.9±5.27µs -1.30%
Rust Phrase/Clone 439.8±19.09ns 442.4±3.84ns +0.59%
Rust Phrase/Create 72.5±1.30µs 72.6±0.96µs +0.14%
Rust Phrase/Run 639.9±1.97µs 630.1±11.14µs -1.53%
Rust Phrase/Seek 134.4±247.06µs 135.7±250.90µs +0.97%
Scripted Phrase/Clone 646.2±8.72ns 661.9±13.15ns +2.43%
Scripted Phrase/Create 946.1±10.04µs 949.9±20.23µs +0.40%
Scripted Phrase/Run 1661.6±8.54µs 1658.9±22.69µs -0.16%
Scripted Phrase/Seek 214.5±435.02µs 213.2±432.13µs -0.61%

@emuell emuell merged commit a51e345 into master Jun 13, 2025
2 checks passed
@emuell emuell deleted the feature/new-component-names branch June 13, 2025 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clearing up component names (rhythm vs phrase vs pattern)

1 participant