Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable MIDI delay/latency #2159

Open
unclewayback opened this issue Dec 11, 2023 · 6 comments
Open

Option to disable MIDI delay/latency #2159

unclewayback opened this issue Dec 11, 2023 · 6 comments
Labels
feature suggestion for an enhancement subject:core things concerning the Pd-core

Comments

@unclewayback
Copy link

At the moment control data is artificially delayed to match the audio buffer, which is presumably useful for keeping them in sync. However there may be times, such as if one is developing a pure midi or an open sound control implementation, in which it is desirable to keep latency to an absolute minimum, and where we would prefer this delay not to be imposed.

Would it be possible to enable/disable this delay on a per-case basis?

It would be fantastic if it were possible to disable the artificial latency not just globally but on a per-object basis (perhaps adding an option to something like [switch~]?)

@Spacechild1 Spacechild1 added feature suggestion for an enhancement subject:core things concerning the Pd-core labels Dec 11, 2023
@Spacechild1
Copy link
Contributor

such as if one is developing a pure midi or an open sound control implementation

In this case, you just need to set the "Delay" to 0. This wouldn't be necessary with my scheduler-fix branch, as it contains a fix where MIDI is only delayed if DSP is on (21a5080).

However, there are situations where you want to do DSP and still send MIDI messages as quick as possible.

but on a per-object basis (perhaps adding an option to something like [switch~]?)

I have the feeling this should rather be a method or flag for the various MIDI output objects ([noteout], [ctlout], [midiout], etc.)

@unclewayback
Copy link
Author

Thanks for adding the label and the additional info.

there are situations where you want to do DSP and still send MIDI messages as quick as possible.

Indeed, I'm doing something at the moment where I want to interact with pd patches, some of which are audio, while also sending plenty of midi messages as quickly as possible to set LEDs on a controller (the Linnstrument). I'm sure it is a common enough application.

A flag for the midi objects could work, it is just I am not clear if the latency applies to all control data? Then we would also want to switch off latency for things like netsend, for sending OSC data for example - so perhaps encapsulating the patch and setting the status of it, as can be done with blocksize et al., would be a better solution in this case (applying as well to any midi objects instantiated within it).

@Spacechild1
Copy link
Contributor

it is just I am not clear if the latency applies to all control data?

The latency only applies to outgoing MIDI messages. The relevant code is in sys_pollmidioutqueue and sys_setmiditimediff.

@unclewayback
Copy link
Author

Setting a minimal delay (only lets me go down to 2 ms) causes GUI slowdown even without DSP switched on, which seems strange. I will try running my MIDI headless in a separate instance but definitely would be nice to have some integrated options here!

@Spacechild1
Copy link
Contributor

Setting a minimal delay (only lets me go down to 2 ms) causes GUI slowdown even without DSP switched on, which seems strange.

That is very strange indeed. Apart from the (accidental) MIDI delay, the "Delay" setting should not have any effect when DSP is off...

@unclewayback
Copy link
Author

unclewayback commented Dec 18, 2023

the "Delay" setting should not have any effect when DSP is off...

Thanks that's good to know I will investigate further. I built it myself as using pdnext, and maybe I messed something up or there is some other issue with my system. My first year with Linux! Apologies for going a bit off topic.

@pure-data pure-data deleted a comment from porres Dec 18, 2023
@pure-data pure-data deleted a comment from porres Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature suggestion for an enhancement subject:core things concerning the Pd-core
Projects
None yet
Development

No branches or pull requests

2 participants