EnvelopForLive icon indicating copy to clipboard operation
EnvelopForLive copied to clipboard

Running EnvelopForLive inside of Max/MSP directly?

Open hems opened this issue 3 years ago • 7 comments

Hello,

I have seen a few examples of Max4Live devices running inside of Max MSP directly and i'm wondering if that would be possible ( and fir there are examples ) with Envelop4Live?

hems avatar Jul 28 '22 02:07 hems

You could certainly adapt the max 4 live devices to run in standalone max. The components should work fine standalone, however you will be missing some key things that Live provides:

  • the live audio flow, you'd need to wire up your own sound sources for inputs
  • the live routing architecture, which envelop devices use to route ambisonics audio to the master bus
  • the live device framework, saving settings, having multiple device instances on different tracks, etc.

You could create your own stand-ins for that. The "core guts" of the Envelop ambisonic panning implementation doesn't really depend on the live audio routing. But it will take a big of patching surgery to pull out the relevant bits. We don't really have any ready-to-use examples of this, unfortunately.

mcslee avatar Jul 28 '22 04:07 mcslee

Thanks for the insights!

  • the live routing architecture, which envelop devices use to route ambisonics audio to the master bus

This definitely seems like the most black magic part for me, I don't really know/understand how you can wire the audio between devices on Max4Live like if they are send~ and receive~ objects! i'm familiar with send and receive for data but for audio i have no idea how it works inside of Envelop!

Thanks a lot for your quick and awesome answer as usual!

hems avatar Aug 01 '22 03:08 hems

Yeah, the inter-channel wiring was definitely one of the trickier parts of E4L... it uses the fact that plugin devices can have more than just a single stereo out pair, as well as multiple inputs. The E4L panners actually have 8 stereo outputs, for a total of 16 channels which supports 3rd-order Ambisonics. There are routing settings for these additional outputs which can be set using Max code, e.g. so outputs 3/4 from an E4L panner go to inputs 3/4 of the E4L Master Bus.

It does get a bit hairy but it works. The routing assignment logic is here in these patchers if you're curious: https://github.com/EnvelopSound/EnvelopForLive/blob/master/patchers/bus/e4l.bus.send.maxpat https://github.com/EnvelopSound/EnvelopForLive/blob/master/patchers/live/e4l.live.routing.maxpat

You can see the multi-outs on the E4L panner devices, and the init routine that gets called to set them up to be "invisibly" routed to the E4L Master Bus. Screen Shot 2022-08-01 at 9 18 53 AM Screen Shot 2022-08-01 at 9 18 57 AM

Then on the E4L Master Bus side, there are multiple inputs and some more e4l.bus.receive initialization stuff... Screen Shot 2022-08-01 at 9 19 51 AM Screen Shot 2022-08-01 at 9 20 28 AM

In standalone Max you could just rip all of this fiddly stuff out and either use send~/receive~ or just simply connect the device patch cords directly. This routing stuff is all definitely a bit of a hack (or your more flattering term "black magic") around the fact that Live does not really support multi-channel audio - everything is stereo, so we construct the multi-channel flow ourselves by using extra sets of stereo pairs.

mcslee avatar Aug 01 '22 16:08 mcslee

In standalone Max you could just rip all of this fiddly stuff out and either use send~/receive~ or just simply connect the device patch cords directly. This routing stuff is all definitely a bit of a hack (or your more flattering term "black magic") around the fact that Live does not really support multi-channel audio - everything is stereo, so we construct the multi-channel flow ourselves by using extra sets of stereo pairs.

thanks a lot for taking your time to reply this!

I had a look at the source code and indeed the live api seems fairly "completicated" ( aka messy ) but indeed it works! very good work you did!

in the end of the day trying to run envelop4live inside creates it's own set of problems, still it is a valid experiment to learn more about envelop4live and ( ambisonics and live api as well! ).

I wonder if there would be any advantage of trying to use "spat~" over ICST or if in the future we would be able to have envelop4live support multiple libraries ( i.e. spat and icst )

hems avatar Aug 25 '22 05:08 hems

I wonder if there would be any advantage of trying to use "spat~" over ICST or if in the future we would be able to have envelop4live support multiple libraries ( i.e. spat and icst )

The spat tools are very well regarded, lots of powerful stuff in there. However, they are not under an open source license that is compatible with Envelop's GPL licensing. So we are not able to utilize or include those in this project for release. Definitely something you could experiment with independently though!

mcslee avatar Aug 25 '22 16:08 mcslee

I seem to be able to use E4L devices in native Max using mcs.amxd~ objects. The latter will produce 18-channel audio cords, the first two of which can be ignored (m4l stereo passthrough). It's not without some glitches/errors but it mostly works.

Screen Shot 2022-08-25 at 2 40 20 PM

ghost avatar Aug 25 '22 18:08 ghost

I seem to be able to use E4L devices in native Max using mcs.amxd~ objects. The latter will produce 18-channel audio cords, the first two of which can be ignored (m4l stereo passthrough). It's not without some glitches/errors but it mostly works.

that's definitely the right way to do it, very good catch! 🎱

i wonder if the "sync" function will also follow the transport on max when doing that..

i definitely need to give it a try

hems avatar Aug 28 '22 06:08 hems