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

Add support for the "loudness" block and "loudness greater than" trigger #137

Merged
merged 8 commits into from
Jul 24, 2022

Conversation

adroitwhiz
Copy link
Collaborator

Based on @apple502j's work, with some refactoring and rebasing to work with the new edge-activated trigger code and also clean up the code a bit.

Resolves #122 and closes #60.

@PullJosh
Copy link
Collaborator

Any idea why this.loudness is always returning 0? (Except before connecting, when it returns -1.)

image

The variable watcher is displaying this.loudness from within the stage, and the cat is saying this.loudness from within the sprite.

@PullJosh
Copy link
Collaborator

PullJosh commented Jul 22, 2022

I am confused... I changed nothing, but an hour later, this.loudness is working perfectly. 🤔

Edit: Aaaaaannnd now it's broken again.

@PullJosh
Copy link
Collaborator

Oh, I see. Chrome has been giving me the following warning for a long time now (since long before this PR):

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

I assumed this was for playing sounds only, but it appears that the microphone access also relies on Sound.audioContext, and that audioContext is suspended (and thus the mic gets no data--all zeroes).

Copy link
Collaborator

@PullJosh PullJosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behavior looks good now 👍

(@towerofnix said they might be away, so I removed them as a reviewer.)

@PullJosh PullJosh removed the request for review from towerofnix July 24, 2022 14:15
@adroitwhiz adroitwhiz merged commit 17d0667 into leopard-js:master Jul 24, 2022
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

Successfully merging this pull request may close these issues.

Support Scratch blocks: "when greater than" & "loudness"
3 participants