Repository navigation
Card Rat: pause to shuffle the deck between passes - #239
Merged
Merged
Conversation
playShuffleSound() generates a riffle of short noise clicks followed by a soft swish, played through a band-pass filter. No audio file is used. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the last card of a pass, the table clears and the status line reads "Shuffling". After a short pause, the deck card wiggles and the shuffle sound plays (unless Card sound is off), then the next pass is dealt. An unslapped trigger on the last card still counts as a miss. Slaps while shuffling are ignored, and the first card of a new pass cannot pair or sandwich with cards from the old one. Fixes #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shuffle now only replaces the deck. The last card stays on the table and stays current, so slaps during the shuffle score as they would at any other time, a missed trigger is still scored when the next card is dealt, and pairs and sandwiches carry across into the new pass. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the separate noise clicks with continuous softened noise whose level flutters smoothly, quickly at first and slower as the last cards fall, through a low-pass filter instead of a band-pass filter. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npm run sound-harness opens a separate Electron window with a button for each play* function in audioService.js that takes no arguments, so a sound can be heard and tuned without playing a game. It lives in scripts/, which Forge does not package. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lower its gain from 0.25 to 0.15, and darken the noise: a stronger one-pole smoothing (0.35 to 0.2) and a lower low-pass cutoff (3000 Hz to 2000 Hz) cut the white-noise hiss. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add presets for the sounds that need arguments: success and failure through playFeedbackSound, and all four playSweepPair sequences, with inputs for the sweep length and gap. A test fails if the audio service exports a play* function the harness cannot play. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
playFeedbackSound only calls playSuccessSound or playFailureSound, so its two buttons repeated the Success and Failure buttons. SOUND_WRAPPERS now lists it as a wrapper, which gets no buttons of its own; the harness test checks that each wrapper's sounds have buttons. Refs #198 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Once all 55 cards in a pass have been dealt, Card Rat now pauses to shuffle before dealing the next pass, as the issue asks. This PR also adds a separate sound harness, so a sound can be heard without playing a game.
What changed
playShuffleSound()that is synthesized, not a recording. It plays about 0.75 s of softened noise whose level flutters smoothly, quickly at first and slower as the last cards fall, then a soft swish. The noise is darkened (one-pole smoothing plus a 2000 Hz low-pass) to keep hiss down, and the gain is 0.15.game.js):dealNextCard()now reportsdeckExhaustedon the last card of a pass. A newshuffleForNextPass()only replaces the deck:index.js): after the last card's display time, the status line reads "Shuffling". After 500 ms, the deck card wiggles and the shuffle sound plays. The next deal comes 1200 ms later. End Game cancels the shuffle, as it does the deal timer.prefers-reduced-motion.npm run sound-harnessopens a separate Electron window that plays every sound inaudioService.js:play*function that takes no arguments gets a button on its own.playSweepPairsequences come fromSOUND_PRESETS, with inputs for sweep length and gap.playFeedbackSoundonly callsplaySuccessSoundorplayFailureSound, so it is listed inSOUND_WRAPPERSand gets no buttons of its own. Each sound has one button.play*function the harness can't play.scripts/sound-harness/, which Forge does not package.CLAUDE.mdfiles are updated.Worth a close look
audioService.js. Use the harness to try changes.Testing
npm run lintis clean.npm run test:coverage: all 2198 tests pass, and the coverage thresholds are met.Signed: Claude Code
🤖 Generated with Claude Code