Building a channel strip. (With data driven Graph definition)

Questions and discussion about building and using Max for Live devices
Post Reply
charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Sun Apr 26, 2020 10:09 am

Hi,

This max stuff really gets deep for me now :)

Before i wanna dig into this approach maybe someone could review my concept please?..

i built some kind of channel strip with lots of nodes and edges in between.

Every node consists of a patcher which instanciates a vst~ object.

I duplicated this patcher several times and built the graph straight forward by connecting the nodes using max audio chords. (the edges between the nodes)

But the device became very big like this and max gets horribly unstable the more features i add. (In the morning i collected 10 crash reports in one hour, saving the patch takes about 2 mins by a patcher size of 10 MB)

This is why i wanna rethink the concept of duplicating patchers and connecting the stuff "hard coded" using patch cables.

I'm thinking of using maybe a poly~ object to instanciate the patcher n times.

There should be some sort of stream object, some mechnisms like send or forward object just for audio streams instead of control messages. I know the j74 plugins which connects several max devices using named video streams. I wanna use this stream to let the poly~ instances send audio streams between each other. Building the channel strip graph would then be data driven and can be modified using data. (maybe using a matrix ctrl...)

Do you think this can work?

Anybody here who has done something similar?

IS the poly~ object the right choice for someething like that?

Do you know the max object which allows sending and receiving audio streams without patch cable to a variable destination?

At some point i could/should think of latency compensation. I see the vst object in max7 provides the info of plugin lateny. But Is there an object to handle this or do i have to calculate the stuff on my own and dealing with buffer objects?

. Implementing the detector for feedback loops in the graph definition should be quite complicated in max... I wonder how live would react... Any experience? (In the live mixer they avoid feedbacks when using Resample-Audio input. I wonder wether this would work in max...)

Thanks for your thoughts on that issue and thanks a lot for your help till now!

ecuk
Posts: 91
Joined: Fri Jun 03, 2016 7:49 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by ecuk » Sun Apr 26, 2020 2:17 pm

Welcome to the endless joys and wonders of Max programming! Trust me, with time this ‘Max stuff’ will almost certainly become still deeper. For me the real fun began when I discovered the Max SDK and began to create my own objects instead of only to rely on the 800 or so which come with Max.

Anyway, I know that this isn’t really an answer to your question, but I only have a few minutes and wanted at least to mention it (again)…

For questions such as yours, which are really more about Max (the full language) than they are about Max for Live or the LOM (Live Object Model) in particular, you are likely to find more expertise, answers and insights in the Cycling ’74 forums: https://cycling74.com/forums.
MacBook Pro, macOS Catalina 10.15.6, 2.3GHz i7-1068NG7, 32GB – Live Suite 10.1.18, Max 8.1.5, Push 2, Zoom H6, ATH-M50x

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Mon Apr 27, 2020 8:05 am

ah ok. i see. the cycling forum of course is more native to max. thanks for the tip.

Also the tip with building own max objects is legit. I nearly canceled the idea of implementing the feedback loop detection in max. (Though it's challenging ;) ) Instead i'd try to write it in java script or - which is of course faster - in c++.

ecuk
Posts: 91
Joined: Fri Jun 03, 2016 7:49 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by ecuk » Mon Apr 27, 2020 3:43 pm

I am not quite sure why, if as you say you are connecting your nodes using Max audio cables, you would be worried about feedback loops in your graph. Max (or rather MSP) should do the right thing with your object graph without you having, in essence, to manually rewrite its underlying runtime library.

Because it sounds like you have more than a clue about programming, you might want to read the papers by Miller Puckette from way back when Max was a research project (before David Zicarelli developed it into a commercial product). The best are the two papers from the Computer Music Journal in 1991, which amongst many other things describe how the audio call graph is derived from a patch. These two as well as many other papers and publications about the internals of Max (and Pure Data) are available on Miller Puckette’s website: http://msp.ucsd.edu/publications.html.

His still earlier 1988 paper about ‘The Patcher’, for example, is a classic if you want to understand Max’s semantics, which are basically those of a bog standard message-passing object-oriented language which happens to have a visual front-end instead of a more traditional text-based one. In particular, it is not a data-flow language as many seem to believe because of its appearance. It is in fact a programming language much like Smalltalk or Self or JavaScript or pretty much any other object-oriented language. It just looks different because it was designed for the specific domain of real-time audio processing. There are even some fairly good reflection capabilities through the implicit Patcher object (think ‘this’ or ‘self’ for the entire patch).

And for what it’s worth, I myself prefer to write Max externals in C. As far as I know the C++ SDK is still considered experimental and a work in progress. The C API is likely to remain the primary and lower-level one for some while to come. And of course, as with any other real programming language, the standard library, in this case the 800 or so objects which are available built-in, cover the bulk of what one might want to do without having to reinvent the wheel.
MacBook Pro, macOS Catalina 10.15.6, 2.3GHz i7-1068NG7, 32GB – Live Suite 10.1.18, Max 8.1.5, Push 2, Zoom H6, ATH-M50x

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Mon Apr 27, 2020 4:03 pm

ecuk wrote:
Mon Apr 27, 2020 3:43 pm
I am not quite sure why, if as you say you are connecting your nodes using Max audio cables, you would be worried about feedback loops in your graph. Max (or rather MSP) should do the right thing with your object graph without you having, in essence, to manually rewrite its underlying runtime library.
Regarding this: I now have connected everything hard coded. But i wanna investigate in a different approach and do it dynamically. When i do this i need to think what happens if there are feedback loops in the graph definition.

Thanks for the papers i will have a look.

Reinventing the wheel: If a max object exists that can detect feedback loops in the graph definition i'd use this. But i think there does not exist an object because it is a quite specialized approach.

I wrote some live patchers to manipulate lists. (Because i found nothing to do so and i need methods like insert, remove, push, pop, getlast, setlast etc. I need this to manage the recursion stack for the Feedbackloop detector). But implementing this in max should perform bad, compared to an impleentation in c or c++...

I think max is good for using objects and patching them but when it comes to complex logic, conditioned execution and loops or even recursions, things get very quickly extensive and unclear. A procedural programming language is more convenient for that i guess. I did a lot such stuff in max, but more to learn it than to have a proper result. It also takes much more time for developing in max....

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Mon Apr 27, 2020 4:25 pm

ecuk wrote:
Mon Apr 27, 2020 3:43 pm
rewrite its underlying runtime library
Since i deal with dynamic signal chains and vst~ plugins i have to deal with lots of stuff ableton allready dealed with in live/msp.

Imagine i would write a modular synthesizer in max. That comes close to what i plan to do.

As i allready said it has a big academic approach for me....

ecuk
Posts: 91
Joined: Fri Jun 03, 2016 7:49 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by ecuk » Mon Apr 27, 2020 7:43 pm

I’ve got to admit that what you are doing sounds both fun and challenging. And I very much agree with your assessment of there being times when you just want a good ol’ procedural language for loops and conditionals and the like. These things are a bother in Max, and in such cases I often find myself reaching for a js object or, for signal rate things, Gen.

As for lists, have you looked at the Lisp-like linked lists available in the Bach package in the Max package manager? These will do many of the things that you are describing such as pushing, popping and the like. And because the Bach objects are coded as Max externals, presumably in C, they are about as fast as you are going to get. That said, it sounds like you might already have implemented something which suits your needs just as well if not better.

Perhaps you will eventually have your stuff stable enough to submit it as, say, a package to Cycling ’74 so that everyone else, including me, can partake of it and enjoy what you have developed. I mean that seriously. One of the things which I like most about Max is its community, which emerged out of Max’s origins in academic research and the corresponding spirit of sharing one’s work so that others can build upon it.

Even though Max feels at times a bother to doing certain kinds of things, as a platform for playing with audio (and increasingly video) processing it is rather cool. Not perfect, but still rather cool.
MacBook Pro, macOS Catalina 10.15.6, 2.3GHz i7-1068NG7, 32GB – Live Suite 10.1.18, Max 8.1.5, Push 2, Zoom H6, ATH-M50x

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Wed Apr 29, 2020 5:04 am

Ok, it took some takes and 2 nights of coding but finally at least the first testcases for the feedback detection run.... still some bug in it with the stack managment...

I could not forbear myself to do it in native max and it performs better than i thought.... but i guess if it would do it in my native programming language it would perform much better and take a few hours less to solve this. I did some graph analysis stuff with orm diagramms but in max it's really evil :D

At least i got familar with the max debugger, setting breakpoints etc.

I'm not sure when i will continue with this since i have other tasks to do within next time. But when i come back to max i will say hello in the cycling forum.

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Wed Apr 29, 2020 5:06 am

(duplicate)

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: Building a channel strip. (With data driven Graph definition)

Post by charlybeck » Wed Apr 29, 2020 7:02 pm

Ok i headed over to the cycling forum. (I decided to make another turnaround on this issue ;) )

Here's latest topic:
https://cycling74.com/forums/stackoverf ... opdetector

Post Reply