Git Product home page Git Product logo

Comments (7)

lonce avatar lonce commented on July 19, 2024

I've updated the resonance-audio source to ea6 style module loading, and the build looks good. However, I am still struggling to get Omnitone (required in Listener.js) to load properly from the build.

from resonance-audio-web-sdk.

drewbitllama avatar drewbitllama commented on July 19, 2024

from resonance-audio-web-sdk.

lonce avatar lonce commented on July 19, 2024

Hi Drew,

I do believe I've got it working now, but had to make a couple of minor changes in the code to do so.

First, of course, i made the changes necessary for es6 module loading in all the resonance-audio-web-sdk/src files, such as:
// const Utils = require('./utils.js');
import Utils from './utils.js'

I then turned to importing Omnitone in the one necessary place, listener.js :
// Omnitone = require('../node_modules/omnitone/build/omnitone.js');
import Omnitone from '../node_modules/omnitone/build/omnitone.esm.js'

However, the reference (later in listener.js) to
Omnitone.Omnitone.createFOARenderer(context, {});
was creating a problem. Since I couldn't figure out how to construct an import statement that would create this nested structure and work as expected, I just changed the nested reference (in the two places it occurs) to:
Omnitone.createFOARenderer(context, {})
That solved the issue!

One remaining bug popped up. The reference in utils.js to
exports.EPSILON_FLOAT
bombed since 'exports' is no longer defined. Changing it to what it probably should have been in the first place:
Utils.EPSILON_FLOAT
solved that issue.

Now I am getting a build of resonance-audio.js that seems to be working fine with ES6 importing!

Thanks again for this cool library,
- lonce

from resonance-audio-web-sdk.

drewbitllama avatar drewbitllama commented on July 19, 2024

from resonance-audio-web-sdk.

hoch avatar hoch commented on July 19, 2024

FWIW, Omnitone recently updated (v1.3) and now it supports ES6 module. Perhaps we should use that in Resonance as well?

from resonance-audio-web-sdk.

iooops avatar iooops commented on July 19, 2024

Same issue here.

Even though I built from the original source code, it caused problem.

The following is the output from running npm run test:

  Listener
    ✖ "before each" hook for "Verify module constructor."
      Chrome 72.0.3626 (Mac OS X 10.14.3)
    TypeError: Cannot read property 'createFOARenderer' of undefined
        at new Listener (build/resonance-audio.js:933:40)
        at Context.<anonymous> (test/test-listener.js:33:16)

  ResonanceAudio
    ✖ "before each" hook for "Verify module constructor."
      Chrome 72.0.3626 (Mac OS X 10.14.3)
    TypeError: Cannot read property 'createFOARenderer' of undefined
        at new Listener (build/resonance-audio.js:933:40)
        at new ResonanceAudio (build/resonance-audio.js:3859:20)
        at Context.<anonymous> (test/test-resonance-audio.js:33:13)

  Source
    ✖ "before each" hook for "Ensure module produces output."
      Chrome 72.0.3626 (Mac OS X 10.14.3)
    TypeError: Cannot read property 'createFOARenderer' of undefined
        at new Listener (build/resonance-audio.js:933:40)
        at new ResonanceAudio (build/resonance-audio.js:3859:20)
        at Context.<anonymous> (test/test-source.js:36:13)

`const Omnitone = require('../node_modules/omnitone/build/omnitone.js');`
  if (this._ambisonicOrder == 1) {
    this._renderer = Omnitone.Omnitone.createFOARenderer(context, {});
  } else if (this._ambisonicOrder > 1) {
    this._renderer = Omnitone.Omnitone.createHOARenderer(context, {
      ambisonicOrder: this._ambisonicOrder,
    });
  }

I think these are the lines of code that caused the problem.

I tried replacing it with newer version of omnitone, but still it cannot pass the test.

from resonance-audio-web-sdk.

shariq-audiofocus avatar shariq-audiofocus commented on July 19, 2024

@iooops / anyone else running into this issue - You can fix it minimally by making these two changes:

  1. In src/listener.js. Replace
    Omnitone.Omnitone.createFOARenderer with Omnitone.createFOARenderer
    Omnitone.Omnitone.createHOARenderer with Omnitone.createHOARenderer

  2. In 'node_modules/omnitone/build/omnitone.js'. Add:
    module.exports = Omnitone; to very bottom part of the file.

then npm test should run successfully

from resonance-audio-web-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.