Accessing a buffer from node.script


    Dec 25 2018 | 11:16 pm
    I am trying to create a more comprehensive buffer visualisation with node.script and https://github.com/bbc/waveform-data.js npm package.
    Looking at the docs for node.js there is a method for accessing buffers with getDict(dictId), but the example that is provided throws errors, particularly with the async 'await' function that is provided.
    Can anyone who has figured it out already provide a method for accessing a dict through node.js? The idea is that I can then draw the visualisation from the dict information.

    • Jan 11 2019 | 11:53 am
      Hi James, did you find a solution? I can't find my way around getdict as well. Thanks !
    • Jan 11 2019 | 1:41 pm
      Hey James.
      per-se node.script does not offer a build in way to access the content of a Buffer. Accessing a buffer is a feature of the [js] object. However, as shown in the snippet you definitely can access Dictionaries from within a [node.script] .
      Maybe you mixed up the two concepts/objects?
      Node For Max offers a way to spawn and interact with Node.JS processes from within your Max Patch while offering a small API to communicate between Max and NodeJS. In contrast the [js] object offers a scripting environment directly embedded within Max. If you use the following as a starting point you can find information on how to use Buffers and other things from within [js]: https://docs.cycling74.com/max7/vignettes/javascriptinmax
      If you have specific questions and/or need help with node.script and its API feel free to share your patches or code and I'm sure me or others are able to assist.
      Florian