Authentic Analog Drum Synthesis Implementation#133
Conversation
This commit implements procedural drum synthesis for the Roland TR-808 and TR-909 models based on deep DSP research. Key features include: - Centralized DSP utilities in `DrumUtils.ts` for noise generation (white noise and 15-bit LFSR) and cents-based pitch drift. - Authentic TR-808 Kick with two-stage amplitude envelope (diode damping). - TR-909 Kick with triangle body, click layer, and saturation. - TR-808/909 Snares with dual-mode resonance and filtered noise. - Metallic TR-808 Hi-Hats and Cowbell using the Schmitt trigger oscillator matrix and proper node disposal/choking logic. - Standardized Euclidean patterns in `instrumentStore.ts` for a techno foundation. - Safety safeguards for all exponential ramps to prevent Web Audio API errors. - Randomized noise start offsets to eliminate the "machine-gun" effect. Co-authored-by: Pitrat-wav <255843145+Pitrat-wav@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1563ca6739
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (let i = 0; i < bufferSize; i++) { | ||
| const bit = ((lfsr >> 14) ^ (lfsr >> 13)) & 1; | ||
| lfsr = ((lfsr << 1) | bit) & 0x7FFF; | ||
| data[i] = (lfsr / 16384.0) - 1.0; |
There was a problem hiding this comment.
Emit LFSR bits instead of the whole register
For the new 909 snappy buffer, this writes the entire shift-register state as each sample. With the all-ones seed this produces shifted ramps with strong adjacent-sample correlation rather than a pseudo-random bitstream, so every 909 snare hit gets a tonal/periodic layer instead of the intended noise. Emit the feedback/output bit as +/-1, or otherwise whiten the state, when filling data.
Useful? React with 👍 / 👎.
| const randomStart = Math.random() * (this.noiseBuffer.duration - 0.5); | ||
| noiseSrc.start(time, randomStart).stop(time + snappyDecay + 0.1); |
There was a problem hiding this comment.
Clamp random offsets to the full snare duration
When snappy is near 1, snappyDecay + 0.1 can exceed 0.6s, but randomStart may be as late as duration - 0.5, leaving only 0.5s of buffer. Because this BufferSource is not looped, those hits end at the buffer boundary before the scheduled envelope finishes, randomly cutting off the 909 snare tail. Compute the maximum offset from the actual playback duration, or pass that duration to start.
Useful? React with 👍 / 👎.
Implemented procedural TR-808 and TR-909 drum synthesis models using the Web Audio API (via Tone.js), following the provided DSP analysis for authentic analog character.
PR created automatically by Jules for task 18282522360833143610 started by @Pitrat-wav