How gogul09/deep-drum works
Purpose and Entry Point
This is a static, browser-based intelligent music demo. It generates continuous drum patterns from a seeded rhythm and arpeggios from input notes plus chord context, using Magenta DrumsRNN and ImprovRNN concepts. The application starts from index.html, with presentation styling in css/app.scss and compiled css/app.css.
Browser Runtime and UI Layer
The client runs entirely in the browser; no server, API, database, or deployment runtime is represented in the repository. Materialize provides UI styling/components, while Nexus appears to provide interactive music-control widgets.
• index.html
• externals/css/materialize.css
• externals/js/materialize.js
• js/nexus.js
Control and State Coordination
Control changes are centralized through an update layer, which likely propagates user selections—such as tempo, instruments, patterns, or musical settings—to the sequencing and playback modules. Multi-selection/tag behavior is separated from the main control updater.
• js/update_controls.js
• js/multiple_tag.js
• js/gpad.js
Generative Music Stages
The core generation pipeline is split by musical role. deepdrum.js is the drum-pattern generation integration corresponding to the README’s DrumsRNN behavior. arp_and_bass.js handles generated arpeggio/bass behavior associated with ImprovRNN-style chord-conditioned note generation. chord_finder.js supplies harmonic context to the arpeggiator.
• js/deepdrum.js
• js/arp_and_bass.js
• js/chord_finder.js
Musical Representation and Scheduling
Music-theory utilities, MIDI/note mapping, and timeline scheduling form the boundary between generated symbolic patterns and audible playback. Generated or user-entered notes must be mapped into playable pitches/instruments and placed on a time sequence.
• js/tonal.js
• js/reverse_midi_map.js
• js/timeline.js
Audio Engine and Local Media Boundary
Tone.js is the browser audio runtime. Playback depends on repository-hosted audio samples rather than an external streaming service: piano samples in Salamander, guitar samples, bass, and several named drum kits. The generation/control code ultimately drives this audio layer.
• js/tone.js
• sounds/salamander/C4.mp3
• sounds/acoustic_guitar/A3.wav
• sounds/drum-kits/analog/kick.mp3
Primary Flow
User interaction in the page and Nexus/Materialize controls updates application state. Seed rhythms feed the drum generator; notes and detected/selected chords feed the arpeggio generator. These symbolic outputs pass through tonal/MIDI mapping and the timeline, then Tone.js schedules local instrument samples for browser playback. The important boundary is between generative pattern logic (js/deepdrum.js, js/arp_and_bass.js) and deterministic sequencing/audio playback (js/timeline.js, js/tone.js).
Main entry points: update_controls.js Control updater · index.html App entry page · tone.js Tone.js engine · arp_and_bass.js Arpeggio & bass generator
Components 17
Browser UI
- App entry page · Loads the browser application and its client-side modules.
index.html - Materialize styles
externals/css/materialize.css - Materialize controls
externals/js/materialize.js - Nexus music widgets
js/nexus.js
Control State
- Control updater · Propagates musical and playback control changes.
js/update_controls.js - Multi-select tags
js/multiple_tag.js - Gesture pad
js/gpad.js
Music Generation
- DrumsRNN integration · Generates continuous drum patterns from seeded rhythms.
js/deepdrum.js - Chord finder · Supplies chord context for generated parts.
js/chord_finder.js - Arpeggio & bass generator · Generates chord-conditioned arpeggio and bass patterns.
js/arp_and_bass.js
Representation & Scheduling
- Music theory utilities
js/tonal.js - MIDI pitch mapping
js/reverse_midi_map.js - Timeline scheduler · Places generated notes and drums onto playback time.
js/timeline.js
Audio Playback
- Tone.js engine · Schedules and plays instrument voices in the browser.
js/tone.js - Piano samples
sounds/salamander/C4.mp3 - Guitar samples
sounds/acoustic_guitar/A3.wav - Drum-kit samples
sounds/drum-kits/analog/kick.mp3
Connections 20
- App entry page → Materialize styles: styles
- App entry page → Materialize controls: loads
- App entry page → Nexus music widgets: loads
- App entry page → Control updater: initializes
- Materialize controls → Control updater: UI changes
- Nexus music widgets → Control updater: music controls
- Multi-select tags → Control updater: selections
- Gesture pad → Control updater: gestures
- Control updater → DrumsRNN integration: seed and settings
- Control updater → Chord finder: input notes
- Control updater → Arpeggio & bass generator: notes and settings
- Chord finder → Arpeggio & bass generator: chord context
- DrumsRNN integration → Timeline scheduler: drum events
- Arpeggio & bass generator → Music theory utilities: generated notes
- Music theory utilities → MIDI pitch mapping: resolved pitches
- MIDI pitch mapping → Timeline scheduler: playable events
- Timeline scheduler → Tone.js engine: scheduled playback
- Tone.js engine → Piano samples: loads
- Tone.js engine → Guitar samples: loads
- Tone.js engine → Drum-kit samples: loads