Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: frequenceis.forEach is not a function" #58

Open
abetusk opened this issue Nov 30, 2020 · 4 comments
Open

"TypeError: frequenceis.forEach is not a function" #58

abetusk opened this issue Nov 30, 2020 · 4 comments
Assignees
Labels

Comments

@abetusk
Copy link

abetusk commented Nov 30, 2020

My apologies if this is not the appropriate forum for this type of error or if the 'alpha' gibber portion is considered in active development and bug reporting is not desired.

While playing in the 'alpha' playground, I was trying to get "chords" to work. When trying to run the following code:

Theory.mode="chromatic"
s = PolySynth("bleep", {"decay":1, "maxVoices":4})
s.chord([0,4,7])

I see in the "debug console" a message of the form:

TypeError: frequencies.forEach is not a functiongibberish_worklet.js:8559:19
    chord https://gibber.cc/alpha/playground/gibberish_worklet.js:8559
    callback https://gibber.cc/alpha/playground/gibberish_worklet.js:10149
    anonymous https://gibber.cc/alpha/playground/gibberish_worklet.js line 7450 > Function:6
    process https://gibber.cc/alpha/playground/gibberish_worklet.js:17776

Here is the snippet of in question (in gibberish_worklet.js):

...
  chord(frequencies) {
    // will be sent to processor node via proxy method...
    if (Gibberish !== undefined && Gibberish.mode !== 'worklet') {
      frequencies.forEach(v => this.note(v));
      this.triggerChord = frequencies;
    }
  },
...

Once the error occurs when trying to use the chord method, the window no longer plays sounds and the little moving light bar in the upper left stops running.


I also tried using an example I saw from an online book, "Gibber User Manual", Part 2, that gave the following example:

a = FM({ maxVoices:4 })
a.chord( [0,2,4,6] )

For which I get the following error:

TypeError: a.chord is not a function
    anonymous https://gibber.cc/alpha/playground/bundle.js line 61491 > Function:6
    runCode https://gibber.cc/alpha/playground/bundle.js:61496
    Enter https://gibber.cc/alpha/playground/bundle.js:61537
    doHandleBinding https://gibber.cc/alpha/playground/bundle.js:30189
    handleKeyBinding https://gibber.cc/alpha/playground/bundle.js:30260
    lookupKey https://gibber.cc/alpha/playground/bundle.js:29834
    lookupKeyForEditor https://gibber.cc/alpha/playground/bundle.js:30203
    dispatchKeyInner https://gibber.cc/alpha/playground/bundle.js:30230
    dispatchKey https://gibber.cc/alpha/playground/bundle.js:30226
    handleKeyBinding https://gibber.cc/alpha/playground/bundle.js:30260
    onKeyDown https://gibber.cc/alpha/playground/bundle.js:30279
    operation https://gibber.cc/alpha/playground/bundle.js:27001
    on https://gibber.cc/alpha/playground/bundle.js:23614
    registerEventHandlers https://gibber.cc/alpha/playground/bundle.js:31085
    CodeMirror https://gibber.cc/alpha/playground/bundle.js:30950
    CodeMirror https://gibber.cc/alpha/playground/bundle.js:30909
    onload https://gibber.cc/alpha/playground/bundle.js:61098
    EventHandlerNonNull*[253]< https://gibber.cc/alpha/playground/bundle.js:61084
    o https://gibber.cc/alpha/playground/bundle.js:1
    r https://gibber.cc/alpha/playground/bundle.js:1
    <anonymous> https://gibber.cc/alpha/playground/bundle.js:1

Though this error does not cause the gibber sound to "crash" and I can still play sounds after this error has occurred.


I'm running Firefox 83.0 (64-bit) on Ubuntu 16.04.7 LTS (Xenial).

@charlieroberts
Copy link
Collaborator

Hi, thanks for this... I broke something here and will try and fix soon. In the meantime, I'll note that sequencing chords still works, for example:

Theory.mode="chromatic"
s = PolySynth("bleep", {"decay":1, "maxVoices":4})
s.chord.seq( [ [0,4,7], [1,3,6] ], 2 )

So it's just the individual triggering that's a problem, and I'm pretty sure I know what that bug is. Thanks!

@charlieroberts charlieroberts self-assigned this Nov 30, 2020
@abetusk
Copy link
Author

abetusk commented Nov 30, 2020

The code:

Theory.mode="chromatic"
s = PolySynth("bleep", {"decay":1,"maxVoices":4})
s.chord.seq( [0,4,7],[1,3,6], 2)

does not work for me. I get the following error:

TypeError: frequencies.forEach is not a function gibberish_worklet.js:8559:19
    chord https://gibber.cc/alpha/playground/gibberish_worklet.js:8559
    callback https://gibber.cc/alpha/playground/gibberish_worklet.js:10149
    anonymous https://gibber.cc/alpha/playground/gibberish_worklet.js line 7450 > Function:6
    process https://gibber.cc/alpha/playground/gibberish_worklet.js:17776

Maybe this is a difference between Firefox and Chromium? For the sake of redundancy, I'm on Firefox 83.0 (64-bit).

@charlieroberts
Copy link
Collaborator

No, just a typo, with chords you're effectively sequencing an array of arrays, so you need to have an extra pair of [] around all the individual chords. If you copy/paste the code I posted (note the extra array brackets in there) it should work... let me know if it doesn't!

@abetusk
Copy link
Author

abetusk commented Nov 30, 2020

Ah! My apologies! Yes, that works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants