scribbletune / scribbleformax

MaxForLive devices built with Scribbletune
18 stars 6 forks source link

discrepancies after running: npx webpack #14

Open case303 opened 3 years ago

case303 commented 3 years ago

Hi walmik, I'm trying to get scribbleformax running on my Mac. Whenever I attempt to load any locally transpiled files, Max crashes.

I've got a private branch of your latest build. After running npx webpack, looking at chords.js, there are discrepancies in the /dist file. I must have something configured incorrectly.

Any insight is greatly appreciated!

walmik commented 3 years ago

Hi @case303 Thank you for creating this issue. I m aware of this issue as myself and @JanZaion have also been going over it for some days now.

tldr;

Just a bit of an explanation on what s going on:

We have recently moved to using maxApi. This allows us some freedom in terms of using ES6 syntax, the dict object and node modules in general but it cannot write clips. For that we continue to use the max JS object (which is an older version of ES5) but has access to the LOM (Live Object Model) needed for writing clips. While there is still some uncertainty around what should be the way forward, we can use a combination of both where one part of the script can use maxApi and then "hand over" control to the script executed by the JS object (which is what Riff.amxd is currently doing).

The maxApi node module is just a dummy module for synctactic sugar. There isnt any module that actually gets downloaded hence it cannot be part of the webpack transpilation config. The current src/api.js will soon be removed and some folder structure might be changed if we remove the transpilation step completely because src and dist wont make any sense as all the JS will be just source that max can execute without transpilation. Lastly a couple of methods from dist/api.js and dist/riff.js will make it the main Scribbletune library so that there is overall less code to be written within the scribbleformax repo (this repo).

Hope that makes sense! Please dont hesitate to ask any further questions and let me know how it goes with getting scribbleformax works locally for you!

walmik commented 3 years ago

@JanZaion I tried freezing the device to test it s use on another machine. But unfortunately there it didnt work and when I opened it up for editing, I could see the error message that node.script has not been started.

I remember you had mentioned something around publishing the device such that node.script is started and npm install also happens automatically. Could you please remind me what that was or point me to a link? I want to be able to publish the new version to maxforlive such that folks can use the updated version of Riff with our new approach using maxApi!

case303 commented 3 years ago

Thanks @walmik for the explanation. I did notice, and had success experimenting directly in /dist. Interesting to learn what's going on. I've been following your challenges with ES5, and was excited to learn how scribbleformax was writing its clips. I'll keep my eyes peeled and have a deeper dive into the Riff to see how you guys are taking advantage of both worlds.

JanZaion commented 3 years ago

Hi @walmik and @case303 ,

unfortunetely when using node.script object, you cant simply freeze the device as you would with "vanilla" M4L patch. Here is the link I think you're asking for. There are some downsides to this however, I went over them in the last comment in this PR.

In summary, there are 2 ways to produce the final device: 1) Bundle it with Max (a different thing than M4L, its superconfusing actually, see the link above) 2) Making the end user (a music producer) download a folder with some stuff instead of just the .amxd file and providing installation instruction. The folder would contain package.json and the .amxd device withing this folder would have a button that would be clicked during a first time use in order to execute npm script install cmd and do as instructed by the package.json. This might be a PR of its own actually. I think that a non-technical user should be able to follow these instructions, since it doesen't require node and npm installed (it's using those in Max). But this option will never be as sleek and simple as option 1.

My 2 cents, hope it helps!

walmik commented 3 years ago

@JanZaion Thank you for the detailed response! I ll go over the link you shared. I think we must provide a clean way for producers to drop in the device and start using right away. I ll try the bundling approach you recommended.

walmik commented 3 years ago

@case303 I m re-opening this issue as it continues to exist in terms of what you ve pointed out in the description. Will close it once we resolve it.