Skip to content

set bpm from encoder via ws#216

Open
jpremill wants to merge 4 commits into
TreeFallSound:feat/transport-bindingsfrom
jpremill:feat/set-bpm-from-encoder-via-ws
Open

set bpm from encoder via ws#216
jpremill wants to merge 4 commits into
TreeFallSound:feat/transport-bindingsfrom
jpremill:feat/set-bpm-from-encoder-via-ws

Conversation

@jpremill

Copy link
Copy Markdown

based on feedback to address #215 based on #213 conversation. I tried to keep it more atomic than I am used to;
I have only verified via the the tests on these and have not tested on. physical the device yet.

…pass MIDI CC emission for bound transport parameters
@jpremill
jpremill marked this pull request as draft July 22, 2026 03:09
@jpremill
jpremill marked this pull request as ready for review July 22, 2026 03:11
Comment thread modalapi/modhandler.py Outdated
Comment thread modalapi/modhandler.py Outdated
Comment thread modalapi/pedalboard.py Outdated

@rreichenbach rreichenbach left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since this is more his domain, I'll defer to Cam on the code, but I did test this on hardware and it works just as I would expect. The control maps fine, and changing the setting tracks whether from Encoder, Footswitch or MOD-UI.

@sastraxi
sastraxi changed the base branch from prerelease to feat/transport-bindings July 24, 2026 03:36
Comment thread modalapi/modhandler.py Outdated
# Emission is hardware-level, below the table (see input/README.md).
self._emit_midi(c, emit_value)
# Transport parameters bypass 7-bit MIDI CC emission for high-precision WebSocket transport.
if c.parameter is None or c.parameter.instance_id != Pedalboard.TRANSPORT_INSTANCE_ID:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to still send MIDI for beats-per-bar and rolling; this should look at the symol

Comment thread modalapi/modhandler.py Outdated
return

if not self._is_pedalboard_loading:
if not self._is_pedalboard_loading and param.instance_id is not None and param.instance_id != Pedalboard.TRANSPORT_INSTANCE_ID:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same as above (branch on symbol not instance ID)

Comment thread modalapi/modhandler.py
# Audio parameter (volume, EQ, etc.) - handled locally, no remote update needed
if param.instance_id is None:
self.audio_parameter_commit(param.symbol, value)
return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need this early return otherwise the audio parameters will emit CCs below.

Comment thread modalapi/modhandler.py Outdated
def set_mod_tap_tempo(self, bpm):
def set_mod_tap_tempo(self, bpm: float | None) -> None:
if bpm is not None:
self._last_bpm_change_time = time.time()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think maybe left over from an earlier design?

Comment thread modalapi/modhandler.py Outdated
Comment on lines +1822 to +1823
if self.ws_bridge is not None:
self.ws_bridge.send_bpm(bpm)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we have to send this over WS? Was the REST laggy? Regardless we need to put _rest_post in the else clause to avoid a double-send. But I'd prefer to just do it one way or the other.

Comment on lines +477 to +479
def test_encoder_bpm_turn_without_websocket_bridge_falls_back_to_rest_post(
v3_system: SystemFixture, make_plugin
):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This test could be deleted once we decide REST vs WS

@sastraxi sastraxi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is close! A couple real bugs here worth taking a look at.

It would be helpful if you could test on device. Personally, I like to use ./deploy.sh to just copy local files over to test, but you might prefer @rreichenbach 's approach which is to edit files directly on the device. There's a helper you can use to turn the deployed source code back into a git repository if it helps:

https://sastraxi.github.io/pistomp-manual/developers/getting-started/#dev-mode-git-managed-source-on-the-device

…MIDI CC bypass, audio param early return, and test enhancements)
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.

4 participants