فهرست منبع

Initialize memory bank

Billie Hilton 4 ماه پیش
والد
کامیت
bf05e9dbec
3فایلهای تغییر یافته به همراه187 افزوده شده و 0 حذف شده
  1. 32 0
      memory-bank/context.md
  2. 45 0
      memory-bank/current.md
  3. 110 0
      memory-bank/patterns.md

+ 32 - 0
memory-bank/context.md

@@ -0,0 +1,32 @@
+# Dawdlehorn - Digital Audio Workstation Context
+
+## Project Overview
+Dawdlehorn is a web-based Digital Audio Workstation (DAW) / Groovebox / musical instrument controlled via gamepad input. It's designed to provide an intuitive, game-like interface for music creation and performance.
+
+## Core Requirements
+- **Gamepad Control**: Primary interface using Web Gamepad API
+- **Audio Processing**: Real-time audio synthesis and effects using Web Audio API
+- **MIDI Integration**: External MIDI device support via Web MIDI API
+- **Web-based**: Runs in modern browsers with no installation required
+- **Real-time Performance**: Low-latency audio for live performance use
+
+## Target User Experience
+- Intuitive gamepad-based music creation
+- Real-time audio feedback and manipulation
+- Groovebox-style workflow (pattern-based sequencing)
+- Accessible to both musicians and non-musicians
+- Performance-oriented interface
+
+## Technical Constraints
+- Must work in modern web browsers
+- Low audio latency requirements
+- Gamepad compatibility across different controllers
+- Responsive real-time interface
+- No server-side processing (client-side only)
+
+## Success Criteria
+- Responsive gamepad input with minimal latency
+- High-quality audio output
+- Intuitive user interface
+- Stable performance during extended use
+- Cross-browser compatibility

+ 45 - 0
memory-bank/current.md

@@ -0,0 +1,45 @@
+# Dawdlehorn - Current State
+
+## Current Task: Project Initialization & Technical Planning
+Building a web-based Digital Audio Workstation controlled via gamepad with real-time audio processing capabilities.
+
+## Current Task Checklist
+- [x] Read existing project files to understand requirements
+- [x] Initialize memory bank structure
+- [x] Draft technical plan with libraries and architecture
+- [x] Document current state and next steps
+
+## Project Status
+- **Phase**: Initial planning and architecture design
+- **Repository**: Fresh project with basic files (README, .gitignore, LICENSE)
+- **Next Priority**: Define technical architecture and select appropriate libraries
+
+## Key Decisions Needed
+1. Audio synthesis approach (Web Audio API patterns)
+2. Gamepad input handling strategy
+3. UI framework selection
+4. State management approach
+5. Audio worklet vs main thread processing
+
+## Current Understanding
+- Target: Gamepad-controlled groovebox/DAW
+- Core APIs: Web Gamepad, Web Audio, Web MIDI
+- Environment: Browser-based, no server required
+- Focus: Real-time performance and low latency
+
+## Technical Plan Summary
+**Selected Stack:**
+- **Audio**: Tone.js + Audio Worklets for synthesis and effects
+- **Input**: Web Gamepad API + custom input manager
+- **UI**: Vanilla JavaScript + Web Components + Canvas
+- **State**: Custom lightweight state manager with audio/UI separation
+
+**Architecture**: Event-driven, audio-first design with separate processing threads
+
+## Immediate Next Steps
+1. Set up project structure and package.json
+2. Install Tone.js and set up basic audio context
+3. Implement gamepad detection and input polling
+4. Create basic Web Components for UI controls
+5. Build simple synthesizer with gamepad control
+6. Add pattern sequencer functionality

+ 110 - 0
memory-bank/patterns.md

@@ -0,0 +1,110 @@
+# Dawdlehorn - Architecture & Patterns
+
+## Technical Architecture Plan
+
+### Core Technology Stack
+
+#### Audio Processing
+- **Web Audio API**: Native browser audio processing
+- **Audio Worklets**: For low-latency, real-time audio processing
+- **Tone.js**: High-level audio synthesis and effects library
+  - Provides instruments, effects, and scheduling
+  - Built on Web Audio API with better abstractions
+  - Excellent for groovebox-style synthesis
+
+#### Input Handling
+- **Web Gamepad API**: Native gamepad support
+- **Custom Input Manager**: Abstraction layer for different controller types
+- **Event-driven architecture**: Responsive input handling
+
+#### UI Framework
+- **Vanilla JavaScript + Web Components**: For maximum performance
+- **Alternative**: Svelte (minimal runtime overhead)
+- **Canvas API**: For real-time visualizations and waveforms
+
+#### State Management
+- **Custom State Manager**: Lightweight, audio-focused
+- **Immutable updates**: Prevent audio glitches from state changes
+- **Separate audio and UI state**: Different update cycles
+
+### Application Architecture
+
+```
+┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
+│   Input Layer   │    │   Audio Engine  │    │   UI Layer      │
+│                 │    │                 │    │                 │
+│ • Gamepad API   │───▶│ • Tone.js       │───▶│ • Web Components│
+│ • MIDI API      │    │ • Audio Worklets│    │ • Canvas        │
+│ • Input Manager │    │ • Synthesis     │    │ • Visualizers   │
+└─────────────────┘    └─────────────────┘    └─────────────────┘
+         │                       │                       │
+         └───────────────────────┼───────────────────────┘
+                                 │
+                    ┌─────────────────┐
+                    │  State Manager  │
+                    │                 │
+                    │ • Pattern Data  │
+                    │ • Audio Params  │
+                    │ • UI State      │
+                    └─────────────────┘
+```
+
+### Key Design Patterns
+
+#### 1. Audio-First Architecture
+- Audio processing runs in separate thread (Audio Worklets)
+- UI updates never block audio processing
+- State changes are batched and scheduled
+
+#### 2. Component-Based UI
+- Modular components for different controls
+- Each component handles its own gamepad mappings
+- Reusable across different views/modes
+
+#### 3. Event-Driven Input
+- Gamepad events trigger audio parameter changes
+- Debounced input for smooth parameter transitions
+- Configurable input mappings
+
+#### 4. Pattern-Based Sequencing
+- Step sequencer with pattern storage
+- Real-time pattern switching
+- Quantized timing for musical accuracy
+
+### Library Selection Rationale
+
+#### Tone.js Benefits
+- Mature Web Audio abstraction
+- Built-in instruments and effects
+- Transport and timing utilities
+- Active community and documentation
+
+#### Web Components Benefits
+- Native browser support
+- Encapsulated styling and behavior
+- Framework-agnostic
+- Excellent for audio UI controls
+
+#### Audio Worklets Benefits
+- True real-time audio processing
+- Separate thread from main UI
+- Low-latency parameter updates
+- Future-proof Web Audio approach
+
+### Performance Considerations
+
+#### Audio Performance
+- Use Audio Worklets for synthesis
+- Minimize garbage collection in audio thread
+- Pre-allocate audio buffers
+- Batch parameter updates
+
+#### Input Performance
+- Poll gamepad at 60fps
+- Debounce rapid input changes
+- Use requestAnimationFrame for smooth updates
+
+#### UI Performance
+- Canvas for real-time visualizations
+- Virtual scrolling for large pattern lists
+- Efficient DOM updates with Web Components