Skip to content

Authentic TR-808/909 Drum Synthesis Engine - #137

Open
Pitrat-wav wants to merge 1 commit into
mainfrom
feat/authentic-drum-synthesis-7081671166178346237
Open

Authentic TR-808/909 Drum Synthesis Engine#137
Pitrat-wav wants to merge 1 commit into
mainfrom
feat/authentic-drum-synthesis-7081671166178346237

Conversation

@Pitrat-wav

Copy link
Copy Markdown
Owner

This PR implements a high-fidelity virtual analog drum synthesis engine for the Telegram Mini App, replacing basic approximations with deep DSP models based on Roland TR-808 and TR-909 research.

Key changes include:

  • Noise Engine: Added a true 15-bit LFSR (Linear Feedback Shift Register) for 909 Snare and optimized white noise generators.
  • 808 Kick: Accurate Bridged-T Network emulation with diode damping (20ms initial decay to 50% volume).
  • 909 Kick: Aggressive 4.7x frequency sweep and parallel noise/pulse click layers.
  • Hi-Hats/Cowbell: Full 6-oscillator Schmitt Trigger Matrix implementation with parallel bandpass filtering.
  • Stability: Robust node cleanup using activeVoices sets and setTimeout safety nets, preventing memory leaks and ensuring clean choking.
  • Analog Drift: Integrated per-trigger micro-randomization for pitch, filters, and phase.

PR created automatically by Jules for task 7081671166178346237 started by @Pitrat-wav

- Refactored all drum models to follow 'Analog Drum Synthesis in Web Audio API' research.
- Implemented authentic 15-bit LFSR noise for TR-909 Snare 'Snappy' component.
- Implemented Diode Damping emulation for TR-808 Kick using two-stage amplitude envelopes.
- Replaced pre-trigger buffer generation with shared pre-calculated noise buffers in `DrumUtils.ts`.
- Implemented `randomStart` for all noise-based drums to eliminate the 'machine-gun' effect.
- Improved node termination and choking logic using `activeVoices` tracking and explicit oscillator disposal.
- Calibrated pitch sweeps and filter frequencies to match hardware specifications (e.g., 909 Kick 4.7x pitch sweep, 808 Hi-Hat 6-oscillator matrix).
- Added velocity-sensitivity early exits and strictly positive ramp values for Web Audio stability.

Co-authored-by: Pitrat-wav <255843145+Pitrat-wav@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34f442b030

ℹ️ 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".

gain.gain.exponentialRampToValueAtTime(0.001, time + 0.02);
this.activeVoices.forEach(voice => {
voice.oscillators.forEach(osc => {
osc.stop(time);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let hihat chokes fade before stopping sources

When a closed hat triggers, DrumMachine calls hihatOpen.stop(time) (src/logic/DrumMachine.ts:112/124) to choke the open hat. Stopping each oscillator exactly at time means the subsequent gain.exponentialRampToValueAtTime(..., time + 0.02) has no audio left to fade, so every choke becomes an instantaneous cut at an arbitrary oscillator phase and can click; stop the sources after the fade or leave them running through the gain ramp.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant