{"id":34641772,"url":"https://github.com/innermost47/random-music-js","last_synced_at":"2026-06-01T07:31:25.051Z","repository":{"id":328620989,"uuid":"588872426","full_name":"innermost47/random-music-js","owner":"innermost47","description":"    Random Music JS is a web-based algorithmic music generator built with the Web Audio API. Explore two distinct generators: \"EightBits\" for dynamic, retro-inspired tracks with evolving drum patterns and melodies, and \"Sine Wave\" for lush, ambient electronic soundscapes with a rich effects chain.","archived":false,"fork":false,"pushed_at":"2025-12-14T10:21:04.000Z","size":1428,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-30T05:42:35.049Z","etag":null,"topics":["8bit-music","algorithmic-composition","creative-coding","javascript","music-generator","procedural-generation","synthesizer","velectronic-music","web-audio-api","web-development"],"latest_commit_sha":null,"homepage":"https://random-music.anthony-charretier.fr/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/innermost47.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-14T10:07:32.000Z","updated_at":"2026-02-25T13:54:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/innermost47/random-music-js","commit_stats":null,"previous_names":["innermost47/random-music-js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/innermost47/random-music-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innermost47%2Frandom-music-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innermost47%2Frandom-music-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innermost47%2Frandom-music-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innermost47%2Frandom-music-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/innermost47","download_url":"https://codeload.github.com/innermost47/random-music-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/innermost47%2Frandom-music-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33765378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["8bit-music","algorithmic-composition","creative-coding","javascript","music-generator","procedural-generation","synthesizer","velectronic-music","web-audio-api","web-development"],"created_at":"2025-12-24T17:20:00.218Z","updated_at":"2026-06-01T07:31:25.047Z","avatar_url":"https://github.com/innermost47.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RANDOM MUSIC JS\n\nA web-based music generator that creates coherent and randomized musical pieces using the Web Audio API. This project explores algorithmic composition, generating dynamic drum patterns, basslines, chords, and melodies within a chosen scale.\n\n## Live Demo\n\n- **Discover it online:** [https://random-music.anthony-charretier.fr/](https://random-music.anthony-charretier.fr/)\n- **YouTube Demo:** [https://www.youtube.com/watch?v=cw6gSLhoE0g](https://www.youtube.com/watch?v=cw6gSLhoE0g)\n\n## Features\n\n- **Algorithmic Composition:** Generates unique and coherent musical sequences for drums, bass, chords, and melodies.\n- **Two Generators:**\n  - **EightBits:** Focuses on retro-inspired drum sounds and dynamic musical structures, including intros, breaks, and \"riddims.\"\n  - **Sine Wave:** Utilizes sine and other basic waveforms with various effects (delay, distortion, reverb, filtering) to create evolving electronic soundscapes.\n- **Web Audio API:** Leverages browser capabilities for real-time audio synthesis and processing.\n- **Dynamic Scale Changes:** The EightBits generator randomly selects root notes and minor modes for varied harmonic content.\n- **Interactive Controls:** Play, pause, stop, and select between different music generators.\n- **Visual Feedback:** (Implied by `startDraw`, `stopDraw` and `updateDisplay` functions) The UI updates to show current musical parameters.\n\n## How it Works\n\nThe project consists of two main music generation modules: `eightBits.js` and `sine.js`, along with a central `main.js` to manage playback and UI.\n\n### Core Concepts\n\n- **`Timer.js`:** A custom timer utility for precise, Web Audio API-synchronized scheduling of musical events.\n- **`Mode.js`:** (Used in `eightBits.js`) Manages musical scales, generating frequencies based on a root note and a chosen minor mode.\n- **Buffers \u0026 Samples:** Drum sounds are loaded as audio buffers.\n- **Oscillators:** Sine, sawtooth, and square wave oscillators are used for synthesizing melodic and harmonic content.\n- **Web Audio Nodes:** Extensive use of `GainNode`, `BiquadFilterNode` (lowpass, highpass), `DelayNode`, `ConvolverNode` (reverb), `WaveShaperNode` (distortion), `StereoPannerNode`, and `AnalyserNode` for rich sound design and effects.\n\n### EightBits Generator (`eightBits.js`)\n\nThis generator focuses on creating dynamic and structured tracks.\n\n1.  **Drum Kits:** Loads various 8-bit inspired drum samples (kicks, snares, hats, claps, cymbals).\n2.  **Scales and Modes:** Randomly picks a root note and a minor mode (`chromaticScale`, `minorModes`) to define the harmonic context for the entire song.\n3.  **Sequence Generation:** Functions like `generateRandomBass`, `generateRandomNoteSequence`, `generateRandomChordSequence`, and `generateRandomMelody` create musical phrases based on the current scale.\n4.  **Song Structure:** Implements \"intro,\" \"break,\" and \"riddim\" sections by dynamically changing drum patterns and musical phrases at specific song durations.\n5.  **Filtering:** Applies lowpass filters with dynamic frequency sweeps to bass, notes, chords, and melodies, adding expressive movement.\n\n### Sine Wave Generator (`sine.js`)\n\nThis generator creates a more ambient, evolving electronic soundscape, primarily using synthesized waveforms and a robust effects chain.\n\n1.  **Drum Samples:** Loads a different set of drum samples for percussion.\n2.  **Fixed Scale:** Uses a fixed A minor scale (frequencies array) for all melodic and harmonic content.\n3.  **Complex FX Chain:**\n    - **LFO:** A low-frequency oscillator modulates filter cutoff frequencies for movement.\n    - **Distortion (`WaveShaperNode`):** Adds harmonic richness and grit.\n    - **Delay (`DelayNode`):** Creates echoes with feedback.\n    - **Filters (`BiquadFilterNode`):** Highpass and lowpass filters shape the sound.\n    - **Reverb (`ConvolverNode`):** A short impulse response reverb adds space.\n    - **Analyzer (`AnalyserNode`):** (Potentially for visualizers in `draw.js`).\n4.  **Synth Voices:** `bassSynth`, `tbSynth`, `sqSynth`, `fundamentalSynth`, `thirdSynth`, `fifthSynth`, and `melodySynth` define distinct timbres for different musical roles using various oscillator types and ADSR-like gain envelopes.\n5.  **Dynamic Sections:** Generates new melody, chord, and bass sequences at different measures to introduce variations.\n\n## Getting Started\n\n### Prerequisites\n\n- A modern web browser (Chrome, Firefox, Edge, Safari) that supports the Web Audio API.\n\n### Installation\n\n1.  **Clone the repository:**\n    ```bash\n    git clone https://github.com/innermost47/random-music-js.git\n    cd random-music-js\n    ```\n2.  **Serve the project:**\n    You need a local web server to run this project, as it loads audio files via XHR. You can use:\n    - **Live Server VS Code Extension:** If you use VS Code, install the \"Live Server\" extension and open the project folder. Right-click `index.html` and select \"Open with Live Server\".\n    - **Node.js `http-server`:**\n      ```bash\n      npm install -g http-server\n      http-server .\n      ```\n      Then open `http://localhost:8080` (or whatever port `http-server` tells you) in your browser.\n    - **Python's built-in server:**\n      ```bash\n      python -m http.server\n      ```\n      Then open `http://localhost:8000` in your browser.\n\n### Usage\n\n1.  Open the `index.html` file in your web browser through a local web server.\n2.  **Select a Song Type:** Use the \"Select Wave\" dropdown to choose between \"8-Bits\" (EightBits generator) and \"Sine Wave\" (Sine Wave generator).\n3.  **Play:** Click the \"Play\" button to start the music generation.\n4.  **Pause/Resume:** Click the \"Play/Pause\" button again to pause or resume playback.\n5.  **Stop:** Click the \"Stop\" button to stop the music and reset the generator.\n6.  **Help:** Click the \"Help\" button to re-open the welcome modal (if implemented).\n\n## Technologies Used\n\n- HTML5\n- CSS3\n- JavaScript (ES Modules)\n- Web Audio API\n- Bootstrap (for UI components)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnermost47%2Frandom-music-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finnermost47%2Frandom-music-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnermost47%2Frandom-music-js/lists"}