Skip to content

Implement research-based analog drum synthesis refinements#129

Open
Pitrat-wav wants to merge 1 commit into
mainfrom
feat/research-based-drum-synthesis-2903479066001877143
Open

Implement research-based analog drum synthesis refinements#129
Pitrat-wav wants to merge 1 commit into
mainfrom
feat/research-based-drum-synthesis-2903479066001877143

Conversation

@Pitrat-wav

Copy link
Copy Markdown
Owner

This PR implements comprehensive refinements to the drum synthesis logic, strictly following the provided 'Программный синтез аналоговых ударных инструментов: Глубокий DSP-анализ и реализация на базе Web Audio API' research.

Key changes:

  • LFSR Noise: Added authentic 15-bit Linear Feedback Shift Register noise in DrumUtils.ts for TR-909 Snare.
  • 808 Kick: Implemented a two-stage VCA envelope to emulate the non-linear diode damping characteristic of the original hardware.
  • Micro-randomization: Introduced randomized start offsets for pre-generated noise buffers to ensure each hit is unique.
  • 909 Kick: Enhanced the body with a specific saturation curve and accurate frequency sweep parameters.
  • Synchronization: Added syncInternalParams to DrumMachine and integrated it into audioStore to ensure engine parameters are correctly initialized from the application state.
  • Performance: Added velocity <= 0 checks in all drum classes to skip node scheduling for silent steps.
  • Stability: Used Math.max(0.001, ...) for all exponential ramps to prevent Web Audio API errors.

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

Refined the drum synthesis engine based on the 'Deep DSP Analysis' research:
- Implemented 15-bit LFSR noise generation for authentic TR-909 textures.
- Added 'diode damping' two-stage amplitude envelope for the TR-808 Kick.
- Integrated randomized noise start offsets to eliminate the 'machine-gun' effect.
- Calibrated pitch sweeps and filter parameters for 808/909 models.
- Implemented state synchronization between the UI store and the internal audio engine.
- Added early-exit optimizations for silent drum triggers.
- Ensured Web Audio API safety with strictly positive exponential ramp targets.

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: f3d21133fb

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

Comment thread src/logic/DrumUtils.ts
// x^15 + x^14 + 1
const bit = ((state >> 14) ^ (state >> 13)) & 1;
state = ((state << 1) | bit) & 0x7FFF;
data[i] = (state / 0x7FFF) * 2 - 1;

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 Output the LFSR bit instead of the whole register

When the 909 snare uses this buffer, each sample is derived from the entire shifted register state rather than the generated LFSR output bit, so consecutive samples remain strongly correlated as the register shifts instead of producing the intended pseudo-random bitstream. This makes the new “LFSR noise” behave more like a stepped/ramping waveform than TR-909-style noise; map the feedback/output bit (for example the LSB after the shift) to -1/1 instead of scaling state.

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