Guest User

Marathon Pro Engine

a guest
Jul 4th, 2026
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 7.94 KB | Music | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <title>Trance Marathon Pro</title>
  6.   <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
  7.   <style>
  8.     body { background: #0a0a0a; color: #ff00ff; font-family: monospace; display: flex; flex-direction: column; align-items: center; padding: 20px; margin: 0; }
  9.     h1 { text-shadow: 0 0 10px #ff00ff; margin-bottom: 30px; text-transform: uppercase; letter-spacing: 2px; }
  10.     .rack { background: #111; border: 2px solid #ff00ff; border-radius: 10px; padding: 25px; box-shadow: 0 0 20px rgba(255, 0, 255, 0.2); width: 100%; max-width: 800px; }
  11.     .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 20px; }
  12.     .module { background: #1a1a1a; padding: 15px; border: 1px solid #333; border-radius: 5px; }
  13.     .module h3 { margin-top: 0; color: #00ffff; border-bottom: 1px solid #333; padding-bottom: 5px; font-size: 1rem; }
  14.     .control-group { display: flex; flex-direction: column; margin-bottom: 12px; }
  15.     label { font-size: 0.8rem; margin-bottom: 5px; color: #ccc; }
  16.     input[type="range"] { width: 100%; cursor: pointer; accent-color: #ff00ff; }
  17.     .transport { display: flex; gap: 15px; margin-top: 20px; }
  18.     button { flex: 1; padding: 15px; cursor: pointer; background: #000; color: #00ffff; border: 2px solid #00ffff; font-weight: bold; text-transform: uppercase; transition: 0.2s; }
  19.     button:hover { background: #00ffff; color: #000; box-shadow: 0 0 15px #00ffff; }
  20.     #randomBtn { border-color: #ff00ff; color: #ff00ff; }
  21.     #randomBtn:hover { background: #ff00ff; color: #000; box-shadow: 0 0 15px #ff00ff; }
  22.   </style>
  23. </head>
  24. <body>
  25.  
  26. <h1>Marathon Pro Engine</h1>
  27.  
  28. <div class="rack">
  29.   <div class="grid">
  30.     <div class="module">
  31.       <h3>Master Clock</h3>
  32.       <div class="control-group">
  33.         <label id="bpmLabel">BPM: 140</label>
  34.         <input type="range" id="bpm" min="120" max="180" value="140">
  35.       </div>
  36.       <div class="control-group">
  37.         <label>Master Reverb Wet</label>
  38.         <input type="range" id="reverb" min="0" max="100" value="30">
  39.       </div>
  40.     </div>
  41.  
  42.     <div class="module">
  43.       <h3>Trance Lead Shape</h3>
  44.       <div class="control-group">
  45.         <label>Filter Sweep (Hz)</label>
  46.         <input type="range" id="filter" min="100" max="8000" value="2500">
  47.       </div>
  48.       <div class="control-group">
  49.         <label>Lead Attack Swell</label>
  50.         <input type="range" id="leadAttack" min="1" max="1000" value="10">
  51.       </div>
  52.       <div class="control-group">
  53.         <label>Delay Feedback</label>
  54.         <input type="range" id="delayFb" min="0" max="80" value="40">
  55.       </div>
  56.     </div>
  57.  
  58.     <div class="module">
  59.       <h3>Low End</h3>
  60.       <div class="control-group">
  61.         <label>Kick Depth (Pitch Octaves)</label>
  62.         <input type="range" id="kickPitch" min="1" max="8" value="4">
  63.       </div>
  64.       <div class="control-group">
  65.         <label>Kick Decay</label>
  66.         <input type="range" id="kickDecay" min="10" max="100" value="40">
  67.       </div>
  68.     </div>
  69.   </div>
  70.  
  71.   <div class="transport">
  72.     <button id="startBtn">System Offline [Start]</button>
  73.     <button id="randomBtn">Generate New Rhythms</button>
  74.   </div>
  75. </div>
  76.  
  77. <script>
  78.   // 1. Audio Architecture & Effects Chain
  79.  const masterReverb = new Tone.Reverb({ decay: 4, wet: 0.3 }).toDestination();
  80.   const leadDelay = new Tone.PingPongDelay("8n.", 0.4).connect(masterReverb);
  81.   const leadFilter = new Tone.Filter(2500, "lowpass").connect(leadDelay);
  82.  
  83.   // 2. Synthesizers
  84.   // "fatsawtooth" creates the classic detuned trance thickness
  85.   const leadSynth = new Tone.PolySynth(Tone.Synth, {
  86.     oscillator: { type: "fatsawtooth", count: 3, spread: 20 },
  87.     envelope: { attack: 0.01, decay: 0.2, sustain: 0.4, release: 1 }
  88.   }).connect(leadFilter);
  89.  
  90.   // Deep, tunable 808-style kick
  91.   const kick = new Tone.MembraneSynth({
  92.     pitchDecay: 0.05,
  93.     octaves: 4,
  94.     envelope: { attack: 0.001, decay: 0.4, sustain: 0.01, release: 0.4 }
  95.   }).connect(masterReverb);
  96.  
  97.   // Sharp, bright hi-hat
  98.   const hat = new Tone.MetalSynth({
  99.     frequency: 300, envelope: { attack: 0.001, decay: 0.05, release: 0.01 },
  100.     harmonicity: 5.1, modulationIndex: 32, resonance: 4000, octaves: 1.5
  101.   }).connect(masterReverb);
  102.  
  103.   // White noise snare/clap hybrid
  104.   const snare = new Tone.NoiseSynth({
  105.     noise: { type: 'white' },
  106.     envelope: { attack: 0.005, decay: 0.2, sustain: 0 }
  107.   }).connect(masterReverb);
  108.  
  109.   // Bouncy mid-percussion
  110.   const perc = new Tone.MembraneSynth({ pitchDecay: 0.1, octaves: 2 }).connect(masterReverb);
  111.  
  112.   // 3. Sequencer State (16 steps for complexity)
  113.   let sequences = {
  114.     kick:  [1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0], // 4-on-the-floor
  115.     hat:   [0,0,1,0, 0,0,1,0, 0,0,1,0, 0,0,1,1], // Off-beat + variation
  116.     snare: [0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,0], // Claps on 2 and 4
  117.     perc:  [0,1,0,0, 0,1,0,1, 0,0,0,1, 0,1,0,0]  // Syncopated groove
  118.   };
  119.  
  120.   // The 5-tone trance scale pool (A Minor Pentatonic)
  121.   const tranceScale = ["A3", "C4", "D4", "E4", "G4", "A4"];
  122.   let leadMelody = Array.from({length: 16}, () => Math.random() > 0.5 ? tranceScale[Math.floor(Math.random() * tranceScale.length)] : null);
  123.  
  124.   // 4. Transport Loop
  125.   new Tone.Sequence((time, step) => {
  126.     // Percussion
  127.     if (sequences.kick[step]) kick.triggerAttackRelease("A0", "16n", time);
  128.     if (sequences.hat[step]) hat.triggerAttackRelease("16n", time, 0.2);
  129.     if (sequences.snare[step]) snare.triggerAttackRelease("16n", time, 0.5);
  130.     if (sequences.perc[step]) perc.triggerAttackRelease("E2", "16n", time, 0.4);
  131.  
  132.     // Melody
  133.     let currentNote = leadMelody[step];
  134.     if (currentNote) {
  135.       leadSynth.triggerAttackRelease(currentNote, "16n", time, 0.6);
  136.     }
  137.   }, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], "16n").start(0);
  138.  
  139.   // 5. Interface Bindings
  140.   document.getElementById('bpm').addEventListener('input', (e) => {
  141.     Tone.Transport.bpm.value = e.target.value;
  142.     document.getElementById('bpmLabel').innerText = `BPM: ${e.target.value}`;
  143.   });
  144.  
  145.   document.getElementById('reverb').addEventListener('input', (e) => masterReverb.wet.value = e.target.value / 100);
  146.   document.getElementById('filter').addEventListener('input', (e) => leadFilter.frequency.value = e.target.value);
  147.   document.getElementById('delayFb').addEventListener('input', (e) => leadDelay.feedback.value = e.target.value / 100);
  148.  
  149.   document.getElementById('leadAttack').addEventListener('input', (e) => {
  150.     // Morphs the lead from a sharp pluck to a slow swelling pad
  151.     leadSynth.set({ envelope: { attack: e.target.value / 1000 } });
  152.   });
  153.  
  154.   document.getElementById('kickPitch').addEventListener('input', (e) => kick.octaves = e.target.value);
  155.   document.getElementById('kickDecay').addEventListener('input', (e) => kick.set({ envelope: { decay: e.target.value / 100 } }));
  156.  
  157.   // Randomizer Logic
  158.   document.getElementById('randomBtn').addEventListener('click', () => {
  159.     // Randomize hats and perc, leave kick and snare steady for workout rhythm
  160.     sequences.hat = Array.from({length: 16}, () => Math.random() > 0.4 ? 1 : 0);
  161.     sequences.perc = Array.from({length: 16}, () => Math.random() > 0.7 ? 1 : 0);
  162.    
  163.     // Generate new melody from the 5-tone scale
  164.     leadMelody = Array.from({length: 16}, () => Math.random() > 0.5 ? tranceScale[Math.floor(Math.random() * tranceScale.length)] : null);
  165.   });
  166.  
  167.   // Transport Control
  168.   document.getElementById('startBtn').addEventListener('click', async (e) => {
  169.     await Tone.start();
  170.     if (Tone.Transport.state !== 'started') {
  171.       Tone.Transport.start();
  172.       e.target.innerText = "System Online [Stop]";
  173.       e.target.style.background = "#00ffff";
  174.       e.target.style.color = "#000";
  175.     } else {
  176.       Tone.Transport.stop();
  177.       e.target.innerText = "System Offline [Start]";
  178.       e.target.style.background = "#000";
  179.       e.target.style.color = "#00ffff";
  180.     }
  181.   });
  182. </script>
  183. </body>
  184. </html>
Advertisement
Add Comment
Please, Sign In to add comment