surge-synthesizer / surge

Synthesizer plug-in (previously released as Vember Audio Surge)
https://surge-synthesizer.github.io/
GNU General Public License v3.0
3.01k stars 385 forks source link

Should OSC messages be sent when MIDI input is received? #7592

Closed botoxparty closed 3 months ago

botoxparty commented 3 months ago

Hey,

I've observed that OSC messages are only output if the controls are changed with the UI. When receiving MIDI input, the updates don't appear to be sent over OSC.

Is that the expected behaviour?

In my use case it would even be cool if it also outputted incoming OSC messages.

e.g. Controller 1 sends OSC message to Surge XT. Surge XT sends an update to Controller 2 that the parameter was changed.

baconpaul commented 3 months ago

Well since you didn’t expect it it’s clearly not expected! But we definitely didn’t think of this case

so you set up a midi learn control basically and want that to send an osc message? That means the midi automation path needs to fire the parameter listener on the right thread. Doable but just want to make sure that’s the case you are in

also tagging @pkstone who has written most of the osc code.

the code is around here Phil https://github.com/surge-synthesizer/surge/blob/2834ca4c4fb270b1987bc0de1c47b9c0830563e6/src/common/SurgeSynthesizer.cpp#L2337

botoxparty commented 3 months ago

Yeah for claritication..

If the Pitch in OSC1 of Scene A has a MIDI CC assigned to it, when it received changes then it should output them to "/param/a/osc/1/pitch"

The way i'm working around it right now is that Controller 1 will update both Surge XT and Controller 2, however it would be more correct if Controller 1 updated Surge and Surge was the single source of truth and would update any other listeners.

On Fri, Mar 29, 2024 at 11:52 PM Paul @.***> wrote:

Well since you didn’t expect it it’s clearly not expected! But we definitely didn’t think of this case

so you set up a midi learn control basically and want that to send an osc message? That means the midi automation path needs to fire the parameter listener on the right thread. Doable but just want to make sure that’s the case you are in

also tagging @pkstone https://github.com/pkstone who has written most of the osc code.

the code is around here Phil https://github.com/surge-synthesizer/surge/blob/2834ca4c4fb270b1987bc0de1c47b9c0830563e6/src/common/SurgeSynthesizer.cpp#L2337

— Reply to this email directly, view it on GitHub https://github.com/surge-synthesizer/surge/issues/7592#issuecomment-2027803074, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3Q7ZDWJI7TBYX4XA6ABSLY2XWBJAVCNFSM6AAAAABFPAARIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXHAYDGMBXGQ . You are receiving this because you authored the thread.Message ID: @.***>

pkstone commented 3 months ago

I think I get what you're asking for, but I can't promise anything on it for the near future. I would like to make the 'echoing' part of OSC (i.e., outputting Surge state changes to OSC) more consistent and comprehensive, but it's a big job. Things are a bit all over the place right now. For instance, modulation mapping changes always echo, even when changed by incoming OSC messages (this is a side-effect of using an already existing mod-mapping change listener). Nothing else does that though, yet.

pkstone commented 3 months ago

There also starts to arise an issue of how much data pouring out of OSC is acceptable for a given user-case. Do we have to start adding on/off options for types of OSC output so a (perhaps slow) client on the other end of the pipe is not overwhelmed?

mkruselj commented 3 months ago

My thinking here is: how does host automation behave when receiving MIDI to set MIDI learned parameters? OSC should behave the same.

pkstone commented 3 months ago

@botoxparty I'm not meaning to be discouraging here, this is a good ask, and is something I really want to improve in the future. But it may be a while! :-)

pkstone commented 3 months ago

I've taken a shot at this, but have run into some basic architectural problems; 'learned' MIDI is processed in SurgeSynthesizer, which cannot directly echo data to OSC out (OSC out processing is managed mostly in SurgeSynthProcessor, which is not visible to SurgeSynthesizer).

botoxparty commented 3 months ago

@pkstone totally understandable. My workaround right now is to basically have setup an OSC router that receives all the messages and forwards them. It’s my source of truth for now.

not the best design but it works 👍

pkstone commented 3 months ago

I'm not giving up yet; when @baconpaul gets back from vacation, we'll see if we can't figure something out.