elemaudio / elementary

Elementary is a JavaScript library for digital audio signal processing.
https://www.elementary.audio/
MIT License
331 stars 29 forks source link

cli instructions not working, macos #10

Closed baconpaul closed 1 year ago

baconpaul commented 1 year ago

Hi

I tried to follow https://github.com/elemaudio/elementary/blob/main/cli/README.md on my mac

first I think cd examples/ should be cd cli/examples/

but then when I run the npm run build I get

paul ~/dev/music/third_party/elementary/cli/examples (main) % npm run build                

> build
> esbuild *.js --bundle --outdir=dist

✘ [ERROR] No matching export in "node_modules/@elemaudio/core/dist/index.js" for import "Renderer"

    00_HelloSine.js:1:8:
      1 │ import {Renderer, el} from '@elemaudio/core';
        ╵         ~~~~~~~~

✘ [ERROR] No matching export in "node_modules/@elemaudio/core/dist/index.js" for import "Renderer"

    01_FMArp.js:1:8:
      1 │ import {Renderer, el} from '@elemaudio/core';
        ╵         ~~~~~~~~

✘ [ERROR] No matching export in "node_modules/@elemaudio/core/dist/index.js" for import "Renderer"

    02_StrangerThings.js:1:8:
      1 │ import {Renderer, el} from '@elemaudio/core';
        ╵         ~~~~~~~~

3 errors

I'm on macOS with standard pre-ventura setup

Thoughts?

nick-thompson commented 1 year ago

Ah, shoot, thanks for reporting! I need to make sure the @elemaudio/core dependency is locked to v2.0+, will get that fixed shortly

baconpaul commented 1 year ago

Cool

Like I mentioned on discord, the other thing about the documentation is when you say to run './elemcli' and you actually mean '../../build/cli/elemcli' or some such.

but got it working with that npm addition you shared. fun.

baconpaul commented 1 year ago

While you are in there

https://www.elementary.audio/docs/guides/Custom_Native_Nodes

class ConstNode : public elem::GraphNode<float> {
public:
    using elem::GraphNode<float>::GraphNode;

    void setProperty(std::string const& key, elem::js::Value const& val) override
    {
        if (key == "value") {
            value.store((elem::js::Number) val);
        }
    }

    void process (elem::BlockContext<FloatType> const& ctx) override
    {
        std::fill_n(ctx.outputData, ctx.numSamples, value.load())
    }

    std::atomic<float> value { 0 };
};

that BlockContext<FloatType> should either be <float> or <something-scoped::FloatType> and I don't know what something-scoped is :)

nick-thompson commented 1 year ago

Ok fixed on develop! I'm going to look at your PR now, then hopefully a quick bugfix before pulling all of this into the main branch with v2.0.1. Thanks again