Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Want some hardware-accurate Gameboy music and sounds in your HTML5 game or app? Don't want to load megabytes of .mp3 files? Overwhelmed or frustrated by the Web Audio API?
Enter apu! This easy-to-use module is a reasonably accurate emulation of the GameBoy's Audio Processing Unit. (APU!) It weighs in at roughly 3 kilobytes. (min + gzip)
Try it on StackBlitz! This demonstrates most of the capabilities and commands.
Here is another demo which plays an actual song. Compare to the original!
apu intends to deliver a good balance between size, accuracy, and ease-of-use. Its internals are still fairly accurate to how the real hardware works, but it omits some of the more obscure behavior. From a user's point of view, it uses an easy-to-read function-based API, rather than retaining the old notion of writing to registers on an APU. A user should be able to make some kind of sound happen with just one import
statement and one function call.
Not thoroughly tested, but Chrome and Firefox seem good. Safari seems to run, but does not always playback correctly.
This project started as a fork of Grant Galitz's JavaScript Gameboy emulator. I wanted to play convincing retro sound effects in the browser and decided that starting from a working emulator might be the best place to start. Grant's emulator was an excellent place to start from; its audio emulation is very accurate, and it was also clearly written with performance in mind.
I stripped out all of the components except the basics required to generate sound (no CPU cycles, no opcodes, no sprites, no interrupts, no joypad, no registers, no ROM...) and refactored it to make it easier to understand (from the perspective of both a user and a contributor) as well as minify better (less duplicate code, no large function prototypes)
Eventually, I rewrote the entire project from scratch. Instead of using the deprecated ScriptProcessorNode, the project now creates various AudioBufferSourceNodes for the different samples, and renders playback to OfflineAudioContexts to loop music playback. Only a dozen or so lines of code from the original project remain.
FAQs
Easy 3 kB library for 98% accurate Gameboy audio
The npm package apu receives a total of 2 weekly downloads. As such, apu popularity was classified as not popular.
We found that apu demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.