Skip to content

Add rate and phase controls to PUnaryFunction#1

Open
discohead wants to merge 2 commits intomasterfrom
codex/develop-pattern-subclass-for-unary-function
Open

Add rate and phase controls to PUnaryFunction#1
discohead wants to merge 2 commits intomasterfrom
codex/develop-pattern-subclass-for-unary-function

Conversation

@discohead
Copy link
Owner

@discohead discohead commented Jun 8, 2025

This pull request introduces two new pattern classes, PUnaryFunction and PCallableUnaryFunction, to the isobar library. These classes allow users to sample unary functions across a range, with support for dynamic and callable parameters. The changes include updates to the documentation, the library's initialization file, the addition of the new classes, and corresponding tests.

New Features:

  • Addition of PUnaryFunction Class: Introduced a pattern class to sample unary functions across a range with configurable parameters such as start, stop, steps, rate, phase, mul, and offset. Parameters can be constants, patterns, or callables. (isobar/pattern/function.py, isobar/pattern/function.pyR1-R156)
  • Addition of PCallableUnaryFunction Class: Extended PUnaryFunction to enforce that all parameters are callables, enabling dynamic per-step control of function sampling. (isobar/pattern/function.py, isobar/pattern/function.pyR1-R156)

Documentation Updates:

  • Updated docs/patterns/library.md: Added entries for PUnaryFunction and PCallableUnaryFunction to the patterns library documentation. (docs/patterns/library.md, docs/patterns/library.mdR31-R32)

Codebase Integration:

  • Updated __init__.py: Imported the new function module into the isobar/pattern package to make the new classes accessible. (isobar/pattern/__init__.py, isobar/pattern/init.pyR14)

Testing:

  • Added Unit Tests: Comprehensive tests were added for both PUnaryFunction and PCallableUnaryFunction to validate functionality, including edge cases like callable parameter mixing and dynamic parameter updates. (tests/test_pattern_function.py, tests/test_pattern_function.pyR1-R68)## Summary
  • extend PUnaryFunction with rate and phase input modifiers
  • document these options in the pattern library
  • test input scaling and phase shift

https://chatgpt.com/codex/tasks/task_e_6845287334fc832490d705e6ef75b84b

@discohead discohead requested a review from Copilot June 11, 2025 23:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds rate and phase controls to the PUnaryFunction classes, extending their capabilities for input scaling and phase shifting while updating the pattern library documentation and tests.

  • Extend PUnaryFunction with rate and phase modifiers.
  • Introduce PCallableUnaryFunction to enforce callable parameters for dynamic control.
  • Update documentation and add tests to verify correct behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/test_pattern_function.py Added tests to verify new rate, phase, and callable-based functionality.
isobar/pattern/function.py Added support for rate and phase in PUnaryFunction and PCallableUnaryFunction.
isobar/pattern/init.py Updated module exports to include new functionality.
docs/patterns/library.md Documented the new PUnaryFunction and PCallableUnaryFunction options.
Comments suppressed due to low confidence (1)

isobar/pattern/function.py:62

  • Consider adding tests for the edge case where steps is less than or equal to 1 to ensure that the behavior for a single sample is as expected.
if steps <= 1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants