Add cassette motor relay sound effects to BBC Micro emulator#520
Add cassette motor relay sound effects to BBC Micro emulator#520
Conversation
mattgodbolt
left a comment
There was a problem hiding this comment.
@copilot this looks like a decent amount of copy paste from somewhere else. Are there ways to deduplicate functions you may have copied in tapenoise.js?
Also, confusingly we already have some "tape noise" type functionality in the form of the toneGenerator inside the sound chip. I don't propose we change that, but let's rename tapenoise to be relaynoise.js please so it's clearer this isn't the actual "tape" sound (which is the tones)
Co-authored-by: mattgodbolt <633973+mattgodbolt@users.noreply.github.com>
Good catch! I've addressed both concerns: Deduplication: Created shared Naming clarity: Renamed All tests continue to pass (252/252) and the functionality remains exactly the same - this was purely a refactoring to improve code organization and clarity. Commit: 30db152 |
This PR implements the cassette motor relay "click" sound feature requested in issue #296. The BBC Micro's cassette motor relay produces distinctive click sounds when turning on and off, which are now emulated to enhance the authentic experience.
Implementation
The feature follows the existing audio architecture pattern used for disc drive sounds:
RelayNoiseclass: Handles cassette relay sounds similar to the existingDdNoiseclass for disc drivesAudioHandler→ CPU constructor → ACIA, maintaining the established audio system architectureKey Changes
Acia.setMotor()to trigger click sounds when the relay state actually changesFakeRelayNoiseCode Organization
audio-utils.jswithBaseAudioNoiseclass andloadSoundsfunction to eliminate code duplication between disc drive and relay noise implementationsRelayNoise(notTapeNoise) to distinguish from actual tape audio functionality handled by the sound chip'stoneGeneratorTesting
RelayNoiseclass and ACIA integrationThe sounds are currently placeholder audio files generated synthetically. As mentioned in the issue, these could be replaced with recordings from real BBC Master hardware in the future.
Fixes #296.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.