Skip to content

[Bug] getNonEDOFrequency throws ReferenceError in browsers #8276

Description

@macayu17

Description

On current master, getNonEDOFrequency() throws in a browser because it references Node’s global object. Browser scripts do not provide global, so the helper fails instead of returning a preview frequency.

Relevant source:
https://github.com/sugarlabs/musicblocks/blob/master/js/utils/musicutils.js#L3966

Expected Behavior

getNonEDOFrequency() should return the preview frequency in a browser without referencing Node’s global object.

Screenshots

Not attached. A DevTools console screenshot showing the error below can be added after reproducing locally.

How to Reproduce

  1. Clone the repository and serve the current master locally.
  2. Open it in Chrome.
  3. Load utils/musicutils through RequireJS.
  4. Call:
     getNonEDOFrequency(0, 4, "just intonation", "C major")

Console log Errors:

Uncaught ReferenceError: global is not defined
at getNonEDOFrequency (js/utils/musicutils.js:3967:15)

Environment:

  • Operating System: Windows 11
  • Browser: Chrome 151.0.7922.174
  • Version of Software/Project: master (10fc68d)

Checklist

  • I have read and followed the project's code of conduct.
  • I have searched for similar issues before creating this one.
  • I have provided all the necessary information to understand and reproduce the issue.
  • I am willing to contribute to the resolution of this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugFixes a bug or incorrect behavior

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions