-
Notifications
You must be signed in to change notification settings - Fork 127
Add keyboard controls for pause, mute, and help overlay #10
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
base: master
Are you sure you want to change the base?
Add keyboard controls for pause, mute, and help overlay #10
Conversation
- Add SPACE key to pause/resume the sequencer - Add M key to mute/unmute audio output - Add H key to show/hide keyboard shortcuts help - Display visual indicators for paused and muted states - Uses Tone.Destination.mute for proper audio control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds keyboard controls to improve user experience by allowing pause/resume, mute/unmute, and help overlay functionality. The implementation uses p5.js keyPressed() for input handling and Tone.js for audio muting.
- Adds pause (SPACE), mute (M), and help (H) keyboard shortcuts
- Implements visual indicators for paused and muted states
- Adds a help overlay displaying available keyboard shortcuts
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (isMuted) { | ||
| Tone.Destination.mute = true; | ||
| } else { | ||
| Tone.Destination.mute = false; | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if-else statement can be simplified by directly assigning the isMuted value to Tone.Destination.mute. Instead of checking the value and setting true or false separately, you can assign isMuted directly to Tone.Destination.mute.
| if (isMuted) { | |
| Tone.Destination.mute = true; | |
| } else { | |
| Tone.Destination.mute = false; | |
| } | |
| Tone.Destination.mute = isMuted; |
| } | ||
|
|
||
| pathLineDraw(); | ||
| ellipseMoving(); |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The visual indicators (pause, mute, help overlay) are drawn even when paused, but the ellipseMoving() function still updates animation positions (linesXPos) in the paused state. This creates an inconsistency where the visual state appears frozen but the underlying animation positions continue to update. Consider also skipping ellipseMoving() when paused, or at least skip the position update inside it.
| ellipseMoving(); | |
| if (!isPaused) { | |
| ellipseMoving(); | |
| } |
|
|
||
| pathLineDraw(); | ||
| ellipseMoving(); | ||
| waveLineDraw(); |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The waveLineDraw() function continues to update animation state (waveMovingFactor and waveMovingDec) even when paused. This means the wave animation will continue to progress invisibly while paused, which may cause unexpected visual jumps when resuming. Consider also skipping these updates when isPaused is true.
| waveLineDraw(); | |
| if (!isPaused) { | |
| waveLineDraw(); | |
| } |
This PR adds essential keyboard controls that improve user experience:
Features
Visual Feedback
Why This Matters
The original project had no way to pause or mute the audio without refreshing the page. This makes it much more usable for presentations, demos, or just general use.
Technical Notes
keyPressed()functionTone.Destination.muteAPI