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

Unable to use WahWah In Compiled Electron App #70

Open
stuible opened this issue Mar 9, 2019 · 15 comments
Open

Unable to use WahWah In Compiled Electron App #70

stuible opened this issue Mar 9, 2019 · 15 comments

Comments

@stuible
Copy link

stuible commented Mar 9, 2019

I'm experiencing a very strange bug with the WahWah effect in Tuna.js. When I compile my electron app which uses WahWah. No matter what options I pass in (Even just bypass). I get the following error:
TypeError: Cannot assign to read only property 'Q' of object '#'

Web Tools debugging tracks the error down to this line:
https://github.com/Theodeus/tuna/blob/master/tuna.js#L1978

I really appreciate the work put into this library, it's been great to use, this one is just a bit of a head scratcher.

@Theodeus
Copy link
Owner

That's an interesting one indeed!

It makes sense that it happens even though it's in bypass, since the node is still initialized with the defaults. It look like the Web Audio implementations in Electron and browsers differ then.

I'd have to setup an electron project to figure this out, though I'm currently on parental leave, so time is in short supply. :) Do you have a project somewhere that I could clone and test with?

@stuible
Copy link
Author

stuible commented Mar 16, 2019

Thanks reply, I appreciate it! I have a relatively complex project that displays this error but I almost feel bad making you look through it's code base:
https://github.com/stuible/Image-Snafu/tree/WahWahErrorOnBuild

The Javascript responsible for directly interfacing with Tuna.js is found:
https://github.com/stuible/Image-Snafu/tree/WahWahErrorOnBuild/src/assets/js/snafu.js

It should be noted that no other audio effect I have tested has caused this error.

@darrendahl
Copy link
Contributor

I also have received a similar error for WahWah effect, but on the web (chrome) -

tuna.js:1924 Uncaught TypeError: Cannot assign to read only property 'filterFreqTimeout' of object '[object Object]'
    at Tuna.WahWah.value (tuna.js:1924)
    at Tuna.WahWah.<anonymous> (tuna.js:1925)

I will try to come up with a good environment to test and isolate the problem.

Awesome library by the way! Every other effect works like a charm. 👍

@Theodeus
Copy link
Owner

Looks like the whole filter frequency bit in the WahWah could use some refactoring. :) The whole try/catch bit in there looks suspicious. But for your specific error, with the filterFrequencyTimeout, that could be a straight out bug in that that property isn't set as writable.

Now I just have to figure out how to trigger the error before I patch it. 😁

@darrendahl
Copy link
Contributor

Ahh yeah when I isolate here it works... so still a mystery

https://codesandbox.io/s/hopeful-chaplygin-8egr9?file=/src/index.js

@alesaccoia
Copy link
Collaborator

alesaccoia commented Nov 12, 2020

I was also just looking into this...

I have found a possible bug here, that should probably assign to "this.filter.Q.value", but it's more related to the first bug in this issue

@Theodeus
Copy link
Owner

That ought to trigger the setter here, so I think that should work..

@alesaccoia
Copy link
Collaborator

nice try then, gimme a few more tries and I may be of help again :P

@Theodeus
Copy link
Owner

Theodeus commented Nov 12, 2020

@darrendahl - when you're creating the WahWah in the original code, are you passing any parameters to the constructor? If so - what values are passed when you get the error?

Also, if you run Tuna unminified, does adding writable: true here change anything?

EDIT: typo 😨

@darrendahl
Copy link
Contributor

darrendahl commented Nov 12, 2020

It does! I dont see that error anymore (it was on a loop so would get hundreds), now I see this one more prominently (it was also happening before but at the top of the error stack so I missed it)

tunajs.js:1979 Uncaught (in promise) TypeError: Cannot set property Q of #<BiquadFilterNode> which has only a getter

@Theodeus
Copy link
Owner

Nice!

And this might be where your finding comes in, Alessandro, as we're setting the Q without Q.value here, and that's an actual native Web Audio node!

I would still be interested in reproducing this though. When you do get the error, Darren, has the code been through some kind of processing (webpack or the like?).

@darrendahl
Copy link
Contributor

Got it, thanks! This fixes it.

line 1979

this.filterPeaking.Q.value= this._resonance;

from

this.filterPeaking.Q= this._resonance;

Yes I'm using rollup - resolves at "tunajs": "^1.0.11"

@darrendahl
Copy link
Contributor

@darrendahl
Copy link
Contributor

#82

@darrendahl
Copy link
Contributor

PS I've never contributed to an open source project before 😂

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

No branches or pull requests

4 participants